Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to manually mark editor dirty?
How to manually mark editor dirty? [message #56525] Fri, 17 April 2009 07:57 Go to next message
Eclipse UserFriend
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 16:50 Go to previous message
Eclipse UserFriend
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 16:50 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
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
Previous Topic:Product configuration on other platforms
Next Topic:unexpected null return value from IPluginModelBase.getBundleDescription()
Goto Forum:
  


Current Time: Sat Apr 27 02:32:25 GMT 2024

Powered by FUDForum. Page generated in 0.03409 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top