Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Track dirty state of editor
Track dirty state of editor [message #326641] Thu, 27 March 2008 10:51 Go to next message
Eclipse UserFriend
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: Track dirty state of editor [message #326644 is a reply to message #326641] Thu, 27 March 2008 12:03 Go to previous messageGo to next message
Achim Loerke is currently offline Achim LoerkeFriend
Messages: 376
Registered: July 2009
Location: Braunschweig, Germany
Senior Member

On Thu, 27 Mar 2008 10:51:41 +0000, "Fabian Dankof" <news@dankof.net>
wrote:


>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.
>

If your model classes are implemented as Java Beans, you could
register a property change listener. This wouldn't tie your model to
any GUI.

And since you are using data binding, your model should already use a
Bean interface (and the property change event).

Achim


Achim Lörke

Re-2: Track dirty state of editor [message #326660 is a reply to message #326644] Thu, 27 March 2008 12:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: news.dankof.net

-------- Original Message --------
Subject: Re: Track dirty state of editor (27-Mrz-2008 13:03)
From: Achim Lörke <Achim.Loerke@bredex.de>
To:


>
> If your model classes are implemented as Java Beans, you could
> register a property change listener. This wouldn't tie your model to
> any GUI.
>

In fact it does.
Where can I register a property change listener? Is it the databinding context?

Fabian
Re-3: Track dirty state of editor [message #326676 is a reply to message #326660] Thu, 27 March 2008 12:03 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: news.dankof.net

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?
Re: Re-3: Track dirty state of editor [message #326679 is a reply to message #326676] Fri, 28 March 2008 11:39 Go to previous message
Achim Loerke is currently offline Achim LoerkeFriend
Messages: 376
Registered: July 2009
Location: Braunschweig, Germany
Senior Member

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


Achim Lörke

Previous Topic:How to view .classpath file
Next Topic:FileSystemImportWizard and the .metadata directory
Goto Forum:
  


Current Time: Thu Jun 27 19:55:45 GMT 2024

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

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

Back to the top