[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] How could I invoke the undoable command?
|
Hi,everyone
I want implements the function like this:
when I change the Properties value in Property Sheet,I known
that it invoke the SetValueCommand in Class UndoablePropertySheetEntry to do
for the operation undoable.
Now ,I want to invoke the other Command not only invoke the SetValueCommand
when change the Properties value .
I mean that I want to do other operation when change the properties value
,and the whole operation can support the undo/redo function.....
this is the code int GEF Class UndoablePropertySheetEntry :
void valueChanged(UndoablePropertySheetEntry child, CompoundCommand command)
{
CompoundCommand cc = new CompoundCommand();
command.add(cc);
SetValueCommand setCommand;
for (int i = 0; i < getValues().length; i++) {
setCommand = new SetValueCommand(child.getDisplayName());
setCommand.setTarget(getPropertySource(getValues()[i]));
setCommand.setPropertyId(child.getDescriptor().getId());
setCommand.setPropertyValue(child.getValues()[i]);
cc.add(setCommand);
}
// inform our parent
if (getParent() != null)
((UndoablePropertySheetEntry)getParent()).valueChanged(this, command);
else {
//I am the root entry
stack.execute(command);
}
}
i think i should inherit the valueChanged method and add other command in
it,
But i find the UndoablePropertySheetEntry (in the package
org.eclipse.gef.ui.properties) is final class ,i cann't inherit
it ......
Is my idea right?
who could give me some help?
Thanks.
from kevin