Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Save operation corrupts diagram file
Save operation corrupts diagram file [message #991781] Thu, 20 December 2012 07:30 Go to next message
sowmya Mising name is currently offline sowmya Mising name
Messages: 51
Registered: July 2009
Member
Hi ,
I have a scenario in which if an element is added to the gmf editor then when that element is being added and written to the model , automatically some of its child elements also must get added to editor and written to model. For this I have created threads inside the command to create main element creation, to automatically create the child elements.

But my problem is if the user clicks on save before all the child elements are completely created , then the save operation interrupts the child creation thread and stops it. The model file is in corrupted state as some of the child elements are left partially created. The child creation thread is in synchronized block but still gets interrupted by save. I have been trying to prevent this by trying thread priority , interrupt exceptions and various other thread properties , but have not yet been able to do so.
Can anybody please suggest how to control this save thread. Any information in this context would also be really helpful

Thanks



Re: Save operation corrupts diagram file [message #991798 is a reply to message #991781] Thu, 20 December 2012 08:17 Go to previous messageGo to next message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

did you try to use GMF's built in capability to create child elements on element creation? In gmfmap you can use FeatureSeqInitializer to do so.

Ralph
Re: Save operation corrupts diagram file [message #991869 is a reply to message #991798] Thu, 20 December 2012 11:38 Go to previous messageGo to next message
sowmya Mising name is currently offline sowmya Mising name
Messages: 51
Registered: July 2009
Member
Thanks for the reply Ralph.

I have used FeatureSeqInitializer but may be my description was not correct sorry for that. I should not have said child element.
Actually
I have 2 elements say E1 and E2, both the elements are present in the palette and can be added individually to the editor. Both these elements has its own wizards which is opened when added to the editor and can be configured.

But sometimes if the user adds E1 to the editor and configures a variable in the E1 elements wizard then the E2 element is created along with the E1 element.
The model file will have something like this:
<root>
<E1 attr1 ...>
</E1>
<E2 attr.... >
</E2>
</root>
The number of E2 elements automatically added varies based on the variable configuration in E1. Threads are created to create E2 inside the command that creates E1.

so now I am trying to delay the save operation till all the E2 elements are created.
Any suggestions would be helpful.

Thanks






Re: Save operation corrupts diagram file [message #997380 is a reply to message #991869] Mon, 07 January 2013 09:15 Go to previous message
Ralph Gerbig is currently offline Ralph Gerbig
Messages: 697
Registered: November 2009
Senior Member
Hi,

did you try to modify the create command for E1 to also create E2? This would execute both operations simultaneously. The create request has a map in which you could put additional information needed for creation.

Ralph
Previous Topic:Custom decoration not being called
Next Topic:How to register Connection Edit Part as Drop Target
Goto Forum:
  


Current Time: Thu Oct 02 00:36:08 GMT 2014

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

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