How to best handle an "import" action [message #414270] |
Mon, 29 October 2007 12:09 |
Eclipse User |
|
|
|
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 |
Ed Merks 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/
|
|
|
Powered by
FUDForum. Page generated in 0.02954 seconds