diagram partitioning without proxy resolving references [message #528279] |
Mon, 19 April 2010 22:16 |
Swavek Messages: 20 Registered: March 2010 |
Junior Member |
|
|
I have a domain model with XmlNetworkApplication at the top of the hierarchy which contains a reference object (XmlExternalNetworkRef) to another model file containing XmlNetworkApplication. This is 'same domain file' flavor of the diagram partitioning tutorial. The XmlExternalNetworkRef object doesn't have a proxy resolving reference to the XmlNetworkApplication. I store a string value of the uri of the domain file in the subobject owned by XmlExternalNetworkRef. When I double click on the XmlExternalNetworkRef view, I create a uri for diagram file and open editor with this uri. This works as expected.
When you double click on the icon representing the XmlExternalNetworkRef the second file opens. However I am not sure if I am doing this right, because of a comment in the generated code of OpenDiagramEditPolicy.OpenDiagramCommand constructor. Here is what the constructor looks like.
/**
* @generated
*/
OpenDiagramCommand(HintedDiagramLinkStyle linkStyle) {
// editing domain is taken for original diagram,
// if we open diagram from another file, we should use another editing domain
super(TransactionUtil.getEditingDomain(linkStyle),
diagramFacet = linkStyle;
}
The comment states that if you open diagram from another file (which is my case), then we should use another editing domain. So I create a new editing domain each time but I am worried that this is wrong, when a file that I want to open is already open. In such case I think I should just find the editing domain corresponding to this file instead of creating a new one. So I have a few questions:
1) I debugged editing domain creation and it seems that for each domain-diagram file pair two domains are created (constructor is called twice). Is one for domain and the second one for diagram file?
2) How can I find out if the editing domain for a file has already been created? I noticed that you can get a domain via this call, but it seems to imply that there is only one domain for all open files of a given type. Is this correct? Is there really only one domain for all files with a given extension?
TransactionalEditingDomain domain = TransactionalEditingDomain.Registry.INSTANCE.getEditingDomai n( "NetworkEditor.diagram.EditingDomain");
3) Is there any other place where editing domains are kept?
Thanks,
Swavek
|
|
|
Powered by
FUDForum. Page generated in 0.02382 seconds