Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 239
RK Coder Avatar asked Jan 12 '16 10:01

RK Coder


1 Answers

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.

like image 176
greg-449 Avatar answered Oct 04 '22 21:10

greg-449