Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 234351

Summary: Extention Point objectClass inconsistent
Product: [Eclipse Project] Platform Reporter: T Kruse <thibault.kruse>
Component: UIAssignee: Platform-UI-Inbox <Platform-UI-Inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public, pwebster, remy.suen
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description T Kruse CLA 2008-05-28 09:03:00 EDT
Build ID: M20080221-1800

Steps To Reproduce:
Hi, this is really weird, I guess it is 3 bugs at least in one, I will try to explain. Not sure whether this is all PDE problems or JDT problem as well

1. Start Eclipse, new workspace
2. Create new Plugin-project, all default values
3. choose plugin-template "... with property page".
Should look like this in plugin.xml:
   <extension
         point="org.eclipse.ui.propertyPages">
      <page
            objectClass="org.eclipse.core.resources.IFile"
            name="Sample Page"
            nameFilter="*.*"
            class="test3.properties.SamplePropertyPage"
            id="test3.properties.samplePropertyPage">
      </page>
   </extension>
3b. (Note this plugin.xml contains a deprecation warning, which also would be nice to be removed for new versions of eclipse)
4. Run as Eclipse platform
5. In target workspace create simple project "test" and file "test.txt" for testing

This should show a "Sample Page" page for Files
So far so good.

6. Close the runtime workspace. 
6b. remove nameFilter attribute "*.*"
In the plugin.xml, change objectclass from
IFile to IProject:
<extension
         point="org.eclipse.ui.propertyPages">
      <page
            objectClass="org.eclipse.core.resources.IProject"
            name="Sample Page"
            class="test3.properties.SamplePropertyPage"
            id="test3.properties.samplePropertyPage">
      </page>
   </extension>

7. Run
8. The sample page appears when you select main menu, projects, properties
9. The sample page appears when you select the project in Navigator view, right-click, choose Properties
10. BUT: The page does not appear if you select the project in the "Package Explorer" View and right click

11. shut down runtime workspace again

12. change the plugin.xml by adding nameFilter attribute = "*.*"
   <extension
         point="org.eclipse.ui.propertyPages">
      <page
            adaptable="false"
            class="test2.properties.SamplePropertyPage"
            id="test2.properties.samplePropertyPage"
            name="Sample Page2"
            nameFilter="*.*"
objectClass="org.eclipse.core.resources.IProject">
      </page>
   </extension>

13. Run and test, The sample Page will not appear on any project from any view.


Also note the same seems to happen with the new way of specifying enablement:
<enabledWhen>
  <instanceof                value="org.eclipse.core.resources.IProject">
  </instanceof>
</enabledWhen>

And I tried the same with Eclipse 3.4M7, and the same happened.
Sorry for not making this into separate bugs, but my time is limited, and it cost me enough time to find that out.

More information:
Comment 1 Remy Suen CLA 2008-05-28 09:13:59 EDT
(In reply to comment #0)
> 10. BUT: The page does not appear if you select the project in the "Package
> Explorer" View and right click

As far as I know, the Package Explorer is showing IJavaProjects and not IProjects. IJavaProject does not extend IProject, so your plugin.xml definition will not work. Try setting 'adaptable="true"' instead.

> 13. Run and test, The sample Page will not appear on any project from any view.

Your sample project "test" does not have a period, so I don't think *.* will work.
Comment 2 Paul Webster CLA 2008-05-28 09:25:30 EDT
As Remy mentioned, you need adapt="true" for anything java related in the Package Explorer.

Also, if it is marked as deprecated, you probably shouldn't use it.  Or do you mean we should update the PDE template?

PW
Comment 3 T Kruse CLA 2008-05-28 09:39:35 EDT
I agree to the explanations, though the Package Explorer does show non Java Projects as IProjects, which made it confusing to me.
Well done spotting this with me having been sloppy of the steps reproducing.

So if your runtime workspace contains both Simple Projects and Java Projects, the Package Explorer will show both, but both won't be IProject n that view, while in the Navigator view they would both be IProjects.

I confirm adaptable="true" fixes this.

I agree "*.*" does not match a project name without dot, even though DOS conventions once were different I believe (not that I wished for DOS to be a standard)

Regarding the deprected stuff, I only used it because the template created that.

So yeah, why not at least change the template to use the non-deprected version, and remove that nameFilter from the template as it does not do any good for those starting with a wizard and then playing around.
Comment 4 Curtis Windatt CLA 2008-05-28 10:41:33 EDT
Created bug 234376 to update the template.