When using the objectContribution
-element (which is part of the org.eclipse.ui.popupMenus
-extension point), I often (practically always) want to delegate to some command instead of implementing some action myself (since usually, I have the command and a handler already implemented). I'm doing this by using ICommandService
and IHandlerService
, but it feels there should be a way to achieve this programmatically. I could use viewerContribution
instead of objectContribution
, but then I would lose the easy way of showing the menu entry only when certain object types are selected. Ideally, I would like to use the enablement-checks that already exist for my handlers to apply to the menu entry defined by the objectContribution
.
相关问题
- Eclipse and Mylyn : how to disable grey files in t
- Installing Pydev for Eclipse throws error
- Error in Scala Compiler: java.lang.AssertionError:
- How to remove unused imports using Eclipse and not
- Assume/switch role in aws toolkit for eclipse 2.0
相关文章
- selenium+eclipse 打开网页时报错
- Eclipse failing to open
- Eclipse how can I indent C++ preprocessor macros
- Why is FindBugs ignoring my check for null?
- Eclipse cleanup - what are the “.index” files - ca
- Eclipse plugin to find out unused methods in a cla
- Spring NamespaceHandler issue when launching Maven
- Google USB Package isn't showing in SDK Manang
Ok, here's what I was missing: instead of using the
org.eclipse.ui.popupMenus
-extension point, I had to use theorg.eclipse.ui.menus
-extension point with amenuContribution
that has itslocationURI
-attribute pointing topopup:org.eclipse.ui.popup.any?after=additions
. ThismenuContribution
can include acommand
-element (achieving the goal of binding directly to an existing command), and thiscommand
-element´svisibleWhen
-element can be bound to the activation status of the bound command's handler via thecheckEnabled
-attribute (achieving the goal of having the popup-menu entry visible only when the enablement for the command handler is satisfied).What's bad is that the documentation of the
org.eclipse.ui.menus
-extension point states that theorg.eclipse.ui.popupMenus
-extension point is to be considered deprecated, but the documentation oforg.eclipse.ui.popupMenus
does not mention this fact.