Track dirty state of editor [message #326641] |
Thu, 27 March 2008 06:51  |
Eclipse User |
|
|
|
Originally posted by: news.dankof.net
Hello!
I'm currently facing a problem regarding the dirty state of an editor.
My editor uses data binding and a ScrolledForm. I want the editor to
be dirty as soon as the user edits the form.
Is there a best practice to handle this?
My current solution is to add a filter for SWT.Selection and SWT.KeyDown
to the applications display. This actually works but the listener is
invoked for every opened editor.
I also found another solution in this newsgroup which involves setting
the dirty state as soon as a setter of the model is being called. As I'd
like my model to be independet of the GUI, this is not an option.
Does anyone have a suggestion how this can be improved? Mabye adding a
listener to the editor, form, main composite, binding context or something?
Thanks,
Fabian
|
|
|
|
|
|
Re: Re-3: Track dirty state of editor [message #326679 is a reply to message #326676] |
Fri, 28 March 2008 07:39  |
Eclipse User |
|
|
|
On Thu, 27 Mar 2008 12:03:30 +0000, "Fabian Dankof" <news@dankof.net>
wrote:
>
>OK I tried it and it works. But there is one thing I forgot to mention:
>
>Everytime I an editor changes, a lock token is acquired. If this is not
>possible, the user should not be able to change anything. If I register
>a PropertyChangeListener it seems that I cannot cancel the input operation
>of the user (such as event.doit=false).
>So my feeling is that I somehow have to listen for any GUI events rather than
>model events. Right?
>
>
If you are propagating all changes using the data binding framework
you can check for the lock token in the data validation. If you don't
get the token just deny the model update.
Achim
|
|
|
Powered by
FUDForum. Page generated in 0.03563 seconds