private void addDetachedWindows() { for (DetachedWindowReader detachedWindowReader : perspReader.getDetachedWindows()) { MTrimmedWindow detachedWindow = modelService.createModelElement(MTrimmedWindow.class); Rectangle bounds = detachedWindowReader.getBounds(); detachedWindow.setX(bounds.x); detachedWindow.setY(bounds.y); detachedWindow.setWidth(bounds.width); detachedWindow.setHeight(bounds.height); MPartStack stack = modelService.createModelElement(MPartStack.class); populatePartStack(stack, detachedWindowReader); detachedWindow.getChildren().add(stack); perspective.getWindows().add(detachedWindow); } }
@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); } }