How to manually mark editor dirty? [message #56525] |
Fri, 17 April 2009 03:57  |
Eclipse User |
|
|
|
Originally posted by: timo.rohrberg.gmx.net
Hello everybody,
I have a - hopefully simple - question concerning the isDirty handling
of an editor developed within the Eclipse Plug-in Development Environment:
Some of my model elements do have complex properties which are objects
themselves, containing again complex properties, like this:
public class ModelElement implements Serializable {
private Property myProperty;
}
public class Property implements Serializable {
private Property subProperty;
private int fieldThatMayChange;
}
Now I need to manually mark the editor dirty when some one of the fields
(in the Eeample fieldThatMayChange) of those complex properties change.
How can I achieve that? Do I have access to the editor and it's
"firePropertyChange(PROP_DIRTY)" somehow? There's probably no direct
access to that method as it's protected in the GraphicalEditor class.
Thanks for any reply!
Timo Rohrberg
--
Timo Rohrberg <timo.rohrberg@gmx.net>
"Brick walls let us show our dedication. They are there to separate
us from the people who don't really want to achieve their childhood
dreams." (Randy Pausch, computer science professor at CMU)
|
|
|
Re: How to manually mark editor dirty? [message #57408 is a reply to message #56525] |
Tue, 21 April 2009 12:50  |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
Timo Rohrberg wrote:
> Hello everybody,
>
> I have a - hopefully simple - question concerning the isDirty handling
> of an editor developed within the Eclipse Plug-in Development Environment:
>
> Some of my model elements do have complex properties which are objects
> themselves, containing again complex properties, like this:
>
> public class ModelElement implements Serializable {
> private Property myProperty;
> }
>
> public class Property implements Serializable {
> private Property subProperty;
> private int fieldThatMayChange;
> }
>
> Now I need to manually mark the editor dirty when some one of the fields
> (in the Eeample fieldThatMayChange) of those complex properties change.
> How can I achieve that? Do I have access to the editor and it's
> "firePropertyChange(PROP_DIRTY)" somehow? There's probably no direct
> access to that method as it's protected in the GraphicalEditor class.
You can mimic
org.eclipse.ui.forms.editor.FormEditor.editorDirtyStateChang ed() by
exposing a new public method that calls the protected one.
However, if you're using EMF and GMF's GraphicalEditor, you should be
making ALL model changes via the editor's CommandStack. That way
everything "just works" - dirty marking, undo/redo, etc.
Hope this helps,
Eric
|
|
|
Re: How to manually mark editor dirty? [message #595998 is a reply to message #56525] |
Tue, 21 April 2009 12:50  |
Eclipse User |
|
|
|
Timo Rohrberg wrote:
> Hello everybody,
>
> I have a - hopefully simple - question concerning the isDirty handling
> of an editor developed within the Eclipse Plug-in Development Environment:
>
> Some of my model elements do have complex properties which are objects
> themselves, containing again complex properties, like this:
>
> public class ModelElement implements Serializable {
> private Property myProperty;
> }
>
> public class Property implements Serializable {
> private Property subProperty;
> private int fieldThatMayChange;
> }
>
> Now I need to manually mark the editor dirty when some one of the fields
> (in the Eeample fieldThatMayChange) of those complex properties change.
> How can I achieve that? Do I have access to the editor and it's
> "firePropertyChange(PROP_DIRTY)" somehow? There's probably no direct
> access to that method as it's protected in the GraphicalEditor class.
You can mimic
org.eclipse.ui.forms.editor.FormEditor.editorDirtyStateChang ed() by
exposing a new public method that calls the protected one.
However, if you're using EMF and GMF's GraphicalEditor, you should be
making ALL model changes via the editor's CommandStack. That way
everything "just works" - dirty marking, undo/redo, etc.
Hope this helps,
Eric
|
|
|
Powered by
FUDForum. Page generated in 0.03998 seconds