Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Display actions when a project has a certain file
Display actions when a project has a certain file [message #326087] Fri, 07 March 2008 08:59 Go to next message
leo escorido is currently offline leo escoridoFriend
Messages: 5
Registered: July 2009
Junior Member
Hi,

I was able to show/hide menus when a project has this certain nature.

(posting it in case someone will find this useful)
<extension point="org.eclipse.ui.popupMenus">
<objectContribution
adaptable="true"
id="menu"
objectClass="org.eclipse.core.resources.IProject">

<action
class="action.MyAction"
enablesFor="1"
id="action.MyAction"
label="My Action"
menubarPath="submenu/contents">
<enablement>
<objectState name="projectNature"
value="org.eclipse.jdt.core.javanature"/>
</enablement>
</action>
</objectContribution>
</extension>

I'd like to add another condition to display the menus, like if the
project has a pom file. I've read about propertyTester extension points
but i'm not sure how to and still reading about it. Aside from
propertyTester, is there other way of adding the condition?

Thanks
Re: Display actions when a project has a certain file [message #326122 is a reply to message #326087] Fri, 07 March 2008 13:38 Go to previous message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Your best bet is to have <something> create a persistent property on the
project when a pom file is created.

Then you can property test for the persistent property.

That works with property testers (objectClass/enablement) as well as the
IActionFilter based filtering (there should be some kind of named
property for it).

Later,
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/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Previous Topic:How to test internationalization plugin
Next Topic:Loading a non-properties files from a fragment into and editor
Goto Forum:
  


Current Time: Wed Jan 15 09:46:02 GMT 2025

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

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

Back to the top