Topic
  • No replies
Christian42
Christian42
1 Post

Pinned topic Problems with Decorators

‏2009-11-18T16:39:16Z |
Hello

I almost get insane as I cannot solve a problem with decorators. My goal is to mark specific elements in UML Diagrams. Therefore I catch the EMF Objects and give them attachements. Furthermore
on each Element that can be marked Decorators are attached. When I add an annotation to an element the specific decorator is informed through listener and should draw the figure red

here is the refresh code of the decorator:




public 

void refresh() 
{ IGraphicalEditPart editPart = (IGraphicalEditPart) getDecoratorTarget().getAdapter(IGraphicalEditPart.class); 

if (editPart 

instanceof IPrimaryEditPart) 
{   IFigure figure = editPart.getFigure(); figure.setForegroundColor(ColorConstants.lightGray); 

if (isAnnotated((Element) editPart.resolveSemanticElement())) figure.setForegroundColor(ColorConstants.red); 
} 
} 
}


I followed the code till figure.setForegroundColor(ColorConstants.red); and it is every time called. But the strange thing is that only some elements are drawed red and if I manually refresh
the views by closing and opening the editor some of the red figure gets their old color back. Other ones which are attached gains the red color. By the way the attachements always exist regardless of the color. I dont know what I am doing wrong :(

Thanks for help
Greetings