I have been wondering about the parameter properties
in the method TreeViewer#update(Object element, String[] properties)
. What are they? What do they refer to? I am not sure what goes into the String[]
- are there predefined constants to use? Or are these the names of my column headers? Something else?
我一直想知道方法TreeViewer #update(Object element,String [] properties)中的参数属性。这些是什么?他们指的是什么?我不确定String []中是什么 - 是否有预定义的常量可供使用?或者这些是我的列标题的名称?别的什么?
I couldn't find any example of the usage of update()
that doesn't have null
passed on to it as the value for properties
. The Javadoc isn't really helpful to me.
我找不到任何使用update()的例子,它没有将null作为属性值传递给它。 Javadoc对我没有多大帮助。
Thanks!
3 个解决方案
#1
This eclipse.org article explains in chapter 'Responding to change' what those properties are used for: You can fine tune if you want a complete update of the treeitem's label or just the label's text or the label's image. It does not go into detail on how the properties should look like. Her, I think, you have to study the source code directly, if javadocs are not sufficient.
这篇eclipse.org文章在“响应变化”一章中解释了这些属性的用途:如果您想要完全更新treeitem的标签或只是标签的文本或标签的图像,您可以进行微调。它没有详细介绍属性的外观。她认为,如果javadocs还不够,你必须直接研究源代码。
#2
They are conveniences for the viewer's label provider to let it know what properties of the model changed. If the property that changed doesn't affect the display of the item in the view, then the provider can elect to not do anything by implementing the isLabelProperty() method to only return true when an interesting property changes.
它们是观众标签提供者的便利,让他们知道模型的哪些属性发生了变化。如果更改的属性不影响视图中项目的显示,则提供程序可以通过实现isLabelProperty()方法选择不执行任何操作,仅在有趣的属性更改时返回true。
If there are no logical properties on the item that changed to trigger the update call, then just pass null or an empty array.
如果项目上没有更改为触发更新调用的逻辑属性,则只传递null或空数组。
#3
TreeViewer is a "enhanced" version of the SWT class Tree. So I guess, the property here should refer to the property stored in the TreeItem (which can be set by calling setData(String, Object).
TreeViewer是SWT类树的“增强版”。所以我猜,这里的属性应该引用存储在TreeItem中的属性(可以通过调用setData(String,Object)来设置)。
#1
This eclipse.org article explains in chapter 'Responding to change' what those properties are used for: You can fine tune if you want a complete update of the treeitem's label or just the label's text or the label's image. It does not go into detail on how the properties should look like. Her, I think, you have to study the source code directly, if javadocs are not sufficient.
这篇eclipse.org文章在“响应变化”一章中解释了这些属性的用途:如果您想要完全更新treeitem的标签或只是标签的文本或标签的图像,您可以进行微调。它没有详细介绍属性的外观。她认为,如果javadocs还不够,你必须直接研究源代码。
#2
They are conveniences for the viewer's label provider to let it know what properties of the model changed. If the property that changed doesn't affect the display of the item in the view, then the provider can elect to not do anything by implementing the isLabelProperty() method to only return true when an interesting property changes.
它们是观众标签提供者的便利,让他们知道模型的哪些属性发生了变化。如果更改的属性不影响视图中项目的显示,则提供程序可以通过实现isLabelProperty()方法选择不执行任何操作,仅在有趣的属性更改时返回true。
If there are no logical properties on the item that changed to trigger the update call, then just pass null or an empty array.
如果项目上没有更改为触发更新调用的逻辑属性,则只传递null或空数组。
#3
TreeViewer is a "enhanced" version of the SWT class Tree. So I guess, the property here should refer to the property stored in the TreeItem (which can be set by calling setData(String, Object).
TreeViewer是SWT类树的“增强版”。所以我猜,这里的属性应该引用存储在TreeItem中的属性(可以通过调用setData(String,Object)来设置)。