Search in sources :

Example 1 with IIntroManager

use of org.eclipse.ui.intro.IIntroManager in project knime-core by knime.

the class NewProjectWizardIntroAction method run.

/**
 * {@inheritDoc}
 */
@Override
public void run(final IIntroSite site, final Properties params) {
    try {
        // close the intro page
        IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
        IIntroPart introPart = introManager.getIntro();
        if (introPart != null) {
            introManager.closeIntro(introPart);
        }
        if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length == 0) {
            PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() {

                @Override
                public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                    try {
                        // call static method on NewProjectWizard
                        AbstractExplorerFileStore workspaceRoot = null;
                        for (AbstractContentProvider cp : ExplorerMountTable.getMountedContent().values()) {
                            if (cp.getFileStore("/") instanceof LocalWorkspaceFileStore) {
                                workspaceRoot = cp.getFileStore("/");
                                break;
                            }
                        }
                        if (workspaceRoot == null) {
                            throw new IllegalArgumentException("Could not find workspace");
                        }
                        AbstractExplorerFileStore newWorkflow = workspaceRoot.getChild("KNIME_project");
                        NewWorkflowWizard.createNewWorkflow(newWorkflow, monitor);
                    } catch (CoreException ce) {
                        throw new InvocationTargetException(ce);
                    }
                }
            });
        }
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : LocalWorkspaceFileStore(org.knime.workbench.explorer.localworkspace.LocalWorkspaceFileStore) IIntroManager(org.eclipse.ui.intro.IIntroManager) IIntroPart(org.eclipse.ui.intro.IIntroPart) InvocationTargetException(java.lang.reflect.InvocationTargetException) CoreException(org.eclipse.core.runtime.CoreException) InvocationTargetException(java.lang.reflect.InvocationTargetException) IRunnableWithProgress(org.eclipse.jface.operation.IRunnableWithProgress) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) AbstractExplorerFileStore(org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore) AbstractContentProvider(org.knime.workbench.explorer.view.AbstractContentProvider)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)1 CoreException (org.eclipse.core.runtime.CoreException)1 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 IIntroManager (org.eclipse.ui.intro.IIntroManager)1 IIntroPart (org.eclipse.ui.intro.IIntroPart)1 AbstractExplorerFileStore (org.knime.workbench.explorer.filesystem.AbstractExplorerFileStore)1 LocalWorkspaceFileStore (org.knime.workbench.explorer.localworkspace.LocalWorkspaceFileStore)1 AbstractContentProvider (org.knime.workbench.explorer.view.AbstractContentProvider)1