Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MDT (Model Development Tools) » ChangeCommand problem...
ChangeCommand problem... [message #597602] Fri, 10 April 2009 08:13
Sorin Fagateanu is currently offline Sorin Fagateanu
Messages: 46
Registered: July 2009
Member
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:Problems when geting values from stereotypes
Next Topic:ChangeCommand problem...
Goto Forum:
  


Current Time: Sat Apr 19 13:21:10 EDT 2014

Powered by FUDForum. Page generated in 0.01923 seconds