quaylar
quaylar

Reputation: 2635

Eclipse-RCP: View pulldown-menu

I would like to add Command's to a View's pulldown-menu (the triangle-shaped button in the upper right corner that the "Problems"-View in Eclipse also has). Can anyone point me in the right direction how to do this declaratively in plugin.xml?

I found a tutorial that used a viewContribution (extension point org.eclipse.ui.viewActions), but unfortunately using this extension point i can only add Action's to this menu.

The functionality i wish is actually quite similar to the Problems-View (Showing Compiler-Errors and -Warnings in Eclipse):

I want to filter records within my View according to an Entry chosen in the pulldown-menu of the View.

Upvotes: 0

Views: 1074

Answers (1)

Urbi
Urbi

Reputation: 121

For an example configuration you can use the implementation of the Problem View itself. It uses the org.eclipse.ui.menus extension point to contribute that menuItem through a dynamic contributor. You can check the details in the plugin.xml of the org.eclipse.ui.ide plugin. Look for the usage of the class org.eclipse.ui.internal.views.markers.FiltersContribution. In its "getContributionItems()" method it returns menu contributions dynamically each time the menu is to appear. Of course, doing it this way is not exactly declarative. For that try reading the guide at http://help.eclipse.org/indigo/topic/org.eclipse.platform.doc.isv/guide/workbench_cmd_menus.htm (you should use your command instead of the global ones, of course)

Hope it helps!

Upvotes: 3

Related Questions