添加属性页面

可以通过使用 org.eclipse.ui.propertyPages 扩展点来为对象添加属性页面。对象的属性页面是通过使用显示对象的任何视图(例如,资源导航器视图)中的属性菜单来调用的。选择单个对象时,此菜单就可用。 

自述文件工具添加了两个属性页面。

<extension
      point = "org.eclipse.ui.propertyPages">
         <page
         id="org.eclipse.ui.examples.readmetool.FilePage"
           name="%PropertiesPage.filePage"
 	   objectClass="org.eclipse.core.resources.IFile"
	   class="org.eclipse.ui.examples.readmetool.ReadmeFilePropertyPage"
         nameFilter="*.readme">
         </page>
         <page
            id="org.eclipse.ui.examples.readmetool.FilePage2"
            name="%PropertiesPage.filePage2"
 	   objectClass="org.eclipse.core.resources.IFile"
 	   class="org.eclipse.ui.examples.readmetool.ReadmeFilePropertyPage2"
         nameFilter="*.readme">
         </page>
</extension>   

当定义属性页面时,指定 objectClass(对于它来说,此页面是有效的)。当显示属性时,此类的对象将包括您的页面。(可选)可以提供用来进一步优化类的 nameFilter。在自述文件工具示例中,这两个页面都是为类型为 IFile,文件扩展名为 .readme 的对象而添加的。

属性页面并不限于工作台资源。显示在工作台中的所有对象(甚至是由其它插件创建的特定于域的对象)都可能具有属性页面。任何插件都可以为任何对象类型注册属性页面。

除了没有属性页面的层次结构或分类之外,属性页面看起来很象首选项页面。在下面的对话框中,自述文件属性页面都出现在页面的主列表中。

具有自述文件条目的属性对话框