Search in sources :

Example 36 with IWorkbench

use of org.eclipse.ui.IWorkbench in project eclipse.platform.text by eclipse.

the class SegmentedModeTest method testShowNothing.

/*
	 * @see https://bugs.eclipse.org/bugs/show_bug.cgi?id=465684
	 */
@Test
public void testShowNothing() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    try {
        while (Display.getDefault().readAndDispatch()) {
        }
        IEditorPart part = IDE.openEditor(page, fFile);
        try {
            if (part instanceof ITextEditor) {
                ITextEditor editor = (ITextEditor) part;
                editor.showHighlightRangeOnly(true);
                editor.setHighlightRange(0, 0, true);
                Control control = part.getAdapter(Control.class);
                if (control instanceof StyledText) {
                    StyledText styledText = (StyledText) control;
                    String text = styledText.getText();
                    assertEquals("", text);
                }
            }
        } finally {
            page.saveEditor(part, false);
        }
    } catch (PartInitException e) {
        assertTrue(false);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Control(org.eclipse.swt.widgets.Control) ITextEditor(org.eclipse.ui.texteditor.ITextEditor) StyledText(org.eclipse.swt.custom.StyledText) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException) Test(org.junit.Test)

Example 37 with IWorkbench

use of org.eclipse.ui.IWorkbench in project eclipse.platform.text by eclipse.

the class UISynchronizationContext method run.

@Override
public void run(Runnable runnable) {
    if (Display.getCurrent() != null) {
        runnable.run();
    } else {
        IWorkbench workbench = PlatformUI.getWorkbench();
        IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
        if (windows != null && windows.length > 0) {
            Display display = windows[0].getShell().getDisplay();
            display.asyncExec(runnable);
        } else {
            runnable.run();
        }
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Display(org.eclipse.swt.widgets.Display)

Example 38 with IWorkbench

use of org.eclipse.ui.IWorkbench in project eclipse.platform.text by eclipse.

the class UntitledTextFileWizard method getEditorId.

private String getEditorId(IFileStore fileStore) {
    IWorkbench workbench = fWindow.getWorkbench();
    IEditorRegistry editorRegistry = workbench.getEditorRegistry();
    IEditorDescriptor descriptor = editorRegistry.getDefaultEditor(fileStore.getName());
    if (descriptor != null)
        return descriptor.getId();
    return EditorsUI.DEFAULT_TEXT_EDITOR_ID;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IEditorRegistry(org.eclipse.ui.IEditorRegistry)

Example 39 with IWorkbench

use of org.eclipse.ui.IWorkbench in project Palladio-Editors-Sirius by PalladioSimulator.

the class ModelCreation method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell activeShell = HandlerUtil.getActiveShell(event);
    NewModelWizard wizard = getModelCreationWizard();
    IWorkbench workbench = PlatformUI.getWorkbench();
    IStructuredSelection selection = (IStructuredSelection) workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
    wizard.init(workbench, selection);
    WizardDialog dialog = new WizardDialog(activeShell, wizard);
    dialog.open();
    return null;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) NewModelWizard(org.palladiosimulator.editors.sirius.ui.wizard.model.NewModelWizard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Example 40 with IWorkbench

use of org.eclipse.ui.IWorkbench in project Palladio-Editors-Sirius by PalladioSimulator.

the class PalladioProjectCreation method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell activeShell = HandlerUtil.getActiveShell(event);
    NewPalladioProjectWizard wizard = new NewPalladioProjectWizard();
    IWorkbench workbench = PlatformUI.getWorkbench();
    IStructuredSelection selection = (IStructuredSelection) workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
    wizard.init(workbench, selection);
    WizardDialog dialog = new WizardDialog(activeShell, wizard);
    dialog.open();
    return null;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Shell(org.eclipse.swt.widgets.Shell) NewPalladioProjectWizard(org.palladiosimulator.editors.sirius.ui.wizard.project.NewPalladioProjectWizard) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) WizardDialog(org.eclipse.jface.wizard.WizardDialog)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)105 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)32 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)31 IEditorPart (org.eclipse.ui.IEditorPart)21 PartInitException (org.eclipse.ui.PartInitException)20 WizardDialog (org.eclipse.jface.wizard.WizardDialog)15 CoreException (org.eclipse.core.runtime.CoreException)12 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)12 Shell (org.eclipse.swt.widgets.Shell)11 IResource (org.eclipse.core.resources.IResource)9 ISelection (org.eclipse.jface.viewers.ISelection)9 Display (org.eclipse.swt.widgets.Display)8 ArrayList (java.util.ArrayList)7 IFile (org.eclipse.core.resources.IFile)7 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)7 IProject (org.eclipse.core.resources.IProject)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 TableEditorInput (com.cubrid.common.ui.cubrid.table.editor.TableEditorInput)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)5