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 11: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 03:27 Go to previous message
Simon SSC is currently offline Simon SSC
Messages: 65
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: Thu Apr 24 02:00:30 EDT 2014

Powered by FUDForum. Page generated in 0.01711 seconds