Summary: | [api][breaking] remove the dynamicPopupMenuExtensions extension point | ||
---|---|---|---|
Product: | [Tools] Target Management | Reporter: | Martin Oberhuber <mober.at+eclipse> |
Component: | RSE | Assignee: | Martin Oberhuber <mober.at+eclipse> |
Status: | RESOLVED FIXED | QA Contact: | Martin Oberhuber <mober.at+eclipse> |
Severity: | enhancement | ||
Priority: | P2 | Keywords: | api |
Version: | 1.0.1 | ||
Target Milestone: | 2.0 | ||
Hardware: | All | ||
OS: | All | ||
URL: | http://dsdp.eclipse.org/help/latest/topic/org.eclipse.rse.doc.isv/reference/extension-points/org_eclipse_rse_ui_dynamicPopupMenuExtensions.html | ||
Whiteboard: |
Description
Martin Oberhuber
2007-05-04 10:39:46 EDT
The are basically 2 set's of standard Eclipse extension points which can and should be used for dynamic contributions. - Up to Eclipse 3.2.x the extension points refering to the action framework are preferable: - org.eclipse.ui.actionSets - org.eclipse.ui.editorActions - org.eclipse.ui.popupMenus and - org.eclipse.ui.viewActions - From Eclipse 3.3, the extension points refering to the command/handler framework should be used for new contributions: - org.eclipse.ui.menus - org.eclipse.ui.handlers - org.eclipse.ui.bindings - org.eclipse.ui.commands and - org.eclipse.core.expressions.propertyTesters The more powerful and flexible system is the new command/handler framework. The direct replacements for the legacy RSE extension point "dynamicPopupMenuExtensions" will be either - org.eclipse.ui.popupMenus or - org.eclipse.ui.menus. Both extension points are providing control over the visibility of a item within the target menu. Again, 3.3 is offering the more advanced possibilities. Some examples for the more well-known extension point org.eclipse.ui.popupMenus. The key with that extension point is to know the id's of the groups and separators within the menu and which kind properties to test the corresponding IActionFilter implementation for the selected object type is supporting. A simple one: <extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="org.eclipse.rse.ui.view.systemView" id="com.windriver.ide.target.ui.rse.AttachHostShell"> <action class="com.windriver.ide.target.ui.actions.contrib.WRAttachHostShellAction" definitionId="com.windriver.ide.target.ui.actions.contrib.WRAttachHostShellAction.command" enablesFor="1" helpContextId="com.windriver.ide.target.ui.action_attach_hostshell" icon="icons/elcl16/attach_hostshell.gif" id="com.windriver.ide.target.ui.rse.actions.WRAttachHostShellAction" label="%WRAttachHostShellAction.label" menubarPath="TargetToolsMenu" style="push" tooltip="%WRAttachHostShellAction.tooltip"> </action> <visibility> <and> <objectState name="isWRConnection" value="true"/> <objectState name="adapt" value="com.windriver.ide.target.model.ITargetObjectTypeNode"> </objectState> </and> </visibility> </viewerContribution> </extension> A more complex one: <extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="org.eclipse.rse.ui.view.systemView" id="com.windriver.ide.target.ui.rse.RefreshContrib"> <action class="com.windriver.ide.target.ui.rse.internal.actions.WRRefreshAction" definitionId="org.eclipse.ui.file.refresh" helpContextId="com.windriver.ide.target.ui.action_refresh" icon="icons/elcl16/refresh.gif" id="refresh" label="%RefreshAction.label" menubarPath="group.build" tooltip="%RefreshAction.tooltip"> </action> <visibility> <and> <not> <objectClass name="com.windriver.ide.target.ui.rse.interfaces.IWRRegistrySubSystem"/> </not> <not> <objectState name="adapt" value="com.windriver.ide.target.model.ITargetManagerModel"> </objectState> </not> <or> <objectClass name="com.windriver.ide.target.ui.rse.interfaces.IWRHost"/> <objectClass name="com.windriver.ide.target.ui.rse.interfaces.IWRSubSystem"/> <objectState name="adapt" value="com.windriver.ide.target.api.model.IModelNode"> </objectState> </or> </and> </visibility> </viewerContribution> </extension> Translating that into an example contribution for the connect/disconnect action, it would look like: <extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="org.eclipse.rse.ui.view.systemView" id="org.eclipse.rse.ui.actions.connect"> <action class="org.eclipse.rse.internal.ui.actions.SystemConnectAllSubSystemsAction" id="connectAllSubSystemsAction" label="Connect" menubarPath="group.connection"> </action> <visibility> <and> <objectClass name="org.eclipse.rse.core.model.IHost"/> <objectState name="connected" value="false"/> </and> </visibility> </viewerContribution> <viewerContribution targetID="org.eclipse.rse.ui.view.systemView" id="org.eclipse.rse.ui.actions.disconnect"> <action class="org.eclipse.rse.internal.ui.actions.SystemDisconnectAllSubSystemsAction" id="disconnectAllSubSystemsAction" label="Disconnect" menubarPath="group.connection"> </action> <visibility> <and> <objectClass name="org.eclipse.rse.core.model.IHost"/> <objectState name="connected" value="true"/> </and> </visibility> </viewerContribution> </extension> Thanks a lot for all these examples, Uwe! When I'm not mistaken, all of these contribute single actions only. Do you also have an example contributing a whole submenu? And do you have an idea if it is possible to suppress any existing menu items contributed by someone else in some context? I'm not sure if these use cases are indeed in use at IBM, but I think that the dynamicPopupMenuExtensions extension point would support these. - Submenu contribution example: <extension point="org.eclipse.ui.popupMenus"> <viewerContribution targetID="org.eclipse.rse.ui.view.systemView" id="com.windriver.ide.target.ui.rse.TargetToolMenuContrib.vxWorks"> <menu label="%TargetToolsMenu.label" path="TargetToolsSubMenu" id="TargetToolsMenu"> <separator name="TargetTools"> </separator> <separator name="TargetToolsTargetConsole"> </separator> <separator name="TargetToolsHostShell"> </separator> </menu> <visibility> <and> <objectState value="true" name="isWRConnection"/> <objectState name="adapt" value="com.windriver.ide.target.api.model.IModelNode"> </objectState> </and> </visibility> </viewerContribution> </extension> - Standard actions/contributions can bee suppressed within any of the several add*Actions(...) API methods. The menu manager reference is always passed to this methods. Work completed, checkin comment: [185554][api] Remove dynamicPopupMenuExtensions extension point Removed interfaces, classes and methods: ---------------------------------------- ISystemDynamicPopupMenuExtensionManager SystemDynamicPopupMenuExtensionManager ISystemDynamicPopupMenuExtension RSEUIPlugin#registerDynamicPopupMenuExtensions() Updated ISV Docs; modified API docs in AbstractSystemViewAdapter#addDynamicPopupMenuActions() explaining that extenders can override this method in order to contribute dynamic popup menu extensions. Examples for how to migrate to using the standard Eclipse Platform extension point, as well as the RSE API hooks for contributing dynamic popup menu extensions are covered in the previous comments. For adding dynamic submenus, following Wiki page should help getting started: http://wiki.eclipse.org/Menu_Contributions/Problems_View_Example To get current context, evaluate current selection -- see Workbench.getSelectionService() get current active Part in workbench [target cleanup] 2.0 M7 was the original target milestone for this bug |