Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » reverse/undo dirty state in an editor?
reverse/undo dirty state in an editor? [message #336097] Thu, 21 May 2009 10:39 Go to next message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
Hi,

I have a simple EditorPart implementation (a few text input fields).
When the user changes one of the the text fields, the implementation

a.) lets the isDirty method return true
b.) fires a firePropertyChange(IEditorPart.PROP_DIRTY);

As effect the editor gets its dirty flag '*' in the name and the save
action which has been added to the toolbar [via
ActionFactory.SAVE.create(window) in the ActionBarAdvisor implemenation]
gets enabled. Fine so far.

If the user reverses its change (e.g. removing a character previously
added in a text field), my EditorPart implementation

a.) lets the isDirty method return false
b.) fires a firePropertyChange(IEditorPart.PROP_INPUT);

As effect the editor gets its dirty flag '*' removed again.

However, the save action in the toolbar doesn't get disabled
automatically. Am I doing something wrong when trying to reverse the
dirty state of the editor or do I have to care about the save action by
myself when reversing the editor to 'un-dirty' state?

Thanks
Kris
Re: reverse/undo dirty state in an editor? [message #336105 is a reply to message #336097] Thu, 21 May 2009 13:26 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

KW wrote:
>
> a.) lets the isDirty method return true
> b.) fires a firePropertyChange(IEditorPart.PROP_DIRTY);

> If the user reverses its change (e.g. removing a character previously
> added in a text field), my EditorPart implementation
>
> a.) lets the isDirty method return false
> b.) fires a firePropertyChange(IEditorPart.PROP_INPUT);

your second (b) says firePropertyChange(IEditorPart.PROP_INPUT) instead
of PROP_DIRTY. Is that really in your code?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/ganymede/index.jsp?topic=/org.eclips e.platform.doc.isv/guide/workbench.htm


Re: reverse/undo dirty state in an editor? [message #336108 is a reply to message #336105] Thu, 21 May 2009 14:46 Go to previous message
Kris Missing name is currently offline Kris Missing nameFriend
Messages: 47
Registered: July 2009
Member
ah - now I got it - always fire PROP_DIRTY - also to indicate that the
editor is not dirty anymore!

Thanks!

Paul Webster schrieb:
> KW wrote:
>>
>> a.) lets the isDirty method return true
>> b.) fires a firePropertyChange(IEditorPart.PROP_DIRTY);
>
>> If the user reverses its change (e.g. removing a character previously
>> added in a text field), my EditorPart implementation
>>
>> a.) lets the isDirty method return false
>> b.) fires a firePropertyChange(IEditorPart.PROP_INPUT);
>
> your second (b) says firePropertyChange(IEditorPart.PROP_INPUT) instead
> of PROP_DIRTY. Is that really in your code?
>
> PW
>
>
Previous Topic:Locate Eclipse executable at runtime?
Next Topic:How to disable Plugin in Eclipse 3.4.2
Goto Forum:
  


Current Time: Sun Nov 23 05:03:43 GMT 2014

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

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