How to implement a property page to an eclipse project

女生的网名这么多〃 提交于 2019-12-11 03:11:55

问题


Here is the deal. I create a project in eclipse rcp programmatically. Then i add some persistant properties to it. Now i want to right click on the project in the project explorer view and then click on the properties tab. There should be my property page. Here is what i have:

<extension
         point="org.eclipse.ui.propertyPages">
      <page
            adaptable="false"
            class="bg.bulsi.rcp.first.properties.SamplePropertyPage"
            id="bg.bulsi.rcp.first.properties.samplePropertyPage"
            name="Sample Page"
            nameFilter="*.*"
            objectClass="org.eclipse.core.resources.IProject"
            selectionFilter="single">
         <enabledWhen>
            <instanceof
                  value="org.eclipse.core.resources.IProject">
            </instanceof>
         </enabledWhen>
      </page>
   </extension>

why doesnt this page show up in the properties of the project?


回答1:


Try removing the "nameFilter" attribute from the page tag. Unless you have a dot in your project name, that is probably what is preventing your properties page from showing up.




回答2:


Remove the nameFilter="*.*" and use

<adapt type="org.eclipse.core.resources.IProject"> </adapt>

instead of <instanceof ...></instanceof>

(btw. options objectCalss and adaptable are deprecated)

Completely fixed:

<extension point="org.eclipse.ui.propertyPages">
    <page
        class="bg.bulsi.rcp.first.properties.SamplePropertyPage"
        id="bg.bulsi.rcp.first.properties.samplePropertyPage"
        name="Sample Page"
        selectionFilter="single">
        <enabledWhen>
            <adapt type="org.eclipse.core.resources.IProject">
            </adapt>
        </enabledWhen>
    </page>
</extension>


来源:https://stackoverflow.com/questions/11409952/how-to-implement-a-property-page-to-an-eclipse-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!