/** * 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 void setLabelIconHelper(IFigure figure, Image icon) { if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setIcon(icon); } else { ((Label) figure).setIcon(icon); } }
/** @generated */ protected void setLabelIconHelper(IFigure figure, Image icon) { if (figure instanceof WrappingLabel) { ((WrappingLabel) figure).setIcon(icon); return; } else if (figure instanceof Label) { ((Label) figure).setIcon(icon); return; } else { getLabelDelegate().setIcon(icon, 0); } }