Bug 150408 - Unable to update links to/form inner elements correctly using CanonicalConnectionEditPolicy
Summary: Unable to update links to/form inner elements correctly using CanonicalConnec...
Status: NEW
Alias: None
Product: GMF-Runtime
Classification: Modeling
Component: General (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows XP
: P3 enhancement
Target Milestone: 2.1   Edit
Assignee: Anthony Hunter CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 148275
  Show dependency tree
 
Reported: 2006-07-12 11:57 EDT by Alex Shatalin CLA
Modified: 2010-07-19 12:31 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Shatalin CLA 2006-07-12 11:57:24 EDT
CanonicalConnectionEditPolicy is intended to be installed to an EditPart which represents link source and create/remove link from there. Due to the current contract, CanonicalConnectionEditPolicy invoke refresh semantic children first and then invoke update for all the outgoing connection. It is not possible to correctly update all the outgoing connection including links to the inner elements in this situation. 

Example. 
User model instance was created on diagram:
Node1 
Node2

Then user close the diagram, changes the model to the following state:
Node1 
            SubNode1 
                        LinkToSubNode2 
Node2 
            SubNode2

On next diagram opening, update process will be executed by activating all the CanonicalConnectionEditPolicyes.  In this situation if CanonicalConnectionEditPolicy installed on Node1 will be activated first, then SubNode1 will be created on diagram and CanonicalConnectionEditPolicy will try to create LinkToSubNode2. The problem is: SubNode2 was not created on diagram yet, so it will not be possible to create this link (destination notation model element absent on diagram). CanonicalConnectionEditPolicy contract should be modified to handle such situations.

Ideas how to make this working:

- Split updating process on two steps. For example - create two types of requests “CanonicalNodesUpdateRequest”, “CanonicalConnectionsUpdateRequest” and ask first to respond for NodesUpdate and then corresponding command will be finished – process ConnectionsUpdate
- Perform Semantic update twice.
- Move update logic from the CanonicalConnectionEditPolicy installed for each EditPart to some central place with an updating code for the entire diagram. This place should listed for the notifications from the domain model as well 
- Allow creation of incoming connections from CanonicalConnectionEditPolicy
Comment 1 Alex Shatalin CLA 2006-07-12 12:01:50 EDT
E-mail thread with Steven:

Alex Shatalin:
Links should be updated by an edit policy installed to link source edit part.

As we discussed, CanonicalConnectionEditPolicy is intended to be installed to an EditPart which represents link source and create/remove link from there. In current state, I'm generating only one instance of CanonicalConnectionEditPolicy which will be installed to DiagramEditPart and will update all the links at once. The problem why I've implemented it in this way is: AFAIU "intended" solution does not work if an EditPart corresponding to the link destination was not created yet. This is possible because there is no guarantee that all the CanonicalEditPolicies will finish refreshing its semantic children before starting refresh process for links. 
             
I suggest splitting refreshing process on two parts: refresh diagram nodes contents first and then refresh all the links. In this case all the link target nodes/editparts will be created on first step and it'll be much easy to create links in this situation.

Steven Shaw:
Mohammed is exploring this issue currently.  He is introducing an "isActivating" api on the diagram will perhaps allow us to identify if additional refresh are necessary.  In the CanonicalConnectionEditPolicy itself, it is already separating this refresh to do the semantic children first and then the semantic connections.  @see CanonicalConnectionEditPolicy#refreshSemantic.
Comment 2 Alex Shatalin CLA 2006-07-25 06:10:21 EDT
Can we found a solution for this problem till 2.0 M1?
Comment 3 Richard Gronback CLA 2007-05-07 11:33:13 EDT
Updated target milestone.
Comment 4 Mohammed Mostafa CLA 2007-05-31 16:01:14 EDT
reassign to inbox
Comment 5 Anthony Hunter CLA 2007-06-19 12:14:09 EDT
Moving to the next release, GMF 2.1. 
Comment 6 Eclipse Webmaster CLA 2010-07-19 12:31:04 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Diagram was the original product and component for this bug