Problem with filtering elements from diagram and deleting the connections. [message #142577] |
Fri, 13 July 2007 08:18 |
Eclipse User |
|
|
|
Originally posted by: marcio.debarros.gmail.com
Hi,
I am creating a filter to a diagram view in which, based on the value of one
of its attributes a node can be shown or not in the diagram.
I managed to get the nodes to be removed from the diagram by overiding the
getModelChildren() method of the EditPart with the following code:
protected List getModelChildren() {
removedFortresses = new Vector<String>();
List views = super.getModelChildren();
Iterator iterator = views.iterator();
List fortressFilter = getFortressFilter();
while (iterator.hasNext()){
View view = (View) iterator.next();
EObject obj = view.getElement();
if (obj instanceof Fortress){
Fortress curFortress = (Fortress) obj;
if (fortressFilter.contains(curFortress.getCategory())){
iterator.remove();
removedFortresses.add(curFortress.getId());
}
}
}
return views;
}
After the node is removed from the diagram, its connection to another node
is
still shown. I tried to use the same approach overriding the
getConnections() method, and even though in debug mode I see that the
connection is removed from the list returned, it still shows on the diagram.
I noticed also that the getConnections() get called 4 times...
Also, what listener should I add to force the diagram to be refreshed ?
Any ideas/suggestions on what I am missing here ?
|
|
|
Powered by
FUDForum. Page generated in 0.24558 seconds