`
lizhensan
  • 浏览: 370453 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

自定义 RCP PropertySheet

阅读更多

首先 我们先说一下 property tabbed 的实现。
我们可以通过三个扩展点 来实现 属性的多页码显示。


1:propertyContributor
   <extension
        point="org.eclipse.ui.views.properties.tabbed.propertyContributor">
      <propertyContributor
            contributorId="gef.propertyContributor1">
         <propertyCategory
               category="gef.category">
         </propertyCategory>
      </propertyContributor>
   </extension>

2:propertyTabs
   <extension
         point="org.eclipse.ui.views.properties.tabbed.propertyTabs">
      <propertyTabs
            contributorId="gef.propertyContributor1">
         <propertyTab
               category="gef.category"
               id="gef.propertyTab1"
               label="aa">
         </propertyTab>
      </propertyTabs>
   </extension>

3:propertySections
   <extension
         point="org.eclipse.ui.views.properties.tabbed.propertySections">
      <propertySections
            contributorId="gef.propertyContributor1">
         <propertySection
               class="gef.model.property.session.ModelPropertSection"
               filter="gef.model.property.filter.ModelFilter"
               id="gef.propertySection1"
               tab="gef.propertyTab1">
            <input
                  type="org.eclipse.gef.editparts.AbstractEditPart">
            </input>
         </propertySection>
      </propertySections>
   </extension>

在实现 分页中有一点非常重要,需要在你part 添加:
public Object getAdapter(Class type) {

if (type == IPropertySheetPage.class) {

return new TabbedPropertySheetPage(this);
}
return super.getAdapter(type);
}

这一点非常重要,千万别忘了。  并且代码中的 Contributord 一定要与 plugin.xml中的一致。



现在 通过三个扩展 就可以实现 属性分页的功能了。

如何属性的页面中,定制自己的节目呢?
下面我们就需要研究下面两个类了。

这个是标准的 key  value 的展现形式。
org.eclipse.ui.views.properties.tabbed.AdvancedPropertySection;
我们可以参考上面的代码,扩展下面的类,来实现自己的属性界面。
org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
分享到:
评论
1 楼 jjxliu306 2011-12-01  
可以详细点不 或者贴个DEMO上来

相关推荐

Global site tag (gtag.js) - Google Analytics