Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Re: ChangeCommand problem...
Re: ChangeCommand problem... [message #478315] Wed, 22 April 2009 13:25
Kenn Hussey is currently offline Kenn HusseyFriend
Messages: 1620
Registered: July 2009
Senior Member
Sorin,

This is a more appropriate question for the UML2 newsgroup (copied).

1. Yes, when stereotypes are applied/unapplied, no event is fired on the
element to which the stereotype has been applied/unapplied, so you'll need
to trigger a refresh of your editor in another way. This has been done in
UML2, for example, by introducing a specialized "RefreshingChangeCommand";
see ApplyStereotypeAction in the sample UML editor plug-in for details.

2. ChangeCommands should be undoable, so I'm not sure what's going on here.
However, UML2 has a specialized change command (and change recorder) that
takes into acccount some UML-isms that aren't accounted for in EMF... I'd
suggest trying to use it; see the UML editor again for examples.

Cheers,

Kenn

"Sorin Fagateanu" <cyron_16@yahoo.com> wrote in message
news:209e8410d148745fc9ab624f8d9e724b$1@www.eclipse.org...
> Hello all,
>
> I have another problem.
>
> I have a in the eclipse's Project Explorer a model file,that when I expand
> it I can see in the tree packages ,clases,operations,attributes
> etc...,this being done with the emf generation.
> #1 comm
> I have made myself a command for renaming a Package and it look something
> like:
>
> EditingDomain editingDomain = AdapterFactoryEditingDomain.
> getEditingDomainFor(package);
> CompoundCommand command = new CompoundCommand();
> command.append(SetCommand.create(editingDomain, package
> ,UMLPackage.eINSTANCE.getNamedElement_Name(), newName));
> editingDomain.getCommandStack().execute(command);
>
> After calling this it automaticaly updates the name in the tree.
> #2 comm
> I have made another command for adding a steretype and setting a value
> and it looks like:
>
> Runnable runnable = new Runnable() {
> public void run() {
> package.applyStereotype(MyStereotype);
> package.setValue(MyStereotype, myInt, 5);
> }
> };
>
> EditingDomain editingDomain = AdapterFactoryEditingDomain.
> getEditingDomainFor(package);
> CompoundCommand command = new CompoundCommand();
> command.append(new ChangeCommand(editingDomain, runnable));
> editingDomain.getCommandStack().execute(command);
>
> However, when I call this comand, in the tree ,the package's label isn't
> updated like I would have expected (something like : <<MyStereotipe>>
> PackageName )
>
> At the next rename it updates the label in the tree to show also the
> "<<MyStereotype>>".
>
>
> My problems are the following :
>
> 1. the label of package isnt't updated when applying the second command.
>
> I have observed the in the case of renaming ,when it enter's the "set"
> method it also triggers the "notify" which iterates thru all the adapters
> including the PackageImplAdatpter which calls my content/label provider.
> And i have observed that in the case of applying stereotype, in the
> notify,it doesn't have a PackageImplAdapter,which it means that no changes
> are done.
>
> 2.in case of the second command,I cant undo the command.I would have
> expected in the Edit menu to appear something like Undo "#2 comm".
>
>
> If someone has got any ideas I would be very grateful.
>
>
> Thank you in advance!
>
>
>
>
>
>
>
Previous Topic:Sequence diagram profile
Next Topic:Re: ChangeCommand problem...
Goto Forum:
  


Current Time: Fri Apr 26 14:02:14 GMT 2024

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

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

Back to the top