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.
views:
216answers:
1
+3
A:
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 ;)
Andreas_D
2009-12-07 08:56:37
Yes, the links to the official eclipse site I have found myself of course. However, as I already mentioned, there is very little info there in general. Also there is no example for a TreeViewer in the snippets section. Plus, if you compare e.g. latest org.eclipse.jface.databinding_1.3.1.M20090826-0800.jar and what comes with eclipse 3.4 org.eclipse.jface.databinding_1.2.1.M20080827-0800a.jar you will find both quite different.
Svilen
2009-12-07 11:11:05
The third link is not from the eclipse wiki.
Andreas_D
2009-12-07 11:49:34
Yep, but it is for ListViewer. I was hoping that there is a ready example with trees out there. Perhaps if a Tree is considered as a collection of lists representing each node's children...
Svilen
2009-12-07 13:11:25