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);
}
}
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();
}
}
}
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;
}
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;
}
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;
}
Aggregations