Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » core expressions: Find a resource's project, check project natures
core expressions: Find a resource's project, check project natures [message #546615] Tue, 13 July 2010 14:47 Go to next message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Dear all,

I'd like to effect the visibility of some commands depending on whether
the selected resources (e.g. in the package explorer) are contained in a
project with specific natures.

Therefore, I need to determine a selected resource's IProject - is this
possible using core expressions?

Furthermore, there is a projectNatures tester available that is supposed
to return a list of project natures. Can I - again using expressions -
check whether a specific nature ID is contained in that list?

Tx in advance,
Erhard
Re: core expressions: Find a resource's project, check project natures [message #546670 is a reply to message #546615] Tue, 13 July 2010 17:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

There is a property tester that can test an IResource to find out a
project nature in the containing project:

http://wiki.eclipse.org/Command_Core_Expressions#Property_Te sters

Depending on what you are doing, though, your expression would probably
look like:

<iterate ifEmpty="false">
<adapt type="org.eclipse.core.resources.IResource">
<test .... />
</adapt>
</iterate>

as the selection from the package explorer is either a Collection
(default variable) or an IStructuredSelection (with variable="selection"
or variable="activeMenuSelection")

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: core expressions: Find a resource's project, check project natures [message #546867 is a reply to message #546670] Wed, 14 July 2010 12:33 Go to previous message
Erhard Weinell is currently offline Erhard WeinellFriend
Messages: 39
Registered: January 2010
Location: Kassel, Germany
Member
Am 13.07.2010 19:30, schrieb Paul Webster:

> Depending on what you are doing, though, your expression would probably
> look like:
>
> <iterate ifEmpty="false">
> <adapt type="org.eclipse.core.resources.IResource">

I was missing the adapt-part. Works well this way, tx!

Erhard
Previous Topic:Eclipse RCP license control solution issues
Next Topic:Problem with building referenced projects on Helios
Goto Forum:
  


Current Time: Tue Apr 23 13:43:08 GMT 2024

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

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

Back to the top