/** * {@inheritDoc} * * @see org.eclipse.jface.viewers.ColumnLabelProvider#getImage(java.lang.Object) */ @Override public Image getImage(Object element) { Image result = null; if (columnIndex == 0 && diagramPart != null) { final DiagramEditPart diaEditPart = diagramPart.getDiagramEditPart(); final Object obj = diaEditPart.getModel(); if (obj instanceof View) { final EObject designerElement = ((View) obj).getElement(); if (designerElement instanceof DDiagram) { final List<Layer> activatedLayers = ((DDiagram) designerElement).getActivatedLayers(); Image img = null; if (EqualityHelper.contains(activatedLayers, (EObject) element)) { img = DiagramUIPlugin.getPlugin().getBundledImage(DiagramImagesPath.ACTIVE_LAYER_ICON); } else { img = DiagramUIPlugin.getPlugin().getBundledImage(DiagramImagesPath.INACTIVE_LAYER_ICON); } result = img; } } } else if (columnIndex == 1) { if (element instanceof Layer) { Layer layer = (Layer) element; if (!StringUtil.isEmpty(layer.getIcon())) { result = ImageProvider.getImageFromPath(layer.getIcon()); } } } return result; }
private void computeMappings(final DDiagram diagram, final Layer layer) { final DiagramMappingsManager manager = diagramMappingsManagers.get(diagram); if (manager != null) { boolean needToRecomputeDescMappings = false; if (layer != null && layer.eContainer() instanceof DiagramExtensionDescription) { needToRecomputeDescMappings = true; } Session sess = SessionManager.INSTANCE.getSession(((DSemanticDiagram) diagram).getTarget()); if (sess != null) { manager.computeMappings(sess.getSelectedViewpoints(false), needToRecomputeDescMappings); } else { manager.computeMappings(null, needToRecomputeDescMappings); } } }