Search code examples
javaeclipse-plugineclipse-rcpplugin.xml

Eclipse RCP- Property Page for folders only


I am trying to create a property page using plugin.xml. I want this property page to appear only when you right click -> properties of folders only.

I used this code:

<extension
   point="org.eclipse.ui.propertyPages">
    <page
          class="my.properties.page.class"
          id="my.properties.page.id"
          name="My Properties Page">
          <enabledWhen>
              <instanceof value="org.eclipse.core.resources.IFolder"/>
          </enabledWhen>
   </page>
</extension> 

This works when I open the properties from Navigator. But when opening it from Project Explorer, I can't see the properties page!

From Navigator:

enter image description here

From Project Explorer:

enter image description here

How can I make my properties page to be shown using Project explorer too?


Solution

  • Use:

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

    instead of instanceof.

    Most objects in views are not actually instances of files and folders. Instead they are some UI object which can be 'adapted' to a file or folder, the adapt element deals with this.