property changed and commandStack [message #238141] |
Wed, 29 August 2007 09:50 |
Eclipse User |
|
|
|
Originally posted by: alexjaquet.gmail.com
Hi,
I would like to be able to undo redo once a user change the value of a
property.
Since the command stack is available in a editor and changing a property
is not executed as a command how can deal with that ?
Thanks
Regards,
Alexandre
|
|
|
|
Re: property changed and commandStack [message #238152 is a reply to message #238145] |
Wed, 29 August 2007 13:07 |
Eclipse User |
|
|
|
Originally posted by: alexjaquet.gmail.com
I've tryed to put in my editor getAdapter
if (type == IPropertySheetPage.class) {
System.out.println("toto");
}
but it's never called
any idea welcome
thanks
Regards,
Alexandre
|
|
|
|
Re: property changed and commandStack [message #238167 is a reply to message #238156] |
Thu, 30 August 2007 07:06 |
Eclipse User |
|
|
|
Originally posted by: alexjaquet.gmail.com
Hi Renée, that's right actually that break the mvc pattern.
I need to add a something like a propertyChange listener on my edit part
, but there is no existing PropertyChangeListener except one from
java.beans package
If I want to add a listener my edit part should be able to register
correctly the listener
with an edit part we can only add :
-edit part listener
-node listener
Any other hints ?
Thanks for responding.
Regards,
Alexandre
|
|
|
Re: property changed and commandStack [message #238177 is a reply to message #238167] |
Thu, 30 August 2007 07:16 |
Eclipse User |
|
|
|
Originally posted by: alexjaquet.gmail.com
... I can create a command on the edit part inside a notifyChanged but
there is no command stack inside an edit part
can I pass it at the creation time of the edit part?
|
|
|
Re: property changed and commandStack [message #238182 is a reply to message #238177] |
Thu, 30 August 2007 07:34 |
Eclipse User |
|
|
|
Originally posted by: alexjaquet.gmail.com
I've tryed to add a command stack in my edit part, and created a command
and executed it by the command stack like this
public void notifyChanged(Notification notification) {
// notify the figure of any widget's property change
IFigure fig = getFigure();
if (fig != null && fig instanceof AbstractWidgetFigure) {
Object notifier = notification.getNotifier();
if (notifier instanceof Property) {
Property p = (Property) notifier;
FigureContext fc = getFigureFactory().getFigureContext();
String value = p.getValue();
if (! fc.isDesignMode()) {
// Translate the value in Preview mode
value = p.getI18nValue(fc.getLocale());
}
UpdatePropertyCommand command = new UpdatePropertyCommand(p,value);
this.commandStack.execute(command);
}
The problem who occurs is once the command is executed the notifyChanged
is re called (in loop) ...
Any other idea welcomed
Thanks
Regards,
Alexandre
|
|
|
|
Powered by
FUDForum. Page generated in 0.02894 seconds