Project specific preference page in Eclipse RCP application

大城市里の小女人 提交于 2019-12-04 17:39:01

You will need to subclass PropertiesPage and then put a reference to it in your plugin.xml like this for example. This uses two different properties pages, one that is shown when a project is select, the other for a file. And they are both only present in the projects with the specified project nature.

<extension point="org.eclipse.ui.propertyPages">
    <page
        class="com.oaklandsw.transform.editor.TransformProjectPropertiesPage"
    id="com.oaklandsw.transform.filePropPage"
    name="%appHandle">
    <enabledWhen>
    <and>
            <instanceof
             value="org.eclipse.core.resources.IProject">
        </instanceof>
            <adapt type="org.eclipse.core.resources.IResource" >
                <test
                 property="org.eclipse.core.resources.projectNature"
                value="com.oaklandsw.transform.runtime.nature">
                </test>
            </adapt>   
    </and>
    </enabledWhen>
    </page> 
    <page class="com.oaklandsw.transform.editor.TransformFilePropertiesPage"
        id="com.oaklandsw.transform.projectPropPage" name="%appHandle">
        <enabledWhen>
            <and>
        <instanceof
            value="org.eclipse.core.resources.IFile">
        </instanceof>
            <adapt type="org.eclipse.core.resources.IResource" >
                <test property="org.eclipse.core.resources.projectNature"
                    value="com.oaklandsw.transform.runtime.nature" />
            </adapt>        
            </and>
        </enabledWhen>
    </page>
</extension>
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!