Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Databinding] Editor (isDirty), PojoObservable and ChangeListener on target to
[Databinding] Editor (isDirty), PojoObservable and ChangeListener on target to [message #330999] Wed, 20 August 2008 20:45 Go to next message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Hi,

I have an editor which uses Databinding. The model is a Pojo hence I'm
using PojoObservable.

To set the Editor dirty I try to register ChangeListener on the bindings.

IObservableList bindings = bindingContext.getBindings();
for (Iterator<Binding> iterator = bindings.iterator();
iterator.hasNext();) {
Binding object = iterator.next();
object.getTarget().addChangeListener(new IChangeListener() {
public void handleChange(ChangeEvent event) {
firePropertyChange(IEditorPart.PROP_DIRTY);
}
});
}

As it seems this ChangeListener is called before the model is updated.
Therefore my isDirty check doesn't find changes in the model and doesn't
set the editor to isDirty. The second change then flags the editor as dirty.

Is there a way around this or do I have to change my model from Pojos to
JavaBeans with PropertyChangeListeners?

Best regards, Lars
Re: [Databinding] Editor (isDirty), PojoObservable and ChangeListener on target to [message #331000 is a reply to message #330999] Wed, 20 August 2008 20:51 Go to previous message
Lars Vogel is currently offline Lars VogelFriend
Messages: 1098
Registered: July 2009
Senior Member

Sorry, forget the question. Registering my changeListener to the model
works. PojoObserable also has change support.

Lars Vogel wrote:
> Hi,
>
> I have an editor which uses Databinding. The model is a Pojo hence I'm
> using PojoObservable.
>
> To set the Editor dirty I try to register ChangeListener on the bindings.
>
> IObservableList bindings = bindingContext.getBindings();
> for (Iterator<Binding> iterator = bindings.iterator();
> iterator.hasNext();) {
> Binding object = iterator.next();
> object.getTarget().addChangeListener(new IChangeListener() {
> public void handleChange(ChangeEvent event) {
> firePropertyChange(IEditorPart.PROP_DIRTY);
> }
> });
> }
>
> As it seems this ChangeListener is called before the model is updated.
> Therefore my isDirty check doesn't find changes in the model and doesn't
> set the editor to isDirty. The second change then flags the editor as
> dirty.
>
> Is there a way around this or do I have to change my model from Pojos to
> JavaBeans with PropertyChangeListeners?
>
> Best regards, Lars
>
Previous Topic:Unzipping eclipse download requires password?!?
Next Topic:ScrolledForm odd refresh issues
Goto Forum:
  


Current Time: Wed Jul 17 20:34:46 GMT 2024

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

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

Back to the top