Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » How to best handle an "import" action
How to best handle an "import" action [message #414270] Mon, 29 October 2007 12:09 Go to next message
Eclipse UserFriend
Originally posted by: udaykabe.hotmail.com

I have created two Ecore models, Model A and Model B. What is my best
approach to creating an import action that first loads Model B XML files as
EMF resources from user-selected URL's (similar to the way
LoadResourceAction works from the context menu), creates a hierarchy of
Model A type objects from Model B objects, and adds the hierarchy of objects
to a user selected parent object in Model A? Obviously, I would like to
preserve undo and redo semantics.

(I have tried to follow the EMF pattern of using commands to add objects
before, but as I revisit that implemenation, I am wondering if I fully
understood it!)

Thanx in advance.

Uday
Re: How to best handle an "import" action [message #414272 is a reply to message #414270] Mon, 29 October 2007 12:46 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Uday,

What you describe sounds much like a "create child" action. It sounds
like only the final step of adding the "A" objects to "B" needs to be
done with an AddCommand or SetCommand that's executed on the
CommandStack. That should be sufficient make the overall operation
properly undoable. The building of the complex tree of "A" objects
doesn't need to use commands because it doesn't need to be undoable.


Uday Kabe wrote:
> I have created two Ecore models, Model A and Model B. What is my best
> approach to creating an import action that first loads Model B XML files as
> EMF resources from user-selected URL's (similar to the way
> LoadResourceAction works from the context menu), creates a hierarchy of
> Model A type objects from Model B objects, and adds the hierarchy of objects
> to a user selected parent object in Model A? Obviously, I would like to
> preserve undo and redo semantics.
>
> (I have tried to follow the EMF pattern of using commands to add objects
> before, but as I revisit that implemenation, I am wondering if I fully
> understood it!)
>
> Thanx in advance.
>
> Uday
>
>
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Notify model objects about completion of their deserialization
Next Topic:SetCommand by an EReference
Goto Forum:
  


Current Time: Thu Apr 25 16:34:02 GMT 2024

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

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

Back to the top