use of org.knime.workbench.explorer.view.actions.NewWorkflowWizardPage in project knime-core by knime.
the class IntroPage method newWorkflow.
private void newWorkflow() {
ExplorerView explorerView = null;
for (IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
for (IWorkbenchPage page : window.getPages()) {
for (IViewReference ref : page.getViewReferences()) {
if (ExplorerView.ID.equals(ref.getId())) {
explorerView = (ExplorerView) ref.getPart(true);
break;
}
}
}
}
Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
NewWorkflowWizard newWiz = new NewWorkflowWizard();
newWiz.init(PlatformUI.getWorkbench(), null);
WizardDialog dialog = new WizardDialog(shell, newWiz);
dialog.create();
dialog.getShell().setText("Create new workflow");
dialog.getShell().setSize(Math.max(470, dialog.getShell().getSize().x), 350);
int ok = dialog.open();
if ((ok == Window.OK) && (explorerView != null)) {
// update the tree
IWizardPage currentPage = dialog.getCurrentPage();
if (currentPage instanceof NewWorkflowWizardPage) {
NewWorkflowWizardPage nwwp = (NewWorkflowWizardPage) currentPage;
AbstractExplorerFileStore file = nwwp.getNewFile();
Object p = ContentDelegator.getTreeObjectFor(file.getParent());
explorerView.setNextSelection(file);
explorerView.getViewer().refresh(p);
}
}
}
Aggregations