Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Adding PropertyPage to Project Resources(Trouble identifying projects in workspace.)
Adding PropertyPage to Project Resources [message #1016488] Wed, 06 March 2013 16:29 Go to next message
John VanAntwerp is currently offline John VanAntwerpFriend
Messages: 1
Registered: March 2013
Junior Member
I am writing a plug-in that needs to have a new property page for all the projects int he workspace. All the documentation I can find says that you should look for resources implementing the IProject workspace and so I write my extension as:

<extension
         point="org.eclipse.ui.propertyPages">
      <page
            class="sf.icp.eclipse.plugins.myplugin.properties.MyPluginPropertyPage"
            id="sf.icp.eclipse.plugins.myplugin.properties.MyPluginPropertyPage"
            name="My Eclipse Plugin">
         <enabledWhen>
	            <instanceof
	                  value="org.eclipse.core.resources.IProject">
	            </instanceof>
         </enabledWhen>
      </page>
</extension>


However, it appears that Java projects (and Java-related projects) implement the org.eclipse.jdt.core.IJavaProject interface which is outside the IProject inheritance tree. I can get the property page to attach to Java projects (although not consistently for some reason) by changing the <enabledWhen> to:

         <enabledWhen>
         	<or>
	            <instanceof
	                  value="org.eclipse.core.resources.IProject">
	            </instanceof>
	            <instanceof
	                  value="org.eclipse.jdt.core.IJavaProject">
	            </instanceof>
            </or>
         </enabledWhen>


but there are still processing issues when I am assuming the resources are IProjects.

So I have some questions:

Is there a common ancestor for all project types that I can base my plug-in code on or do I have to check for and handle both project types separately?

Are IJavaProject and IProject the only two I need to worry about or are there others?

How is this usually handled? I've searched the forums and documentation for a couple of days and haven't found any answers.


Thanks!
- John
Re: Adding PropertyPage to Project Resources [message #1019765 is a reply to message #1016488] Sat, 16 March 2013 15:56 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33108
Registered: July 2009
Senior Member
John,

Being a Java project is more about being an IProject that has a Java
nature. There is no hierarchy for IProject that's meaningful, because
it's not intended to b subclass outside the resource framework's
implementation. I think there's some kind of has nature test you can do
in these expressions...


On 07/03/2013 2:45 AM, John VanAntwerp wrote:
> I am writing a plug-in that needs to have a new property page for all
> the projects int he workspace. All the documentation I can find says
> that you should look for resources implementing the IProject workspace
> and so I write my extension as:
>
> <extension
> point="org.eclipse.ui.propertyPages">
> <page
> class="sf.icp.eclipse.plugins.myplugin.properties.MyPluginPropertyPage"
> id="sf.icp.eclipse.plugins.myplugin.properties.MyPluginPropertyPage"
> name="My Eclipse Plugin">
> <enabledWhen>
> <instanceof
> value="org.eclipse.core.resources.IProject">
> </instanceof>
> </enabledWhen>
> </page>
> </extension>
>
> However, it appears that Java projects (and Java-related projects)
> implement the org.eclipse.jdt.core.IJavaProject interface which is
> outside the IProject inheritance tree. I can get the property page to
> attach to Java projects (although not consistently for some reason) by
> changing the <enabledWhen> to:
>
> <enabledWhen>
> <or>
> <instanceof
> value="org.eclipse.core.resources.IProject">
> </instanceof>
> <instanceof
> value="org.eclipse.jdt.core.IJavaProject">
> </instanceof>
> </or>
> </enabledWhen>
>
> but there are still processing issues when I am assuming the resources
> are IProjects.
>
> So I have some questions:
>
> Is there a common ancestor for all project types that I can base my
> plug-in code on or do I have to check for and handle both project
> types separately?
>
> Are IJavaProject and IProject the only two I need to worry about or
> are there others?
>
> How is this usually handled? I've searched the forums and
> documentation for a couple of days and haven't found any answers.
>
>
> Thanks!
> - John


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:Platform coverage for eclipse Juno SR2
Next Topic:Support for developing WinCE application by using Eclipse IDE
Goto Forum:
  


Current Time: Tue Mar 19 11:06:25 GMT 2024

Powered by FUDForum. Page generated in 0.01673 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top