Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » EMF.edit commands usage
EMF.edit commands usage [message #473772] Fri, 06 July 2007 02:47 Go to next message
Bogdan Pistol is currently offline Bogdan PistolFriend
Messages: 29
Registered: July 2009
Junior Member
Hello,

I have a few things not very clear about the edit commands.

I'm using an AdapterFactoryEditingDomain with commands in a
BasicCommandStack. I tested successfully the ChangeCommand (it modifies the
model and undo/redo works).

Is there a reason I should use SetCommand, or AddCommand or other commands?
I could make the same "set" and "add" with model changes inside a ChangeCommand.
What is the difference between the two approaches?

Thanks

Bogdan Pistol,
Re: EMF.edit commands usage [message #473875 is a reply to message #473772] Fri, 06 July 2007 11:58 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Bogdan,

These are more EMF-specific questions that are best asked on the EMF
newsgroup, which I've added to the "to" list of the reply. The use of
specific commands like SetCommand and AddCommand allow the item
providers that create these commands to specialize the behavior. For
example, for an EObject X, when I set feature foo, I might want to also
update some other feature goo. By specializing createSetCommand in
XItemProvider, I could do that. The ChangeCommand is very handy if you
just want to do a bunch of direct model manipulations, or need to invoke
some utility methods that knows= nothing about commands, but still want
any changes being made to be undoable.


Bogdan Pistol wrote:
> Hello,
>
> I have a few things not very clear about the edit commands.
>
> I'm using an AdapterFactoryEditingDomain with commands in a
> BasicCommandStack. I tested successfully the ChangeCommand (it modifies the
> model and undo/redo works).
>
> Is there a reason I should use SetCommand, or AddCommand or other commands?
> I could make the same "set" and "add" with model changes inside a ChangeCommand.
> What is the difference between the two approaches?
>
> Thanks
>
> Bogdan Pistol,
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF.edit commands usage [message #473883 is a reply to message #473875] Fri, 06 July 2007 17:05 Go to previous message
Bogdan Pistol is currently offline Bogdan PistolFriend
Messages: 29
Registered: July 2009
Junior Member
Thank you Ed

Bogdan,

On Fri, 06 Jul 2007 07:58:27 -0400, Ed Merks wrote:

> Bogdan,
>
> These are more EMF-specific questions that are best asked on the EMF
> newsgroup, which I've added to the "to" list of the reply. The use of
> specific commands like SetCommand and AddCommand allow the item
> providers that create these commands to specialize the behavior. For
> example, for an EObject X, when I set feature foo, I might want to also
> update some other feature goo. By specializing createSetCommand in
> XItemProvider, I could do that. The ChangeCommand is very handy if you
> just want to do a bunch of direct model manipulations, or need to invoke
> some utility methods that knows= nothing about commands, but still want
> any changes being made to be undoable.
>
>
> Bogdan Pistol wrote:
>> Hello,
>>
>> I have a few things not very clear about the edit commands.
>>
>> I'm using an AdapterFactoryEditingDomain with commands in a
>> BasicCommandStack. I tested successfully the ChangeCommand (it modifies the
>> model and undo/redo works).
>>
>> Is there a reason I should use SetCommand, or AddCommand or other commands?
>> I could make the same "set" and "add" with model changes inside a ChangeCommand.
>> What is the difference between the two approaches?
>>
>> Thanks
>>
>> Bogdan Pistol,
>>
Re: EMF.edit commands usage [message #622850 is a reply to message #473772] Fri, 06 July 2007 11:58 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33113
Registered: July 2009
Senior Member
Bogdan,

These are more EMF-specific questions that are best asked on the EMF
newsgroup, which I've added to the "to" list of the reply. The use of
specific commands like SetCommand and AddCommand allow the item
providers that create these commands to specialize the behavior. For
example, for an EObject X, when I set feature foo, I might want to also
update some other feature goo. By specializing createSetCommand in
XItemProvider, I could do that. The ChangeCommand is very handy if you
just want to do a bunch of direct model manipulations, or need to invoke
some utility methods that knows= nothing about commands, but still want
any changes being made to be undoable.


Bogdan Pistol wrote:
> Hello,
>
> I have a few things not very clear about the edit commands.
>
> I'm using an AdapterFactoryEditingDomain with commands in a
> BasicCommandStack. I tested successfully the ChangeCommand (it modifies the
> model and undo/redo works).
>
> Is there a reason I should use SetCommand, or AddCommand or other commands?
> I could make the same "set" and "add" with model changes inside a ChangeCommand.
> What is the difference between the two approaches?
>
> Thanks
>
> Bogdan Pistol,
>


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF.edit commands usage [message #623293 is a reply to message #473875] Fri, 06 July 2007 17:05 Go to previous message
Bogdan Pistol is currently offline Bogdan PistolFriend
Messages: 29
Registered: July 2009
Junior Member
Thank you Ed

Bogdan,

On Fri, 06 Jul 2007 07:58:27 -0400, Ed Merks wrote:

> Bogdan,
>
> These are more EMF-specific questions that are best asked on the EMF
> newsgroup, which I've added to the "to" list of the reply. The use of
> specific commands like SetCommand and AddCommand allow the item
> providers that create these commands to specialize the behavior. For
> example, for an EObject X, when I set feature foo, I might want to also
> update some other feature goo. By specializing createSetCommand in
> XItemProvider, I could do that. The ChangeCommand is very handy if you
> just want to do a bunch of direct model manipulations, or need to invoke
> some utility methods that knows= nothing about commands, but still want
> any changes being made to be undoable.
>
>
> Bogdan Pistol wrote:
>> Hello,
>>
>> I have a few things not very clear about the edit commands.
>>
>> I'm using an AdapterFactoryEditingDomain with commands in a
>> BasicCommandStack. I tested successfully the ChangeCommand (it modifies the
>> model and undo/redo works).
>>
>> Is there a reason I should use SetCommand, or AddCommand or other commands?
>> I could make the same "set" and "add" with model changes inside a ChangeCommand.
>> What is the difference between the two approaches?
>>
>> Thanks
>>
>> Bogdan Pistol,
>>
Previous Topic:Java Problems
Next Topic:How to add an interface into to list of providedinterfaces of Port?
Goto Forum:
  


Current Time: Fri Mar 29 12:58:45 GMT 2024

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

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

Back to the top