Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » What is the best code practice to modify the domain model on diagram loading?
What is the best code practice to modify the domain model on diagram loading? [message #1046829] Mon, 22 April 2013 12:38 Go to next message
Vitaly Savickas is currently offline Vitaly SavickasFriend
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
Re: What is the best code practice to modify the domain model on diagram loading? [message #1052563 is a reply to message #1046829] Tue, 30 April 2013 08:36 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph GerbigFriend
Messages: 702
Registered: November 2009
Senior Member
Hi,

did you try to overrude createPartcontrol of your generated xxxDiagramEditor?

Ralph
Re: What is the best code practice to modify the domain model on diagram loading? [message #1052603 is a reply to message #1052563] Tue, 30 April 2013 09:39 Go to previous message
Vitaly Savickas is currently offline Vitaly SavickasFriend
Messages: 62
Registered: March 2010
Member
Thank you for the answer, Ralph.

Isn't createPartControl() concerned about the building of diagram UI? It seems to me not a very suitable place to work on the model, but I can be wrong. I'm curious if you have experience of similar problem.

Cheers,
Vitaly
Previous Topic:create a project of multiple diagrams
Next Topic:Filemenu popup within GMF
Goto Forum:
  


Current Time: Thu Mar 28 17:17:15 GMT 2024

Powered by FUDForum. Page generated in 0.03252 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top