Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » React on value change along with databinding
React on value change along with databinding [message #1086694] Wed, 14 August 2013 15:24 Go to next message
Johannes Spreemann is currently offline Johannes Spreemann
Messages: 19
Registered: August 2013
Location: Germany/Netherlands
Junior Member
Hello,

I have a databinding that's working perfectly. But now I want to react additional on my own if some values of several GUI elements change. Is it possible to act as some kind of subscriber to the databinding instead of using the eventlisteners of each SWT component?

Greetings
Johannes
Re: React on value change along with databinding [message #1097812 is a reply to message #1086694] Fri, 30 August 2013 07:27 Go to previous message
Simon Scholz is currently offline Simon Scholz
Messages: 73
Registered: April 2012
Location: Germany
Member
Hello Johannes,

for sure you can.
Each org.eclipse.core.databinding.observable.value.IObservableValue has an addValueChangeListener method, where you can attach your own custom org.eclipse.core.databinding.observable.value.IValueChangeListener.

For instance:

IObservableValue target = WidgetProperties.text(SWT.Modify).
  observe(textInstance); 

target.addValueChangeListener(new IValueChangeListener(){
   public void handleValueChange(ValueChangeEvent valuechangeevent){
         Object newValue = valuechangeevent.diff.getNewValue();
   }
});


If you have further questions, do not hesitate to ask them Wink

Best regards,

Simon
Previous Topic:Set Selection on Tree Viewer
Next Topic:TitleAreaDialog - An exception with no message.
Goto Forum:
  


Current Time: Sat Sep 20 15:58:55 GMT 2014

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

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