private void disconnectReferencedElementsFromPerspectiveWidgets( MElementContainer<? extends MUIElement> container) { for (MUIElement e : container.getChildren()) { if (e instanceof MPlaceholder) { MPlaceholder ph = (MPlaceholder) e; if (ph.isToBeRendered()) { ComponentContainer phComponent = (ComponentContainer) ph.getWidget(); Component refComponent = (Component) ph.getRef().getWidget(); phComponent.removeComponent(refComponent); } } } }
@Override public boolean isPartOrPlaceholderInPerspective(String elementId, MPerspective perspective) { List<MPart> findElements = modelService.findElements(perspective, elementId, MPart.class, null); if (!findElements.isEmpty()) { MPart part = findElements.get(0); // if that is a shared part, check the placeholders if (workbenchWindow.getSharedElements().contains(part)) { List<MPlaceholder> placeholders = modelService.findElements(perspective, elementId, MPlaceholder.class, null); for (MPlaceholder mPlaceholder : placeholders) { if (mPlaceholder.isVisible() && mPlaceholder.isToBeRendered()) { return true; } } return false; } // not a shared part return part.isVisible() && part.isToBeRendered(); } return false; }