1

我正在尝试创建 Eclipse 插件应用程序,其中在 treeViewer 中选择节点时在 Eclipse 属性视图中显示相应的值。我已经实现了覆盖IPropertySource接口的类,如下所示:

public class PropertyViewer implements IPropertySource
{
@Override
public Object getEditableValue() 
{
    return this;
}

@Override
public IPropertyDescriptor[] getPropertyDescriptors() {
    return desc;
}

@Override
public Object getPropertyValue(Object id) {
    application specific logic yo return value for a id
}

@Override
public boolean isPropertySet(Object id) {
    return true;
}

@Override
public void resetPropertyValue(Object id) {

}

@Override
public void setPropertyValue(Object id, Object value) {
    //to set vlaue for a changed property in eclipse property view
}}

现在,上面代码的问题setPropertyValue是在 eclipse 属性上完成更新时正确调用了 。但更新后的属性未显示在输入时的 eclipse 属性视图中。但是当我再次取消选择并选择此节点时,它会显示更新的值。我用谷歌搜索了很多,得到了firePropertyChange必须在setpropertyValue函数下调用的方法。任何人都可以帮助我,因为我对此一点也不熟悉。一个显示如何调用 fireproperty 更改的小代码片段将很有帮助。提前非常感谢。托尔

4

0 回答 0