Community
Participate
Working Groups
Seems to be an issue in *all* generated diagram editors, e.g. the Ecore editor. Steps to reproduce: 1) Open a new Ecore diagram 2) Create an EClass with a self association 3) Save 4) Open the Ecore model in another editor, delete the EReference and save 5) Diagram is updated, but edge is not removed. Instead, it shows a missing semantic element symbol. Even worse: 6) Undo the change in the non-graphical editor and save 7) Edge disappears completely from the diagram. It will not reappear unless you add another edge in the diagram Happens with GMF 2.3 RC2.
In 2.3 R2 the generated ModelCanonicalEditPolicy does not extend the org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy any more. I really do not get it why this has been done. Even out of the comment on the method refreshSemantic in ModelCanonicalEditPolicy I do not get it. In the way the class ModelCanonicalEditPolicy is generated we have a refreshproblem for new created Edges and orphaned. In org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy.refreshSemanticConnections() you could see what I mean. makeViewsMutable(viewDescriptors); // now refresh all the connection containers to update the editparts HashSet<EditPart> ends = new HashSet<EditPart>(); ListIterator<IAdaptable> li = viewDescriptors.listIterator(); while (li.hasNext()) { IAdaptable adaptable = li.next(); Edge edge = (Edge)adaptable.getAdapter(Edge.class); EditPart sourceEP = getEditPartFor(edge.getSource(), edge); if (sourceEP != null) { ends.add(sourceEP); } EditPart targetEP = getEditPartFor(edge.getTarget(), edge); if (targetEP != null) { ends.add(targetEP); } } for(EditPart end : ends) { end.refresh(); }
[GMF Restructure] Bug 319140 : product GMF and component Generation was the original product and component for this bug
(In reply to comment #2) > [GMF Restructure] Bug 319140 : product GMF and component > Generation was the original product and component for this bug I had a similar problem as Jan Koehnlein. After looking at the comment Holger Schill, I think the problem can be solved this way: 1) Change the CanonicalEditPolicy to CanonicalConnectionEditPolicy in the generated code; 2) Implement the 3 missing methods to allow semantic queries. Here I use the Problem Frames diagram we developed (http://sead1.open.ac.uk/pf) to illustrate the solution, you may change the semantic queries according to your own meta-models: @Override protected List<EObject> getSemanticConnectionsList() { View viewObject = (View) getHost().getModel(); LinkedList<EObject> result = new LinkedList<EObject>(); List<ProblemLinkDescriptor> childDescriptors = ProblemDiagramUpdater .getContainedLinks(viewObject); for (ProblemNodeDescriptor d : childDescriptors) { result.add(d.getModelElement()); } return result; } @Override protected EObject getSourceElement(EObject relationship) { if (relationship instanceof Link) { Link l = (Link) relationship; return l.getFrom(); } return null; } @Override protected EObject getTargetElement(EObject relationship) { if (relationship instanceof Link) { Link l = (Link) relationship; return l.getTo(); } return null; }
I think the changes have to be done in the GMF-Tooling templates. Otherwise GMF-Tooling is not useable.
The cause of the trouble was the difference in #refreshOnActivate() method implementation in CanonicalConnectionEditPolicy and regular CanonicalEditPolicy. Former "cheats" on GEF, forcing activation of child edit parts (which is the job done by GEF at appropriate moment of time, *after* editpolicies are activated). Post-commit notification listeners installed from EditParts' activate() method are responsible to refresh diagram according to changes CanonicalEditPolicy otherwise perfectly did. I've added edit part activation logic prior to canonical refresh, although I believe there should be alternative approach, which doesn't require one to intervene with regular GEF approach.
*** Bug 335955 has been marked as a duplicate of this bug. ***
version -> 2.4
Rollback, Set target to 2.4 instead of accidenatlly set Version