private void cleanUp(MWindow window) { MUIElement parent = modelService.getContainer(window); if (parent instanceof MApplication) { MApplication application = (MApplication) parent; List<MWindow> children = application.getChildren(); if (children.size() > 1) { // not the last window, destroy and remove window.setToBeRendered(false); children.remove(window); } else { // last window, just destroy without changing the model engine.removeGui(window); } } else if (parent != null) { window.setToBeRendered(false); // this is a detached window, check for parts if (modelService.findElements(window, null, MPart.class) .isEmpty()) { // if no parts, remove it if (parent instanceof MWindow) { ((MWindow) parent).getWindows().remove(window); } else if (parent instanceof MPerspective) { ((MPerspective) parent).getWindows().remove(window); } } } }
private void cleanUp(MWindow window) { Object parent = ((EObject) window).eContainer(); if (parent instanceof MApplication) { MApplication application = (MApplication) parent; List<MWindow> children = application.getChildren(); if (children.size() > 1) { // not the last window, destroy and remove window.setToBeRendered(false); children.remove(window); } else { // last window, just destroy without changing the model engine.removeGui(window); } } else if (parent != null) { window.setToBeRendered(false); // this is a detached window, check for parts if (modelService.findElements(window, null, MPart.class, null) .isEmpty()) { // if no parts, remove it if (parent instanceof MWindow) { ((MWindow) parent).getWindows().remove(window); } else if (parent instanceof MPerspective) { ((MPerspective) parent).getWindows().remove(window); } } } }
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); } };
@Inject @Optional private void subscribeTopicSelectedElementChanged( @UIEventTopic(UIEvents.ElementContainer.TOPIC_SELECTEDELEMENT) 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); }
detachedWindow.setToBeRendered(false); persp.getWindows().remove(detachedWindow);