Community
Participate
Working Groups
We have a top level menu that is initially visible when our plugin is loaded. Elipse provides a mechanism for hiding that action set on a individual perspective basis, but there are two issues with the current implementation: 1) To hide the menu, the user has a several step process for *each* perspective currently open. 2) Anytime a new perspective is opened, the user must use that same process to hide the actionSet. To overcome this limitation, I have enhanced ActionSetDescriptor and IActionSetDescriptor to have a new #setInitiallyVisible method that overrides the actionSet's visible attribute specified in the plugin manifest. The value is persisted in the workspace metadata using the normal perference storage mechanism. This code is written against Eclipse 3.0 HEAD and thus should be fully compatible with the latest Eclipse 3.0 nightly build. Please consider thes modifications for inclusion in the Eclipse 3.0 M2 build. If you approve of this approach and include this code in the Eclipse 3.0 build, I would be happy to provide a new ShowActionSetAction that would show/hide an action set in all of the currently open perspectives, plus call the new #setInitiallyVisible method so that state is remembered for any perspectives opened later in the workspace. We could then provide this action as part of our menu so that the user could quickly hide the menu in all current and future perspectives.
Created attachment 5312 [details] Patch to ActionSetDescriptor adding new setInitiallyVisible method
Created attachment 5313 [details] (take 2) Patch to ActionSetDescriptor adding new setInitiallyVisible method Apparently I uploaded the first patch incorrectly. Please ignore the first patch and use this instead.
Comment on attachment 5312 [details] Patch to ActionSetDescriptor adding new setInitiallyVisible method Obsolete, according to comment #1.
I have the following concerns with the proposed enhancement: 1. Currently, actions sets can either be on globally, associated with specific perspectives, and/or associated with specific parts. This makes it consistent and explainable as to when a particular set of actions appears. Adding the ability to change the "initially visible" state, and/or adding API to show/hide actions sets, circumvents the Workbench's ability to manage the visibility of action sets in a consistent and explainable way. 2. Before considering this change, I would want to know how you propose to present this mode switch in the UI. Currently the user can go to one place, the perspective customization dialog, to effect changes in the visible action sets, and I would not want to introduce multiple, inconsistent ways of doing so. 3. If the concern is that there is no way for the user to toggle an action set "always on" or "always off", then we can consider enhancing the perspective customization dialog to allow this (without necessarily adding new API for arbitrary plugins to call). It would help to have some concrete use cases illustrating what you are trying to accomplish with this API. We may be able to offer some alternative ideas.
Our action set is a global (available accross all perspectives), top-level menu which gives the user quick access to a variety of services provided by our product. The menu is provided as a convenience to the user, but is not required by the product (it will work fine, if the menu is not there). We want to be "nice" to the user and give them an easy way to turn this global menu off and save the menubar real estate. The current workbench customization options do not provide a way to globally enable or disable an action set across all perspectives. Our supplied patch provides this capability. Currently (and for lack of any other option), we provide this mode switch via a preference page option. A single checkbox will make the menu appear and disappear as desired by the user. If there were a global Eclipse customization option (such as #3 above) for turning on and off global actions sets, we could use that instead.
Any plans to integrate this new IActionSetDescriptor API into 3.0 ?
Will consider it for M8.
Patch applied.
The patch as provided does not work. If setInitiallyVisible(false) is called, the preference store removes the explicitly set value since it's the same as the default. So the isDefault(prefId) call returns true, causing the registered visible value (true in the case of an always-on action set) to be returned.
The isDefault check in the code also prevented apps from overriding the default value in plugin_customization.ini.
Fixed by flipping the logic. It now uses the following pref prefix: private static final String INITIALLY_HIDDEN_PREF_ID_PREFIX = "actionSet.initiallyHidden."; //$NON-NLS-1$ This avoids having to use isDefault checks. The set logic is now: public void setInitiallyVisible(boolean newValue) { if (id == null) return; Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences(); String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId(); prefs.setValue(prefId, !newValue); } The get logic is now: public boolean isInitiallyVisible() { if (id == null) return visible; Preferences prefs = WorkbenchPlugin.getDefault().getPluginPreferences(); String prefId = INITIALLY_HIDDEN_PREF_ID_PREFIX + getId(); if (prefs.getBoolean(prefId)) return false; return visible; }