Search in sources :

Example 1 with IIntroPart

use of org.eclipse.ui.intro.IIntroPart in project eclipse.platform.text by eclipse.

the class ZoomTest method setUp.

@Before
public void setUp() throws Exception {
    IIntroPart intro = PlatformUI.getWorkbench().getIntroManager().getIntro();
    if (intro != null) {
        PlatformUI.getWorkbench().getIntroManager().closeIntro(intro);
    }
    IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(file.getName());
    editor = (AbstractTextEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new FileEditorInput(file), desc.getId());
    editor.setFocus();
    text = (StyledText) editor.getAdapter(Control.class);
    // make sure we start from a clean state
    initialFontSize = text.getFont().getFontData()[0].getHeight();
}
Also used : IIntroPart(org.eclipse.ui.intro.IIntroPart) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) FileEditorInput(org.eclipse.ui.part.FileEditorInput) Before(org.junit.Before)

Example 2 with IIntroPart

use of org.eclipse.ui.intro.IIntroPart 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

IIntroPart (org.eclipse.ui.intro.IIntroPart)2 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 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)1 IIntroManager (org.eclipse.ui.intro.IIntroManager)1 FileEditorInput (org.eclipse.ui.part.FileEditorInput)1 Before (org.junit.Before)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