简体   繁体   English

从eclipse插件动态更新TreeViewer

[英]Dynamically update TreeViewer from eclipse plugin

I am creating a eclipse plugin which requires TreeViewer to be dynamically updated when domain object changes. 我正在创建一个eclipse插件,要求域对象更改时动态更新TreeViewer。

I have found one article from eclipse site 我在Eclipse网站上找到了一篇文章

http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm?PHPSESSID=4d48764999a9cb66a7fd58a954ef2131 http://www.eclipse.org/articles/Article-TreeViewer/TreeViewerArticle.htm?PHPSESSID=4d48764999a9cb66a7fd58a954ef2131

This article mentions below code to register for domain object changes 本文提到以下代码来注册域对象更改

/** Because the domain model does not have a richer
 * listener model, recursively add this listener
 * to each child box of the given box. */
protected void addListenerTo(MovingBox box) {
    box.addListener(this);
    for (Iterator iterator = box.getBoxes().iterator(); iterator.hasNext();) {
       MovingBox aBox = (MovingBox) iterator.next();
       addListenerTo(aBox);
    }
}

It mentions addListener method of MovingBox which is supposedly the domain object in this case. 它提到了MovingBox addListener方法,在这种情况下,它应该是域对象。 The article does not provide any code samples for MovingBox implementation. 本文没有提供任何用于MovingBox实现的代码示例。 I am facing lot of difficulty in understanding where addListener method came from? 我在理解addListener方法的来源时遇到了很多困难?

I have searched a lot on web to find any working example of Treeview which can get dynamically updated on domain changes. 我在网上进行了大量搜索,以找到任何可以正常更新域更改的Treeview示例。 Not sure if I am searching for right thing. 不知道我是否在寻找正确的东西。 Can someone please help me regarding the same? 有人可以帮我吗?

All the source code for this TreeViewer example is available in the link given in the 'Source Code' section at the start of the article. 本文开头的“源代码”部分中提供的链接中提供了此TreeViewer示例的所有源代码。

The link is http://www.eclipse.org/articles/Article-TreeViewer/cbg.article.treeviewer.zip 链接为http://www.eclipse.org/articles/Article-TreeViewer/cbg.article.treeviewer.zip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM