[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: How could I invoke the undoable command?
|
Do you have a listener mechanism on your IPropertySource implementation that
fires property change events? If you take a look at LogicElement in
org.eclipse.gef.examples.logicdesigner.model, it has an interface to add a
PropertyChangeListener. If you add a listener for the property being
changed, you can optionally execute a new command is response.
-Steve
"Kevin" <send60@xxxxxxxx> wrote in message
news:du1tls$bcg$1@xxxxxxxxxxxxxxxxxxxx
> 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
>
>