Community
Participate
Working Groups
For CDT projects, folders in the project explorer are CContainer (ICContainer) objects rather than Folder (IFolder) objects. CContainer objects do not have the org.eclipse.core.resources.projectNature property. Thus, it is not possible to populate the context menu (right click on the folder) with items that should only appear for certain project types. For Navigator and other file viewers, this can be done with the org.eclipse.ui.menus extension point using, for example: (menuContribution) -> (menu) -> (visibleWhen) -> (test) Specifically, this functionality is needed by PTP synchronized projects to activate the "Synchronization" context menu for folders in a synchronized project.
CContainer doesn't have to have the projectNature property itself, it just has to be adaptable to IFolder.
This bug applies to all ICElement objects representing files and folders. I changed the title accordingly. Such objects are adaptable to IResource, so it is simple to find the project nature. Specifically, use the "adapt" option for the org.eclipse.ui.menus extension point and adapt it to org.eclipse.core.resources.IResource prior to testing the project nature. You can also use the IAdaptable interface to adapt an element in code. Since there is a reasonable and simple solution to this problem, I'll mark this bug as "Resolved" and "Invalid".