[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
|
[news.eclipse.tools.gef] Re: How could I invoke the undoable command?
|
Steven,Thank you very much.
In fact,I hava the listener which can get the inform when the property value
in Eclipse Property Page is changed.
But i want to know how to invoke the new command and add the new comand in
CommandStack,so that the command can support the undo /redo.....
Is there a way that i can run a Action(my be run some commands in it ) when
i change the property value in Eclipse Property Page ,like that I run the
Action in ContextMenu?
Thanks again!
"Steven Shaw" <steveshaw@xxxxxxxxxx> дÈëÓʼþ
news:du2jer$lu8$1@xxxxxxxxxxxxxxxxxxxx
> 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
> >
> >
>
>