Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » emf basic undoable command for stereotypes?
emf basic undoable command for stereotypes? [message #380005] Sun, 15 March 2009 11:55 Go to next message
Eclipse UserFriend
Hello,

I am having problems finding some answers...

For example I am taking an object A, applying a stereotype X to it and I
am setting the property alfa of stereotype X to the value b ,these being
done with the following:
1. A.applyStereotype(X);
2. A.setValue(X,afla,b);

1. EObject Element.applyStereotype(Stereotype stereotype)
2. void Element.setValue(Stereotype stereotype,String propertyName,Object
newValue)


My scope is to create a command to be undoable(to restore de old value of
alfa and to unapply X).

Is it possible to apply/unapply a stereotype to an element and set the
value of a property of a stereotype throught basic emf commands or will I
need to write my own for this?

Thank you in advance,
Sorin.
Re: emf basic undoable command for stereotypes? [message #380006 is a reply to message #380005] Mon, 16 March 2009 14:27 Go to previous messageGo to next message
Eclipse UserFriend
Sorin,

If the reason you are using commands is primarily because you want undoable
operations, I'd recommend using a ChangeCommand (from
org.eclipse.emf.edit.command). EMF provides commands for all basic
operations, but UML2 does not provide undoable commands for stererotype
operations. The nice thing about ChangeCommand (see the sample actions in
UML2 for examples) is that you can undo/redo any operation on EMF-based
objects based on event notifications.

Kenn

"Sorin Fagateanu" <cyron_16@yahoo.com> wrote in message
news:d7c6d10bcad2be4783ff6a5884b7d8ee$1@www.eclipse.org...
> Hello,
>
> I am having problems finding some answers...
>
> For example I am taking an object A, applying a stereotype X to it and I
> am setting the property alfa of stereotype X to the value b ,these being
> done with the following:
> 1. A.applyStereotype(X);
> 2. A.setValue(X,afla,b);
>
> 1. EObject Element.applyStereotype(Stereotype stereotype) 2. void
> Element.setValue(Stereotype stereotype,String propertyName,Object
> newValue)
>
> My scope is to create a command to be undoable(to restore de old value of
> alfa and to unapply X).
>
> Is it possible to apply/unapply a stereotype to an element and set the
> value of a property of a stereotype throught basic emf commands or will I
> need to write my own for this?
>
> Thank you in advance,
> Sorin.
>
>
Re: emf basic undoable command for stereotypes? [message #380007 is a reply to message #380006] Thu, 19 March 2009 09:39 Go to previous message
Eclipse UserFriend
Thanks for the answer,it was very usefull!
Re: emf basic undoable command for stereotypes? [message #597524 is a reply to message #380005] Mon, 16 March 2009 14:27 Go to previous message
Eclipse UserFriend
Sorin,

If the reason you are using commands is primarily because you want undoable
operations, I'd recommend using a ChangeCommand (from
org.eclipse.emf.edit.command). EMF provides commands for all basic
operations, but UML2 does not provide undoable commands for stererotype
operations. The nice thing about ChangeCommand (see the sample actions in
UML2 for examples) is that you can undo/redo any operation on EMF-based
objects based on event notifications.

Kenn

"Sorin Fagateanu" <cyron_16@yahoo.com> wrote in message
news:d7c6d10bcad2be4783ff6a5884b7d8ee$1@www.eclipse.org...
> Hello,
>
> I am having problems finding some answers...
>
> For example I am taking an object A, applying a stereotype X to it and I
> am setting the property alfa of stereotype X to the value b ,these being
> done with the following:
> 1. A.applyStereotype(X);
> 2. A.setValue(X,afla,b);
>
> 1. EObject Element.applyStereotype(Stereotype stereotype) 2. void
> Element.setValue(Stereotype stereotype,String propertyName,Object
> newValue)
>
> My scope is to create a command to be undoable(to restore de old value of
> alfa and to unapply X).
>
> Is it possible to apply/unapply a stereotype to an element and set the
> value of a property of a stereotype throught basic emf commands or will I
> need to write my own for this?
>
> Thank you in advance,
> Sorin.
>
>
Re: emf basic undoable command for stereotypes? [message #597530 is a reply to message #380006] Thu, 19 March 2009 09:39 Go to previous message
Eclipse UserFriend
Thanks for the answer,it was very usefull!
Previous Topic:emf basic undoable command for stereotypes?
Next Topic:UML2 to Java class without any ECore dependencies
Goto Forum:
  


Current Time: Wed Feb 12 02:02:28 GMT 2025

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

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

Back to the top