Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Programatically making editor dirty and saving them
Programatically making editor dirty and saving them [message #234442] Mon, 22 June 2009 12:30 Go to next message
Vikas Goyal is currently offline Vikas GoyalFriend
Messages: 34
Registered: July 2009
Member
Hi ,

My plugin has two versions. In older version in my ***.genmodel file my
resource type is XML. In my later version in my ***.genmodel file I have
changed resource type is XMI and I have overridden public boolean
useUUIDs() {return true} . So In my later version in my model I am getting
xmi:id.

Now when I am copying my diagram and model file from older version to
newer version in my model file xmi:id is not there in my model file . In
the editor when I do anything and save my diagram file , In my model file
I am getting xmi:id automatically.

Now what I want is without opening the editor and making it dirty and
saving it I want to programatically get these xmi:id's in my model. For
this one option I have is programatically I should make the editor dirty
and save it (I have not checked if this will generate xmi:id or not). If
this is the only way how I can make editor dirty for all the files I have
copied programatically and how to save these file programatically without
opening the editor.

Thanks in advance
Best Regards,
Vikas
Re: Programatically making editor dirty and saving them [message #234477 is a reply to message #234442] Mon, 22 June 2009 15:47 Go to previous messageGo to next message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Vikas,

You can simply use EMF resources API to update XMI id attributes i hope.
Try loading both model and diagram file saved by "old" version into EMF ResourceSet
and then save both EMF resources.
AFAIU, id attribute will be save by EMF automatically.

-----------------
Alex Shatalin
Re: Programatically making editor dirty and saving them [message #234672 is a reply to message #234477] Thu, 25 June 2009 12:52 Go to previous messageGo to next message
Vikas Goyal is currently offline Vikas GoyalFriend
Messages: 34
Registered: July 2009
Member
Hi Alex ,

Thanks for your answer.

Could you please tell me how I can pass my model file and diagram file to
EMF resources API. All I have is these file names. I dont want to open my
diagram file.

Thanks in advance,
Best Regards,
Vikas
Re: Programatically making editor dirty and saving them [message #234734 is a reply to message #234672] Fri, 26 June 2009 11:05 Go to previous message
Alexander Shatalin is currently offline Alexander ShatalinFriend
Messages: 2928
Registered: July 2009
Senior Member
Hello Vikas,

ResourceSetImpl resourceSet = new ResourceSetImpl();
Resoruce diagramResource = resourceSet.getResource(diagramURI, true);
Resoruce modelResource = resourceSet.getResource(modelURI, true);
for(Resource nextResource : resourceSet.getResources()) {
nextResource.save(Collections.emptyMap());
}

-----------------
Alex Shatalin
Previous Topic:ApplyAppearanceProperties Action error
Next Topic:Diagram resource modified
Goto Forum:
  


Current Time: Sun May 24 23:54:28 GMT 2020

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

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

Back to the top