Search in sources :

Example 1 with NewWorkflowWizardPage

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);
        }
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Shell(org.eclipse.swt.widgets.Shell) ExplorerView(org.knime.workbench.explorer.view.ExplorerView) NewWorkflowWizardPage(org.knime.workbench.explorer.view.actions.NewWorkflowWizardPage) NewWorkflowWizard(org.knime.workbench.explorer.view.actions.NewWorkflowWizard) AbstractExplorerFileStore(org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore) IViewReference(org.eclipse.ui.IViewReference) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IWizardPage(org.eclipse.jface.wizard.IWizardPage) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IWizardPage (org.eclipse.jface.wizard.IWizardPage)1 WizardDialog (org.eclipse.jface.wizard.WizardDialog)1 Shell (org.eclipse.swt.widgets.Shell)1 IViewReference (org.eclipse.ui.IViewReference)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 AbstractExplorerFileStore (org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore)1 ExplorerView (org.knime.workbench.explorer.view.ExplorerView)1 NewWorkflowWizard (org.knime.workbench.explorer.view.actions.NewWorkflowWizard)1 NewWorkflowWizardPage (org.knime.workbench.explorer.view.actions.NewWorkflowWizardPage)1