/** * Refreshes the label of the figure associated to the specified edit part * * @param editPart the edit part managing the refreshed figure */ public void refreshEditPartDisplay(GraphicalEditPart editPart) { IFigure figure = editPart.getFigure(); // computes the icon to be displayed final Collection<Image> imageToDisplay = stereotypeIconsToDisplay(editPart); // should check if edit part has to display the element icon or not if (AppearanceHelper.showElementIcon((View) editPart.getModel())) { imageToDisplay.add(getImage(editPart)); } // for each element in the list of stereotype icon, adds it to the icons // list of the // wrapping label // problem (RS - CEA LIST): more icons were displayed before refresh: // has to clean // problem 2 (RS - CEA LIST): no method to know how many icons were // displayed => should fix // a max number ?! // solution: set all images to null, and then add the correct icons int i = 0; if (figure instanceof WrappingLabel) { while (((WrappingLabel) figure).getIcon(i) != null) { ((WrappingLabel) figure).setIcon(null, i); i++; } i = 0; for (Image image : imageToDisplay) { ((WrappingLabel) figure).setIcon(image, i); i++; } ((WrappingLabel) figure).setText(labelToDisplay(editPart)); } }
/** @generated */ protected Image getLabelIcon() { EObject parserElement = getParserElement(); if (parserElement == null) { return null; } List<View> views = DiagramEditPartsUtil.findViews(parserElement, getViewer()); for (View view : views) { if (AppearanceHelper.showElementIcon(view)) { return UMLElementTypes.getImage(parserElement.eClass()); } } return null; }