Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Adding a PopupMenu item to Java source folders
Adding a PopupMenu item to Java source folders [message #685593] Fri, 17 June 2011 20:23 Go to next message
Mat DeLong is currently offline Mat DeLongFriend
Messages: 3
Registered: June 2011
Junior Member
First off... sorry if I am posting this in the incorrect area. I looked around and this seemed correct.

Also, I've researched this and can't find any articles, tutorials, threads, etc which explain how to do this... so if I'm posting a common question, I did my best to prevent that.

What I want to do is create a plugin which adds an action in the context menu of source folders of java projects. Furthermore, I want this item to only be visible if the project is of a specific nature (I know the nature ID.)

I've tried creating a new plugin project and using the wizard made a new popupMenu plugin. From this base I was able to add a popup menu to all IFile (files) in all projects. I couldn't find the ObjectClass for source folders. I was also not sure how to show or hide the context menu item (I could only enable/disable it) but I didn't spend too much time yet looking into that, since I couldn't even get the menu item on the correct node.

I tried IFolder, thinking I might be able to write code to maybe check the classpath or something to see if the folder being passed in was a source folder... but it seems that source folders don't get triggered from IFolder. A regular folder triggered my extension (menu item showed up), but a source folder did not.

Also, out of desperation I tried IProject. When testing in the secondary IDE that you can launch from the manifest it seemed to work.. .but then when deploying the plugin into my development IDE, the menu item only showed up for closed projects... not any open projects. Weird.

Any help is greatly appreciated. I know what I am trying to do is probably dead simple, but the solution is escaping me.

Thanks,

Mat

Re: Adding a PopupMenu item to Java source folders [message #686204 is a reply to message #685593] Tue, 21 June 2011 20:26 Go to previous messageGo to next message
Michael Pellaton is currently offline Michael PellatonFriend
Messages: 289
Registered: July 2009
Senior Member
Hi

First, I don't have the answer, but I have advice on how to possibly find out.

There are some actions in the 'Build Path' sub menu of the package explorer that do what you want to do. The idea is to look at that code. To quickly and easily find the source, you may use the plugin menu-spy [1][2]

[1] http://scratsh.wordpress.com/2009/06/09/eclipse-3-5-plug-in-spy-and-menus/
[2] http://www.vogella.de/articles/EclipseCodeAccess/article.html

HTH
Michael
Re: Adding a PopupMenu item to Java source folders [message #686311 is a reply to message #686204] Wed, 22 June 2011 02:19 Go to previous messageGo to next message
Mat DeLong is currently offline Mat DeLongFriend
Messages: 3
Registered: June 2011
Junior Member
Thanks! plug-in spy is amazing (although, a bit buggy.) I can't believe I didn't know about it. I've solved my problem and am on to my next one, now.
Re: Adding a PopupMenu item to Java source folders [message #686417 is a reply to message #686311] Wed, 22 June 2011 07:50 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 22.06.2011 04:19, Mat wrote:
> Thanks! plug-in spy is amazing (although, a bit buggy.)
Please file bugs if you haven't already done so.

Dani
Re: Adding a PopupMenu item to Java source folders [message #777234 is a reply to message #686417] Tue, 10 January 2012 05:07 Go to previous message
shreyas k is currently offline shreyas kFriend
Messages: 7
Registered: January 2012
Junior Member
guys m a newbee to eclipse..

the problem m facing is...(and is with respect to PLUGINS(popupmenu template))
i have created a popupmenu-item (in the project explorer view) which is visible for all files except for C-files. i think there's a problem with the 'objectClass' of the objectContribution-attribute under 'org.eclipse.ui.popupMenus'-Extension.
please will anyone help me out with this...??

Thanks,

shreyas

[Updated on: Tue, 10 January 2012 07:47]

Report message to a moderator

Previous Topic:Visually Graph Heap - New JDT Plugin Beta Release
Next Topic:Erratic CPU Use in Eclipse Indigo
Goto Forum:
  


Current Time: Fri Apr 26 11:44:24 GMT 2024

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

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

Back to the top