Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a good examples and documentation of jface databinding framework for Eclipse 3.4?

The official site is quite scarce and most of the examples are EMF- related and for Eclipse 3.5 But what if one uses 3.4 target Eclipse platform and does not use EMF. I am specifically interested in Tree Viewer examples, but good example and documentation is always appreciated.

like image 408
Svilen Avatar asked Dec 17 '25 23:12

Svilen


1 Answers

Here are some good resources:

  • JFace databinding on eclipse wiki (incl. tutorial)
  • The FAQ which links to some snippets
  • An example that shows databinding with a ListViewer

I do not think, there's a major difference between JFace databinding in eclipse 3.4 and 3.5. The concepts are still the same (ISWTObservables, etc).

Edit

Lars Vogel demonstrates an observable Listviewer with the following code:

// Define the viewer
viewer = new ListViewer(parent);
viewer.setContentProvider(new ObservableListContentProvider());
List<Person> persons = new ArrayList<Person>();
// Just for testing we create sample data
createExampleData(persons);
input = new WritableList(persons, Person.class);
// Set the writeableList as input for the viewer
viewer.setInput(input);

The introduction encourages that this works with TreeViewers aswell. The Content provider you need it org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider. It's a bit more complicated, because you need a list factory and a TreeStructureAdvisor to construct this content provider. That's all help I can provide. Didn't find an example either and didn't use databinding with tree viewers so far. So from now on the JFace API doc has to be your friend ;)

like image 138
Andreas Dolk Avatar answered Dec 20 '25 12:12

Andreas Dolk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!