Eclipse Community Forums - RDF feed
https://www.eclipse.org/forums/
Eclipse Community ForumsShowViewMenu and activities
https://www.eclipse.org/forums/index.php/mv/msg/110047/336239/#msg_336239
I have a question about the behaviour of the Show View Menu in conjunction
with
activities, a.k.a. capabilities. I have a plugin (say pluginB) which
contributes a viewShortcut and a perspectiveShortcut to a custom
perspective,
which exists in pluginA:
If I have pluginA.myPerspective open, I see pluginB.myOtherPerspective in
the
Open Perspective menu, and pluginB.myView in the Show View menu, as
expected.
When I go to disable activityB in the Capabilities preference page,
pluginB.myOtherPerspective disappears from the Open Perspective menu
(good), but
pluginB.myView remains in the Show View menu (bad).
I was able to trace the issue to the internal class
org.eclipse.ui.internal.ShowViewMenu. In particular, it executes the
following
when it populates the menu:
for (Iterator i = actions.iterator(); i.hasNext();) {
CommandContributionItem item =
new CommandContributionItem(
(CommandContributionItemParameter) i.next());
if (WorkbenchActivityHelper.filterItem(item)) {
item.dispose();
continue;
}
innerMgr.add(item);
}
This is the right idea, but WorkbenchActivityHelper has the following
filterItem
implementation:
public static final boolean filterItem(Object object) {
if (object instanceof IPluginContribution) {
...snip...
}
return false;
}
Trouble is, CommandContributionItem is not derived from
IPluginContribution.
Therefore, the items are never filtered out.
Am I reading this right? Are there any workarounds for this issue? Any
help
would be appreciated.