org.eclipse.ui.internal.WorkbenchWindow Java Examples
The following examples show how to use
org.eclipse.ui.internal.WorkbenchWindow.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ActiveDocument.java From eclipse-encoding-plugin with Eclipse Public License 1.0 | 6 votes |
private void setMessage(String imageIconKey, String message, Object... args) { IStatusLineManager statusLineManager = null; if (editor == null) { WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); statusLineManager = window.getActionBars().getStatusLineManager(); } else { statusLineManager = editor.getEditorSite().getActionBars().getStatusLineManager(); } if (statusLineManager != null) { if (message == null) { statusLineManager.setMessage(null); } else { statusLineManager.setMessage(Activator.getImage(imageIconKey), format(message, args)); } } }
Example #2
Source File: GamlReferenceSearch.java From gama with GNU General Public License v3.0 | 6 votes |
public static void install() { WorkbenchHelper.runInUI("Install GAML Search", 0, m -> { final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window instanceof WorkbenchWindow) { final MTrimBar topTrim = ((WorkbenchWindow) window).getTopTrim(); for (final MTrimElement element : topTrim.getChildren()) { if ("SearchField".equals(element.getElementId())) { final Composite parent = ((Control) element.getWidget()).getParent(); final Control old = (Control) element.getWidget(); WorkbenchHelper.runInUI("Disposing old search control", 500, m2 -> old.dispose()); element.setWidget(GamlSearchField.installOn(parent)); parent.layout(true, true); parent.update(); break; } } } }); }
Example #3
Source File: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public static void setCoolBarVisibility(boolean visible) { IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow(); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow workbenchWindow = (WorkbenchWindow) activeWorkbenchWindow; workbenchWindow.setCoolBarVisible(visible); workbenchWindow.setPerspectiveBarVisible(visible); // Try to force a refresh of the text on the action IWorkbenchPart activePart = getActivePart(); if (activePart != null) { ICommandService cmdService = (ICommandService) activePart.getSite().getService(ICommandService.class); cmdService.refreshElements("org.eclipse.ui.ToggleCoolbarAction", null); //$NON-NLS-1$ } } }
Example #4
Source File: MendeleyOverlayDecorator.java From slr-toolkit with Eclipse Public License 1.0 | 6 votes |
/** * THis method sets the main menu contribution 'Mendeley' to visible */ private void updateMenuContribution() { if(window instanceof WorkbenchWindow) { MenuManager menuManager = ((WorkbenchWindow)window).getMenuManager(); //you'll need to find the id for the item String mainMenuId = "de.tudresden.slr.model.mendeley.menus.mainMenu"; IContributionItem item = menuManager.find(mainMenuId); item.update(); if (item != null) { // clean old one item.setVisible(true); // refresh menu gui menuManager.update(); } } }
Example #5
Source File: SmallCoolBarHandler.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { MWindow model = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel(); EModelService modelService = model.getContext().get(EModelService.class); MToolControl bonitaCoolBar = (MToolControl) modelService.find( "BonitaCoolbar", model); if(bonitaCoolBar != null){ CoolbarToolControl coolbarControl = (CoolbarToolControl) bonitaCoolBar.getObject(); coolbarControl.minimizeCoolbar(); } return null; }
Example #6
Source File: BrowseKillRingHandler.java From e4macs with Eclipse Public License 1.0 | 5 votes |
/** * Insert text from kill ring entry into the most recently activated text editor * * @param text - the text from the kill ring entry */ // @SuppressWarnings("restriction") // for cast to internal org.eclipse.ui.internal.WorkbenchWindow private void insertFromBrowseRing(String text) { // insert into most recently active editor IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); RecentEditor recent = getRecentEditor(); // use widget to avoid unpleasant scrolling side effects of IRewriteTarget Control widget = MarkUtils.getTextWidget(recent.editor); if (recent.editor != null) { try { // cache for ancillary computations setThisEditor(recent.editor); // reduce the amount of unnecessary work if (window instanceof WorkbenchWindow) { ((WorkbenchWindow) window).largeUpdateStart(); } widget.setRedraw(false); recent.page.activate(recent.epart); insertText(recent.editor.getDocumentProvider().getDocument(recent.editor.getEditorInput()), (ITextSelection)recent.editor.getSelectionProvider().getSelection(), text); } catch (Exception e) { } finally { widget.setRedraw(true); setThisEditor(null); if (window instanceof WorkbenchWindow) { ((WorkbenchWindow) window).largeUpdateEnd(); } } } else { beep(); } }
Example #7
Source File: DummyEditorSite.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public Shell getShell() { // Compatibility: This method should not be used outside the UI // thread... but since this condition // was not always in the JavaDoc, we still try to return our best guess // about the shell if it is // called from the wrong thread. final Display currentDisplay = Display.getCurrent(); if (currentDisplay == null) { // Uncomment this to locate places that try to access the shell from // a background thread // WorkbenchPlugin.log(new Exception("Error: // IWorkbenchSite.getShell() was called outside the UI thread. Fix // this code.")); //$NON-NLS-1$ final IWorkbenchWindow workbenchWindow = getWorkbenchWindow(); if (workbenchWindow != null) { return workbenchWindow.getShell(); } return null; } IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); MWindow window = null; if (activeWorkbenchWindow != null) { window = ((WorkbenchWindow) activeWorkbenchWindow).getModel(); final Control control = (Control) window.getWidget(); if (control != null && !control.isDisposed()) { return control.getShell(); } } // likely means the part has been destroyed, return the parent window's // shell, we don't just arbitrarily return the workbench window's shell // because we may be in a detached window return window == null ? getWorkbenchWindow().getShell() : (Shell) window.getWidget(); }
Example #8
Source File: PluginConfigManage.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("restriction") public PluginConfigManage() { pluginXmlLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation() .append(PluginConstants.PC_pluginConfigLocation).toOSString(); WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); parentManager = window.getMenuBarManager(); shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); }
Example #9
Source File: OpenToolBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("rawtypes") public void updateElement(final UIElement element, Map parameters) { Display.getDefault().asyncExec(new Runnable() { public void run() { final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; boolean coolbarVisible = window.getCoolBarVisible(); element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator .getImageDescriptor("icons/disabled_co.png")); } } }); }
Example #10
Source File: OpenToolBarHandler.java From tmxeditor8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; window.toggleToolbarVisibility(); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example #11
Source File: PluginConfigManage.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("restriction") public PluginConfigManage() { pluginXmlLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation() .append(PluginConstants.PC_pluginConfigLocation).toOSString(); WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); parentManager = window.getMenuBarManager(); shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); }
Example #12
Source File: OpenToolBarHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
@SuppressWarnings("rawtypes") public void updateElement(final UIElement element, Map parameters) { Display.getDefault().asyncExec(new Runnable() { public void run() { final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; boolean coolbarVisible = window.getCoolBarVisible(); element.setIcon(coolbarVisible ? Activator.getImageDescriptor("icons/enabled_co.png") : Activator .getImageDescriptor("icons/disabled_co.png")); } } }); }
Example #13
Source File: OpenToolBarHandler.java From translationstudio8 with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event); if (activeWorkbenchWindow instanceof WorkbenchWindow) { WorkbenchWindow window = (WorkbenchWindow) activeWorkbenchWindow; window.toggleToolbarVisibility(); } ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class); commandService.refreshElements(event.getCommand().getId(), null); return null; }
Example #14
Source File: UIUtils.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public static boolean getCoolBarVisibility() { IWorkbench workbench = PlatformUI.getWorkbench(); if (workbench != null) { IWorkbenchWindow activeWorkbenchWindow = getActiveWorkbenchWindow(); if (activeWorkbenchWindow instanceof WorkbenchWindow) { return ((WorkbenchWindow) activeWorkbenchWindow).getCoolBarVisible(); } } return true; }
Example #15
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public static void showBottomTray(final WorkbenchWindow window, final Boolean show) { final MUIElement trimStatus = getTrimStatus(window); if ( trimStatus != null ) { // toggle statusbar visibility trimStatus.setVisible(show); } }
Example #16
Source File: NormalCoolBarHandler.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
public Object execute(ExecutionEvent event) throws ExecutionException { MWindow model = ((WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()).getModel(); EModelService modelService = model.getContext().get(EModelService.class); MToolControl bonitaCoolBar = (MToolControl) modelService.find( "BonitaCoolbar", model); if(bonitaCoolBar != null){ CoolbarToolControl coolbarControl = (CoolbarToolControl) bonitaCoolBar.getObject(); coolbarControl.maximizeCoolbar(); } return null; }
Example #17
Source File: EmbeddedEditorSite.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
protected static MWindow getMWindow() { Workbench workbench = (Workbench) PlatformUI.getWorkbench(); WorkbenchWindow activeWorkbenchWindow = (WorkbenchWindow) workbench.getActiveWorkbenchWindow(); return activeWorkbenchWindow.getModel(); }
Example #18
Source File: PluginConfigManage.java From translationstudio8 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("restriction") public PluginConfigManage(String pluginXmlLocation) { this.pluginXmlLocation = pluginXmlLocation; WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); parentManager = window.getMenuBarManager(); }
Example #19
Source File: AbstractEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); context = ((WorkbenchWindow) getEditorSite().getWorkbenchWindow()).getModel().getContext(); ResourcesPlugin.getWorkspace().addResourceChangeListener(this); }
Example #20
Source File: AbstractMultiSourceFormEditor.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void init(IEditorSite site, IEditorInput input) throws PartInitException { super.init(site, input); eclipseContext = ((WorkbenchWindow) getEditorSite().getWorkbenchWindow()).getModel().getContext(); editorContributions = createEditorContributions(); }
Example #21
Source File: PluginConfigManage.java From tmxeditor8 with GNU General Public License v2.0 | 4 votes |
@SuppressWarnings("restriction") public PluginConfigManage(String pluginXmlLocation) { this.pluginXmlLocation = pluginXmlLocation; WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow(); parentManager = window.getMenuBarManager(); }
Example #22
Source File: WorkbenchUtils.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
public static void refreshMainMenu() { IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); WorkbenchWindow ww = (WorkbenchWindow)w; IMenuService service = (IMenuService)w.getService(IMenuService.class); service.populateContributionManager((ContributionManager)ww.getActionBars().getMenuManager(), MenuUtil.MAIN_MENU); }
Example #23
Source File: PerspectiveHelper.java From gama with GNU General Public License v3.0 | 4 votes |
private static MUIElement getTrimStatus(final WorkbenchWindow window) { final EModelService modelService = window.getService(EModelService.class); final MUIElement searchRoot = window.getModel(); return modelService.find(BOTTOM_TRIM_ID, searchRoot); }
Example #24
Source File: WorkbenchUtils.java From xds-ide with Eclipse Public License 1.0 | 4 votes |
public static IMenuManager getWorkbenchMenuManager() { IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); WorkbenchWindow ww = (WorkbenchWindow)w; return ww.getActionBars().getMenuManager(); }