Search in sources :

Example 36 with IWizardPage

use of org.eclipse.jface.wizard.IWizardPage 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)36 InvocationTargetException (java.lang.reflect.InvocationTargetException)4 Control (org.eclipse.swt.widgets.Control)4 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)3 DBClasses (com.cubrid.cubridmanager.core.cubrid.table.model.DBClasses)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 IPageChangedListener (org.eclipse.jface.dialogs.IPageChangedListener)3 IPageChangingListener (org.eclipse.jface.dialogs.IPageChangingListener)3 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)3 IOpenListener (org.eclipse.jface.viewers.IOpenListener)3 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)3 OpenEvent (org.eclipse.jface.viewers.OpenEvent)3 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)3 GridData (org.eclipse.swt.layout.GridData)3 GridLayout (org.eclipse.swt.layout.GridLayout)3 Composite (org.eclipse.swt.widgets.Composite)3 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 TableViewer (org.eclipse.jface.viewers.TableViewer)2 WizardPage (org.eclipse.jface.wizard.WizardPage)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2