@Override protected final void updateLayout(UmlChangeEvent mee) { super.updateLayout(mee); if (mee instanceof AttributeChangeEvent && mee.getPropertyName().equals("body")) { bodyTextFig.setText(mee.getNewValue().toString()); calcBounds(); setBounds(getBounds()); damage(); } else if (mee instanceof RemoveAssociationEvent && mee.getPropertyName().equals("annotatedElement")) { /* Remove the commentedge. * If there are more then one comment-edges between * the 2 objects, then delete them all. */ Collection<FigEdgeNote> toRemove = new ArrayList<FigEdgeNote>(); Collection c = getFigEdges(); // all connected edges for (Iterator i = c.iterator(); i.hasNext(); ) { FigEdgeNote fen = (FigEdgeNote) i.next(); Object otherEnd = fen.getDestination(); // the UML object if (otherEnd == getOwner()) { // wrong end of the edge otherEnd = fen.getSource(); } if (otherEnd == mee.getOldValue()) { toRemove.add(fen); } } for (FigEdgeNote fen : toRemove) { fen.removeFromDiagram(); } } }