我为eclipse写了一个插件。我在工具栏菜单中有一个按钮。我希望按下它 - 将打开一个向导页面对话框。我已经编写了一个扩展向导并实现 IWizardPage 的类,并且我还编写了所有 5 个相关页面,我只是找不到在命令处理程序中打开它的任何方法。
这是我的代码片段:
命令处理程序:
public class AddProjectHandler extends AbstractHandler {
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
return null;
}
}
向导页面管理器:
public class NewProjectWizardManager extends Wizard implements INewWizard {
private NewProjectWizardPage1 _page1;
private NewProjectWizardPage2 _page2;
private NewProjectWizardPage3 _page3;
private NewProjectWizardPage4 _page4;
private NewProjectWizardPage5 _page5;
// constructor
public NewProjectWizardManager() {
super();
setWindowTitle("New Project");
}
@Override
public void init(IWorkbench workbench, IStructuredSelection selection) {
}
@Override
public boolean performCancel() {
return true;
}
@Override
public void addPages() {
super.addPages();
_page1 = new NewProjectWizardPage1();
addPage(_page1);
_page2 = new NewProjectWizardPage2(_page1);
addPage(_page2);
_page3 = new NewProjectWizardPage3(_page1);
addPage(_page3);
_page4 = new NewProjectWizardPage4();
addPage(_page4);
_page5 = new NewProjectWizardPage5(_page1);
addPage(_page5);
}
@Override
public boolean canFinish() {
IWizardContainer container = getContainer();
if (_page5.equals(container.getCurrentPage())) {
return true;
} else {
return false;
}
}
@Override
public IWizardPage getNextPage(IWizardPage page) {
IWizardPage nextPage = super.getNextPage(page);
IWizardContainer container = getContainer();
if (nextPage != null) {
if (_page2.equals(container.getCurrentPage()) && _page2.isCheckFinishChecked())
nextPage = super.getNextPage(super.getNextPage(nextPage));
}
return nextPage;
}
@Override
public boolean performFinish() {
}
}
plugin.xml 部分:
<command
categoryId="com.commands.category"
description="Add new Project"
id="com.commands.AddProject"
name="Add new Project">
</command>
<handler
class="com.handlers.AddProjectHandler"
commandId="com.commands.AddProject">
</handler>
你有什么主意吗?