Possibility to disable standard UI elements
Using Eclipse Activities it is possible to disable certain UI elements such views, menu items etc. in the standard Product Manager. The following explains how the various UI elements can be disabled.
Activities
Eclipse Activities can be used to hide/display certain UI elements. We are already using activities in the standard Product Manager for example to disable unnecessary views, menu items and preference pages of the eclipse platform.
To learn more about Eclipse Activieties, read following sources:
General information
You can use activities to disable the most of the UI elements, assumed the corresponding UI contribution has the ID attribute. The element to disable should be clearly recognizable. This means that the ID of the UI contribution should be unique in the whole plugin. If there are more then one UI element with the same ID, all elements with this ID in the plugin will be disabled. The pattern attribute of the activityPatternBinding consists of the pluginID + contributionID, where the contributionID is the ID of the UI contribution to disable and the pluginID is the ID of the plugin where the UI element is contributed.
Views
To disable (hide) a specific standard view just add a new activities extension to you custom plugin and bind this activity with the view:
<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.views" name="Deactivate views"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.views" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.views.ArticleTableView"> </activityPatternBinding></extension> NOTE:
the disabled view does not appear in the "Open view..." dialog, but if you have any actions which open this view programmatically, you have to disable this actions too. See below how to disable menu items.
the disabled view is not removed from the client workspace, so if the view was already shown in the client before disabling, it will be still shown. In this case the old workspace should be deleted to ensure that the disabled view does not appear anymore.
Since PIM version 7.1.08 there is an alternative possibility to hide views and perspectives. See also the corresponding article: Frontend visibility
Perspectives
For disabling a whole perspective we have since the version 5.2 an extension point com.heiler.ppm.shared.ui.perspectiveAdditions. Please use this extension point for perspectives instead of activities.
<extension point="com.heiler.ppm.shared.ui.perspectiveAdditions"> <disablement perspective-id="com.heiler.ppm.structure.ui.perspectives.StructureEditorPerspective"> </disablement></extension> Menu items
With activities you can't disable commands or actions itslef, but the menu contributions for this commands and actions:
In the newer Eclipse versions there are known issues hiding menu items. See https://wiki.eclipse.org/Eclipse4/KnownIssues/4.1
So there can be issue with "
item is visible or enabled when it should not be". Please take that into account implementing your customization.
menuContribution -> command
<extension point="org.eclipse.ui.menus"> <menuContribution allPopups="false" locationURI="popup:com.heiler.ppm.article.ui.views.attribute.AccumulatedAttributeTableView?after=additions"> <command commandId="com.heiler.ppm.article.ui.command.attribute.deleteAcumulatedArticleAttribute" icon="icons/Delete.gif" id="com.heiler.ppm.article.ui.menu.attribute.deleteAcumulatedArticleAttribute" label="%action.deleteAttributes.name"> ... </command> ... </menuContribution></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.commands" name="Deactivate commands"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.commands" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.menu.attribute.deleteAcumulatedArticleAttribute"> </activityPatternBinding></extension>menuContribution -> dynamic
<extension point="org.eclipse.ui.menus"> <menuContribution allPopups="false" locationURI="popup:com.heiler.ppm.revision.ui.versioning.Submenu?before=additions"> <dynamic class="com.heiler.ppm.article.ui.internal.command.VersionArticlesOfStructureGroupContributionItem" id="com.heiler.ppm.article.ui.internal.command.VersionArticlesOfStructureGroupContributionItem"> ... </dynamic> </menuContribution></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.commands" name="Deactivate commands"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.commands" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.internal.command.VersionArticlesOfStructureGroupContributionItem"> </activityPatternBinding></extension>menuContribution -> menu
<extension point="org.eclipse.ui.menus"> <menuContribution allPopups="false" locationURI="popup:com.heiler.ppm.article.ui.views.attribute.AccumulatedAttributeTableView?after=additions"> <menu icon="icons/Delete.gif" id="com.heiler.ppm.article.ui.views.attribute.AccumulatedAttributeTableView.deleteAttributeMaps" label="%action.deleteAttributeMaps.name"> ... </menu> </menuContribution></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.commands" name="Deactivate commands"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.commands" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.views.attribute.AccumulatedAttributeTableView.deleteAttributeMaps"> </activityPatternBinding></extension>viewContribution -> action
<extension point="org.eclipse.ui.viewActions"> <viewContribution targetID="com.heiler.ppm.structure.ui.internal.views.structure.StructureView" id="com.heiler.ppm.article.ui.structureContribution"> <action class="com.heiler.ppm.article.ui.internal.contribution.NotEmptyGroupsFilterAction" icon="icons/StructureGroupFilter.gif" id="com.heiler.ppm.article.ui.structurecontribution.NotEmptyGroupsFilterAction" ... </action> </viewContribution></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.actions" name="Deactivate actions"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.actions" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.structurecontribution.NotEmptyGroupsFilterAction"> </activityPatternBinding></extension>objectContribution -> action
<extension point="org.eclipse.ui.popupMenus"> <objectContribution adaptable="true" id="com.heiler.ppm.article.ui.actions.StructurePopupMenu" objectClass="com.heiler.ppm.structure.core.internal.wrapper.StructureGroupWrapper"> <action class="com.heiler.ppm.article.ui.internal.popup.StructurePopupShowNotClassified" icon="icons/ShowItemsNotClassified.gif" id="com.heiler.ppm.article.ui.actions.StructurePopupMenu.submenu" ... </action> </viewContribution></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.actions" name="Deactivate actions"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.actions" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.actions.StructurePopupMenu.submenu"> </activityPatternBinding></extension>Preference pages
To disable (hide) a specific preference page just add a new activities extension to you custom plugin and bind this activity with the preference page:
<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.preferencePages" name="Deactivate preferencePages"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.preferencePages" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.preference.PreferencePageAttributes"> </activityPatternBinding></extension>Drop listeners
Using activities you can also disable UI elements which are contributed for our own extension points, for example dropListeners or drop-choices:
<extension point="com.heiler.ppm.std.ui.dropListeners"> <dropListener targetClass="org.eclipse.emf.ecore.sdo.EDataObject" id="com.heiler.ppm.article.ui.internal.transfer.attribute.ArticleAttributeStructureGroupAttributeDropListener" ...</extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.dropListeners" name="Deactivate dropListeners"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.dropListeners" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.internal.transfer.attribute.ArticleAttributeStructureGroupAttributeDropListener"> </activityPatternBinding></extension>NOTE: the id attribute of the dropListeners element is now mandatory, so you can use this id to disable a specific drop listener.
To deactivate a drop-choice element use its identifier attribute:
<extension point="com.heiler.ppm.std.ui.entityItemEditors"> <drop-choice class="com.heiler.ppm.article.ui.internal.transfer.ArticleStructureGroupDropChoice" identifier="com.heiler.ppm.article.ui.articleStructureGroupReference" ... </drop-choice></extension>...<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.dropChoice" name="Deactivate drop choices"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.dropChoice" pattern="com.heiler.ppm.article.ui/com.heiler.ppm.article.ui.articleStructureGroupReference"> </activityPatternBinding></extension>Status lines
You can also disable the default status line in the table views using activities:
<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.tableViewStatusLines" name="Deactivate tableViewStatusLines"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.tableViewStatusLines" pattern="com.heiler.ppm.std.ui/com.heiler.ppm.std.ui.table.statusline.defaultTableViewStatusLine"> </activityPatternBinding></extension>Status text resolvers
If you disable the default status text resolver, make sure that any other resolver is contributed, otherwise the status line is always empty.
<extension point="org.eclipse.ui.activities"> <activity id="com.heiler.ppm.custom.activities.hide.statusTextResolvers" name="Deactivate statusTextResolvers"> </activity> <activityPatternBinding activityId="com.heiler.ppm.custom.activities.hide.statusTextResolvers" pattern="com.heiler.ppm.std.ui/com.heiler.ppm.std.ui.table.statusline.defaultStatusTextResolver"> </activityPatternBinding></extension>FieldBasedTableViewExtensionManager
Although a FieldBasedTableViewExtensionManager contribution can be overriden by another one with a higher rank, it is also possible to disable a manager contribution by using activiteis:
<extension point="org.eclipse.ui.activities"> <!-- disable view extension manager --> <activity id="com.heiler.ppm.customizing.activities.disable.viewExtensionManager" name="Disable ViewExtensionManager"> </activity> <activityPatternBinding activityId="com.heiler.ppm.customizing.activities.disable.viewExtensionManager" pattern="com.heiler.ppm.dictionary.ui/hlr.dictionary.ui.wordTableViewExtensionManager"> </activityPatternBinding></extension>Complete deletion of action sets
An action set is a logical group of menus and actions that should appear together at the same time. See this FAQ for more detailed explanation.
When activities are used to disable standard UI elements, such elements are not removed, they are just hid. This implies that disabled elements are still present in the internals of the Eclipse RCP ecosystem.
Sometimes this is unacceptable because of the additional overhead, e.g. disabled elements were registered as listeners for selection and if selection count increases - processing time also increases.
Specify action set id's as comma-separated values in the com.heiler.ppm.main/completely-deleted-actionsets preference of plugin_customization.ini file. This will completely delete corresponding action sets from the internals of the Eclipse RCP ecosystem.
For example: com.heiler.ppm.main/completely-deleted-actionsets = org.eclipse.ui.actionSet.openFiles, org.eclipse.ui.actionSet.keyBindings
Download
You can find the full source code as SDK examples.