public DragHost(Shell shell) { dragWindow = (MWindow) shell.getData(AbstractPartRenderer.OWNING_ME); baseWindow = (MWindow) shell.getParent().getData( AbstractPartRenderer.OWNING_ME); dragElement = dragWindow.getChildren().get(0); }
public EModelService getModelService() { return dragWindow.getContext().get(EModelService.class); }
private void attach() { dragElement.getParent().getChildren().remove(dragElement); ((Shell) baseWindow.getWidget()).getDisplay().update(); dragWindow = MBasicFactory.INSTANCE.createWindow(); dragWindow.getTags().add(DragHostId); // define the initial location and size for the window Point cp = ((Shell) baseWindow.getWidget()).getDisplay() .getCursorLocation(); Point size = new Point(200, 200); if (dragElement.getWidget() instanceof Control) { Control ctrl = (Control) dragElement.getWidget(); size = ctrl.getSize(); } else if (dragElement.getWidget() instanceof ToolItem) { ToolItem ti = (ToolItem) dragElement.getWidget(); Rectangle bounds = ti.getBounds(); size = new Point(bounds.width + 3, bounds.height + 3); } dragWindow.setX(cp.x + xOffset); dragWindow.setY(cp.y + yOffset); dragWindow.setWidth(size.x); dragWindow.setHeight(size.y); // add the window as a child of the base window baseWindow.getWindows().add(dragWindow); getShell().layout(getShell().getChildren(), SWT.CHANGED | SWT.DEFER); getShell().setVisible(true); }
@Override public void run() { boundsJob = null; while (!windowsToUpdate.isEmpty()) { MWindow window = windowsToUpdate.remove(0); Shell shell = (Shell) window.getWidget(); if (shell == null || shell.isDisposed()) { continue; } shell.setBounds(window.getX(), window.getY(), window.getWidth(), window.getHeight()); } } }
@Override public void hostElement(MUIElement element, MWindow hostWindow, Object uiContainer, IEclipseContext hostContext) { // This is subtle; unless the element is hooked into the model it won't fire events hostWindow.getSharedElements().add(element); element.getTags().add(HOSTED_ELEMENT); IPresentationEngine renderer = hostWindow.getContext().get(IPresentationEngine.class); renderer.createGui(element, uiContainer, hostContext); }
public DnDInfo(MWindow topWin) { topLevelWindow = topWin; display = ((Control) (topWin.getWidget())).getDisplay(); modelService = topWin.getContext().get(EModelService.class); update(); }
window.setX(bounds.x); window.setY(bounds.y); window.setWidth(bounds.width); window.setHeight(bounds.height); window.getTags().add("topLevel"); //$NON-NLS-1$ coolbarVisible = Boolean.FALSE.toString(); window.getPersistedState().put(IPreferenceConstants.COOLBAR_VISIBLE, coolbarVisible); window.getPersistedState().put(IPreferenceConstants.PERSPECTIVEBAR_VISIBLE, coolbarVisible); List<String> tags = window.getTags(); if (windowReader.isMinimized()) { tags.add(IPresentationEngine.WINDOW_MINIMIZED_TAG); tags.add(IPresentationEngine.WINDOW_MAXIMIZED_TAG); sharedElements = window.getSharedElements();
MApplication appModel = wbwModel.getContext().get(MApplication.class); Boolean rtlMode = (Boolean) appModel.getTransientData().get( E4Workbench.RTL_MODE); wbwShell = new Shell(Display.getCurrent(), SWT.SHELL_TRIM | rtlStyle); wbwModel.getTags().add("topLevel"); //$NON-NLS-1$ } else if (wbwModel.getTags().contains("dragHost")) { //$NON-NLS-1$ wbwShell = new Shell(parentShell, SWT.BORDER | rtlStyle); wbwShell.setAlpha(110); modelBounds.x = wbwModel.getX(); modelBounds.y = wbwModel.getY(); modelBounds.height = wbwModel.getHeight(); modelBounds.width = wbwModel.getWidth(); localContext.set(ISaveHandler.class, saveHandler); if (wbwModel.getLabel() != null) wbwShell.setText(wbwModel.getLocalizedLabel()); if (wbwModel.getIconURI() != null && wbwModel.getIconURI().length() > 0) { wbwShell.setImage(getImage(wbwModel)); } else {
if (wbwModel.getMainMenu() != null) { renderer.createGui(wbwModel.getMainMenu(), me.getWidget(), null); Shell shell = (Shell) me.getWidget(); shell.setMenuBar((Menu) wbwModel.getMainMenu().getWidget()); for (MWindow dw : wbwModel.getWindows()) { renderer.createGui(dw, me.getWidget(), wbwModel.getContext()); Shell shell = (Shell) wbwModel.getWidget(); MTrimmedWindow tWindow = (MTrimmedWindow) wbwModel; for (MTrimBar trimBar : tWindow.getTrimBars()) { renderer.createGui(trimBar, shell, wbwModel.getContext());
element.getContext().set(nativeWidget.getClass().getName(), nativeWidget); if (element.getMainMenu() != null) { WLayoutedWidget<MMenu> menuWidget = engineCreateWidget(element.getMainMenu()); if (menuWidget != null) { windowWidget.setMainMenu(menuWidget); for (MWindowElement e : element.getChildren()) { WLayoutedWidget<MWindowElement> widget = engineCreateWidget(e); if (widget != null && isChildRenderedAndVisible(e)) { for (MWindow w : element.getWindows()) { WWindow<MWindow> widget = engineCreateWidget(w); if (widget != null && isChildRenderedAndVisible(w)) { String maxElementId = element.getPersistedState().get("MAXIMIZED"); //$NON-NLS-1$ if(maxElementId != null) { MUIElement maxElement = this.modelService.find(maxElementId, element); if(maxElement != null) { MaximizationService maxService = ((MWindow) element).getContext().get(MaximizationService.class); if(maxService != null) { maxService.maximize(maxElement);
public void handleEvent(org.eclipse.swt.widgets.Event event) { MUIElement parentME = w.getParent(); if (parentME instanceof MApplication) { MApplication app = (MApplication) parentME; app.setSelectedElement(w); w.getContext().activate(); } else if (parentME == null) { parentME = (MUIElement) ((EObject) w).eContainer(); if (parentME instanceof MContext) { w.getContext().activate(); } } } });
public void handleEvent(Event event) { // Ensure that this event is for a MApplication if (!(event.getProperty(UIEvents.EventTags.ELEMENT) instanceof MApplication)) return; MWindow win = (MWindow) event .getProperty(UIEvents.EventTags.NEW_VALUE); if ((win == null) || !win.getTags().contains("topLevel")) //$NON-NLS-1$ return; win.setToBeRendered(true); if (!(win.getRenderer() == WBWRenderer.this)) return; Shell shell = (Shell) win.getWidget(); if (shell.getMinimized()) { shell.setMinimized(false); } shell.setActive(); shell.moveAbove(null); } };
for (MUIElement kid : ((MWindow) element).getChildren()) { if (isWindowChildRendered(kid)) { visCount++; for (MWindow w : ((MWindow) element).getWindows()) { showElementRecursive(w);
if (windowModel.getRenderer() != WBWRenderer.this) { return; Shell theShell = (Shell) windowModel.getWidget(); if (theShell == null) { return; theShell.setImage(getImage(windowModel)); for (MWindow child : windowModel.getWindows()) { if (child.getRenderer() instanceof WBWRenderer) { ((WBWRenderer) child.getRenderer()).handleParentChange(child);
IWorkbenchWindow createWorkbenchWindow(IAdaptable input, IPerspectiveDescriptor descriptor, MWindow window, boolean newWindow) { IEclipseContext windowContext = window.getContext(); if (windowContext == null) { windowContext = E4Workbench.initializeContext(e4Context, window); window.setWidth(size.x); window.setHeight(size.y); application.getChildren().add(window); application.setSelectedElement(window);
Assert.isLegal(refParent instanceof MApplication); for (MUIElement se : sharedElements) { if (ph.getElementId().equals(se.getElementId())) { ph.setRef(se); ph.setRef(sharedArea); return; MPart newReferencedPart = ps.createPart(ph.getElementId()); if (newReferencedPart != null) { refWin.getSharedElements().add(newReferencedPart); ph.setRef(newReferencedPart); return;
@Override public void detach(MPartSashContainerElement element, int x, int y, int width, int height) { // If we're showing through a placehoilder then detach it... if (element.getCurSharedRef() != null) { element = element.getCurSharedRef(); } // Determine the correct parent for the new window MWindow window = getTopLevelWindowFor(element); MPerspective thePersp = getPerspectiveFor(element); MTrimmedWindow newWindow = MBasicFactory.INSTANCE.createTrimmedWindow(); newWindow.setX(x); newWindow.setY(y); newWindow.setWidth(width); newWindow.setHeight(height); element.getParent().getChildren().remove(element); MWindowElement uiRoot = wrapElementForWindow(element); newWindow.getChildren().add(uiRoot); if (thePersp != null) { thePersp.getWindows().add(newWindow); } else if (window != null) { window.getWindows().add(newWindow); } }
public void handleEvent(Event event) { // Ensure that this event is for a MMenuItem Object objElement = event .getProperty(UIEvents.EventTags.ELEMENT); if (!(objElement instanceof MWindow)) return; // Is this listener interested ? MWindow windowModel = (MWindow) objElement; if (windowModel.getRenderer() != WBWRenderer.this) return; // No widget == nothing to update Shell theShell = (Shell) windowModel.getWidget(); if (theShell == null) return; String attName = (String) event .getProperty(UIEvents.EventTags.ATTNAME); if (UIEvents.UIElement.VISIBLE.equals(attName)) { boolean isVisible = (Boolean) event .getProperty(UIEvents.EventTags.NEW_VALUE); theShell.setVisible(isVisible); } } };
for (MWindow dw : window.getWindows()) { findElementsRecursive(dw, clazz, matcher, elements, searchFlags); MMenu menu = window.getMainMenu(); if (menu != null && (searchFlags & IN_MAIN_MENU) != 0) { findElementsRecursive(menu, clazz, matcher, elements, searchFlags); for (MHandler child : window.getHandlers()) { findElementsRecursive(child, clazz, matcher, elements, searchFlags);