How to implement a property page to an eclipse pro

2019-07-15 11:46发布

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?

2条回答
甜甜的少女心
2楼-- · 2019-07-15 12:27

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.

查看更多
时光不老,我们不散
3楼-- · 2019-07-15 12:28

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>
查看更多
登录 后发表回答