MPartDescriptor findDescriptor(String id) { return modelService.getPartDescriptor(id); }
@Override public MPart createPart(String id) { MPartDescriptor descriptor = modelService.getPartDescriptor(id); return createPart(descriptor); }
@Override public MPart showPart(String id, PartState partState) { Assert.isNotNull(id); Assert.isNotNull(partState); MPart part = findPart(id); if (part == null) { MPartDescriptor descriptor = modelService.getPartDescriptor(id); part = createPart(descriptor); if (part == null) { return null; } } return showPart(part, partState); }
MPlaceholder createPlaceHolder(String str, String label) { MPlaceholder placeholder = null; placeholder = modelService.createModelElement(MPlaceholder.class); placeholder.setElementId(str); if (modelService.getPartDescriptor(str) == null) { placeholder.getTransientData().put(IWorkbenchConstants.TAG_LABEL, label); } return placeholder; }
private String getIconURI(MUILabel element) { if (element instanceof MPart) { MPart part = (MPart) element; String iconURI = (String) part.getTransientData().get( ICON_URI_FOR_PART); if (iconURI != null) { return iconURI; } MPartDescriptor desc = modelService.getPartDescriptor(part .getElementId()); iconURI = desc != null && desc.getIconURI() != null ? desc .getIconURI() : element.getIconURI(); part.getTransientData().put(ICON_URI_FOR_PART, iconURI); return iconURI; } return element.getIconURI(); }
@Override public MPlaceholder createSharedPart(String id, boolean force) { MWindow sharedWindow = getWindow(); // Do we already have the part to share? MPart sharedPart = null; // check for existing parts if necessary if (!force) { for (MUIElement element : sharedWindow.getSharedElements()) { if (element.getElementId().equals(id)) { sharedPart = (MPart) element; break; } } } if (sharedPart == null) { MPartDescriptor descriptor = modelService.getPartDescriptor(id); sharedPart = createPart(descriptor); if (sharedPart == null) { return null; } // Replace the id to ensure that multi-instance parts work correctly sharedPart.setElementId(id); sharedWindow.getSharedElements().add(sharedPart); } return createSharedPart(sharedPart); }
public static MStackElement createViewModel(MApplication application, String id, boolean visible, WorkbenchPage page, EPartService partService, boolean createReferences) { EModelService ms = application.getContext().get(EModelService.class); MPartDescriptor partDesc = ms.getPartDescriptor(id); if (partDesc != null) { MPlaceholder ph = partService.createSharedPart(id); ph.setToBeRendered(visible); MPart part = (MPart) (ph.getRef()); // as a shared part, this should be true, actual un/rendering // will be dependent on any placeholders that are referencing // this part part.setToBeRendered(true); // there should only be view references for 3.x views that are // visible to the end user, that is, the tab items are being // drawn if (visible && createReferences && CompatibilityPart.COMPATIBILITY_VIEW_URI.equals(partDesc .getContributionURI())) { page.createViewReferenceForPart(part, id); } return ph; } return null; }
MPartDescriptor descriptor = modelService.getPartDescriptor(providedPart.getElementId()); if (descriptor == null) {