首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

rcp PropertySheet 的施用

2012-11-04 
rcpPropertySheet的使用PropertySheet 在rcp中引用还是很广泛的,如何gef中,或者数据编辑中。 使用PropertyS

rcp PropertySheet 的使用
PropertySheet 在rcp中引用还是很广泛的,如何gef中,或者数据编辑中。


使用PropertySheet  需要设计到一个很重要类
IPropertySource 这里是个标准的属性源,以键值的形式显示。

我们可以在任何地方,任何事件中显示  属性。
代码如下:
//现实一般模型的属性
public static void showPropertyInPropertySheet(IAdaptable model)
{
PropertySheet property = getPropertySheet();
IPropertySource  source= (IPropertySource) model.getAdapter(IPropertySource.class);
//IPropertySourceProvider  sourceProvider= (IPropertySource) model.getAdapter(IPropertySourceProvider.class);
if(source!=null)
{

//将选择的对象 加载到 属性面板中,有属性源 动态的创建具体的属性内容
StructuredSelection sel=new StructuredSelection(model);
property.selectionChanged(getActivePart(), sel);
}
else
{
LogUtil.log("error:showPropertyInPropertySheet   model   格式不正确。");
}
}


showPropertyInPropertySheet  方法的参数必须实现 IPropertySource 来实现对应的属性源。

下篇 说一下  带 tabbed 页的属性 ,还有在属性页中 随意的定制界面,有些需要以键值的形式是满足不了需求的。

热点排行