Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Slim down Eclipse context menus

I have several plugins (Apatana, SVN, Pydev, Zend Debugger, PHP) installed in my Eclipse 3.5.2 (Ubuntu 10.10) installation. The one problem that keeps bugging me since I first used Eclipse years ago is, that each plugin puts new entries into the context menus.

Unfortunately, it seems that the various perspectives are not able to determine, what menu entries are useless. So while programming PHP the menus are full of java and pydev stuff, I really have no use for!

The more plugins are installed the messier the menus get. It seems a bit odd, that such a rich IDE doesn't have support for context sensitive "context" menus ... :-(

My hope is, that somewhere out there on the internet, someone knows how to remove unused menu entries, or even has created a small plugin for that??

Any ideas?

Screenshot: http://i.stack.imgur.com/D9HjN.png

like image 633
mojo2012 Avatar asked Jan 26 '11 14:01

mojo2012


2 Answers

Eclipse provides "capabilities" as a functionality for the plugin developpers to provide a way to the users to disable the features and UI contributions of their plugins. I don't really know if that feature will help in your case (that is : if the plugins contributing the menu entries that bother you have defined the necessary capability to disable them).

If you go to Window > Preferences, then General > Capabilities, you can see a number of "capabilities" categories to enable or disable. I don't recommend disabling the categories themselves (for example "development") as you would disable all of Ant, Java, Python... menus and extension at once. Rather, use the "Advanced..." menu at the bottom of this page to see not only the categories, but also what they contain. There, under "Development", you should be able to disable "java development" (JDT) extensions and menus, "Ant Development" (remember that "Run Ant Tool" button that is visible on all perspectives beside the "Run" button? That would remove it)... You should be able to disable most of the clutter with this.

Note that if the provided capabilities are not sufficient, you can create your own very easily, allowing you to disable even the contributions from other plugins. For this the steps are simple :

  1. Use the File > New > Other... menu item
  2. Select Plug-in Project and name the new project as you desire, click Finish
  3. In the editor that has opened, select the "Extensions" tab
  4. Click Add, untick "Show only extensions points from the required plug-ins"
  5. search for the extension point org.eclipse.ui.activities, select it, and hit Finish
  6. Right click the item org.eclipse.ui.activities on the left and select New > Activity
  7. enter the id of your new activity on the right of the page, for example my.disable.activity.id. Enter a human-readable name below it; for example "disable JDT".
  8. Right click the item org.eclipse.ui.activities on the left and select New > activityPatternBinding.
  9. re-enter your activity Id (my.disable.activity.id) in the "activityId" field, then enter the "pattern" of the contributions you wish to disable. This is a regex. In order to disable all "JDT" (java development) contributions, enter org\.eclipse\.jdt\..*
  10. Right click the item org.eclipse.ui.activities on the left and select New > categoryActivityBinding
  11. re-enter your activity Id (my.disable.activity.id) in the "activityId" field once again; then click Browse... at the right of the "categoryId" field. Double click the org.eclipse.categories.developmentCategory so that it appears in the preference menu for capability enablement.

Now, if you export this plugin (I won't detail the update site creation here, you should be able to adapt the explanation from Stephane Begaudeau's blog), all menus from the JDT will be disabled (I tested this, so I know it at least disables those I checked (the "source" and "refactor" menus from a right-click on a Java file). As you specified a category, you can re-enable these menu items from the capabilities preference page I hinted at in the beginning of this answer.

like image 129
Kellindil Avatar answered Nov 14 '22 01:11

Kellindil


Not really a solution for your problem, but worth mentioning anyway: Eclipse does support the context sensitive menus, but in a way where the plug-in developer defines the contexts where the menu entries should be displayed. Unfortunately many developers don't care and say "Make it visible everywhere". The solution then is to complain loudly to them.

like image 33
Matthias Kempka Avatar answered Nov 14 '22 01:11

Matthias Kempka