开发者

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 sp开发者_运维技巧ecifically interested in Tree Viewer examples, but good example and documentation is always appreciated.


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 ;)


Here is a comprehensive list of samples. This one is specifically related to TreeViewer.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜