private MWindow getWindow() { if (workbenchWindow != null) return workbenchWindow; if (application.getSelectedElement() != null) return application.getSelectedElement(); List<MWindow> windows = application.getChildren(); if (windows.size() != 0) return windows.get(0); return null; }
private boolean shouldActivate(@NonNull MPartStack stackToActivate) { if (inContentProcessing(stackToActivate)) { return false; } if (this.application != null) { IEclipseContext applicationContext = this.application.getContext(); IEclipseContext activeChild = applicationContext.getActiveChild(); if (activeChild == null || activeChild.get(MWindow.class) != this.application.getSelectedElement() || this.application.getSelectedElement() != this.modelService.getTopLevelWindowFor(stackToActivate)) { return false; } } return true; }
private SelectionAggregator getServiceAggregator() { SelectionAggregator aggregator = context.get(SelectionAggregator.class); if (aggregator != null) return aggregator; MApplication app = context.get(MApplication.class); if (app == null) return null; MWindow selectedWindow = app.getSelectedElement(); IEclipseContext windowContext = selectedWindow.getContext(); if (windowContext == null) return null; return windowContext.get(SelectionAggregator.class); } }
@Override public void run() { if (isClosing || force) { E4Util.unsupported("Need to close since no windowManager"); //$NON-NLS-1$ MWindow selectedWindow = application.getSelectedElement(); WorkbenchWindow selected = null; for (IWorkbenchWindow window : getWorkbenchWindows()) { WorkbenchWindow ww = (WorkbenchWindow) window; if (ww.getModel() == selectedWindow) { selected = ww; } else { ((WorkbenchWindow) window).close(false); } } if (selected != null) { selected.close(false); } windowsClosed = true; } } });
/** * Get the active non modal shell. If there isn't one return null. * * @return Shell */ public static Shell getNonModalShell() { MApplication application = PlatformUI.getWorkbench().getService(MApplication.class); if (application == null) { // better safe than sorry return null; } MWindow window = application.getSelectedElement(); if (window != null) { Object widget = window.getWidget(); if (widget instanceof Shell) { return (Shell) widget; } } for (MWindow child : application.getChildren()) { Object widget = child.getWidget(); if (widget instanceof Shell) { return (Shell) widget; } } return null; }
MWindow activeWindow = application.getSelectedElement(); if ((activeWindow == null || activeWindow.getWidget() == null) && !application.getChildren().isEmpty()) { activeWindow = application.getChildren().get(0);
if (application.getSelectedElement() == window) { application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_NAME, result); application.getContext().set(ISources.ACTIVE_WORKBENCH_WINDOW_SHELL_NAME, result.getShell());
@Override public Object run(MApplicationElement uiRoot, IEclipseContext appContext) { this.app = (MApplication) uiRoot; MWindow selected = this.app.getSelectedElement(); if (selected == null) { for (MWindow window : this.app.getChildren()) {