What is the best code practice to modify the domain model on diagram loading? [message #1046829] |
Mon, 22 April 2013 12:38 |
Vitaly Savickas Messages: 62 Registered: March 2010 |
Member |
|
|
Hello,
Can anyone suggest what is the best coding practice to modify the domain model when loading a diagram file?
I am interested in a scenario where some attributes of node elements need to be set as the diagram is opened. In my case there are non-transient attributes, which represent a file path to a resource. When a diagram is opened I need to load those resources for each of the nodes and set another attribute if loading succeeded.
From what I can see the generated diagram code does the whole loading process in a single call to DiagramIOUtil.load(domain, storage, true, getProgressMonitor()) in the body of a XXXDocumentProvider::setDocumentContent(IDocument document, IEditorInput element) method, suggesting that I can customise the loaded document at that point. However, I try to avoid code customisation and separate the generated code from my code. Is there a better solution?
P.S. It is important that the diagram should not be marked as modified after this process.
Cheers,
Vitaly
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.02944 seconds