Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF Editor on memory model
EMF Editor on memory model [message #925063] Thu, 27 September 2012 10:37 Go to next message
Frank Goldwin is currently offline Frank GoldwinFriend
Messages: 10
Registered: May 2012
Junior Member
Hi,

I have a FruitBasket model and a Fruit model. The FruitBasket can contain many Fruits (EMF containment).
In the EMF FruitBasket editor I want to double click on a Fruit and open a specialized EMF Fruit editor (I need it because the Fruit is a complex model). I already have both editors.
I've partially solved it by making a copy of the Fruit object upon a double click in the FruitBasket editor, and providing this copy to the Fruit editor using an IStorageEditorInput.
The FruitBasket editor listens for the 'save' event on the Fruit editor, gets the modified fruit and replaces it into the FruitBasket.
The problem I have is that the Fruit editor creates a file for the Fruit on the file system; a file which I don't need. Even if the IStorage returned by the IStorageEditorInput returns 'isReadOnly() = false' the file is still generated.

Is there a better way to edit an EMF 'sub-model' element with a specialized editor?
Any suggestions?

Thank you.
Frank
Re: EMF Editor on memory model [message #925130 is a reply to message #925063] Thu, 27 September 2012 11:52 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Frank,

Comments below.

On 27/09/2012 12:37 PM, Frank Goldwin wrote:
> Hi,
>
> I have a FruitBasket model and a Fruit model. The FruitBasket can
> contain many Fruits (EMF containment).
> In the EMF FruitBasket editor I want to double click on a Fruit and
> open a specialized EMF Fruit editor (I need it because the Fruit is a
> complex model). I already have both editors.
> I've partially solved it by making a copy of the Fruit object upon a
> double click in the FruitBasket editor, and providing this copy to the
> Fruit editor using an IStorageEditorInput.
> The FruitBasket editor listens for the 'save' event on the Fruit
> editor, gets the modified fruit and replaces it into the FruitBasket.
I suppose you could put them in separate resources...
> The problem I have is that the Fruit editor creates a file for the
> Fruit on the file system; a file which I don't need. Even if the
> IStorage returned by the IStorageEditorInput returns 'isReadOnly() =
> false' the file is still generated.
So you want it all in one file....
>
> Is there a better way to edit an EMF 'sub-model' element with a
> specialized editor?
I have no experience with that...
> Any suggestions?
Could you specialize the fruit editor's save logic?
>
> Thank you.
> Frank


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF Editor on memory model [message #925223 is a reply to message #925130] Thu, 27 September 2012 14:06 Go to previous message
EclipseModeling Mising name is currently offline EclipseModeling Mising nameFriend
Messages: 4
Registered: September 2011
Junior Member
I've found a relatively clean solution.

I have adapted the IStorageEditorInput to adapt an editing domain.
I countruct the IStorageEditorInput with the original Fruit object (not a copy as from my previous suggestion) and the FruitBasket's editing domain.
Once opened the Fruit editor calls getAdapter(EditingDomain.class) on the IStorageEditorInput and uses that as its editing domain.
Changes to the Fruit object happen on the original FruitBasket model. Furthermore the 'save' action on the Fruit editor saves the FruitBasket file. No other files are generated.

BTW I got this idea about sharing editing domains by reading about the EMF Transaction framework, so kudos to you guys as always.

And thank you Ed for your great work!

Frank
Previous Topic:Help with CreateChildCommand
Next Topic:[Xcore] Import metamodel by URI/path
Goto Forum:
  


Current Time: Thu Mar 28 14:30:02 GMT 2024

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

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

Back to the top