【问题标题】:Is there a good examples and documentation of jface databinding framework for Eclipse 3.4?是否有适用于 Eclipse 3.4 的 jface 数据绑定框架的良好示例和文档?
【发布时间】:2010-12-23 22:34:46
【问题描述】:

官方网站非常稀少,大多数示例都是与 EMF 相关的,并且适用于 Eclipse 3.5 但是如果使用 3.4 目标 Eclipse 平台并且不使用 EMF 会怎样。 我对 Tree Viewer 示例特别感兴趣,但总是感谢好的示例和文档。

【问题讨论】:

    标签: java eclipse data-binding jface


    【解决方案1】:

    这是comprehensive list 的样本。 This one 专门与 TreeViewer 相关。

    【讨论】:

      【解决方案2】:

      这里有一些很好的资源:

      我不认为,Eclipse 3.4 和 3.5 中的 JFace 数据绑定之间存在重大差异。概念仍然相同(ISWTObservables 等)。

      编辑

      Lars Vogel 使用以下代码演示了一个可观察的 Listviewer:

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

      介绍鼓励这也适用于 TreeViewers。您需要的内容提供者org.eclipse.jface.databinding.viewers.ObservableListTreeContentProvider。它有点复杂,因为您需要一个列表工厂和一个 TreeStructureAdvisor 来构造这个内容提供者。这就是我能提供的所有帮助。也没有找到一个例子,到目前为止也没有对树查看器使用数据绑定。所以从现在开始,JFace API 文档必须成为你的朋友;)

      【讨论】:

      • 是的,指向官方 Eclipse 网站的链接我当然自己找到了。但是,正如我已经提到的,一般来说那里的信息很少。在 sn-ps 部分中也没有 TreeViewer 的示例。另外,如果你比较例如最新的 org.eclipse.jface.databinding_1.3.1.M20090826-0800.jar 和 eclipse 3.4 附带的 org.eclipse.jface.databinding_1.2.1.M20080827-0800a.jar 你会发现两者完全不同。
      • 第三个链接不是来自eclipse wiki。
      • 是的,但它适用于 ListViewer。我希望有一个现成的例子,那里有树。也许如果一棵树被认为是代表每个节点的孩子的列表的集合......
      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-12-10
      • 2013-08-07
      • 2020-05-18
      • 2011-04-18
      • 2011-01-04
      相关资源
      最近更新 更多