I have two (or more) Eclipse views defined. Each of these views has its own selection provider, e.g. a JFace table viewer:
In plugin.xml contribution items are placed at the toolbar of each view, e.g.:
The handler of the contribution items are enabled with respect to the current selection, e.g.:
Because the variable "selection" is a global workspace variable I have the following situation at the moment: If view A has a selected entry but is not active and if view B is active but has no selected entry both contribution items (in A as well as in B) are disabled. To enable the contribution item in A the user has to activate the view A (setting the workspace variable "selection" to the actual selection of A). This is confusing for inexperienced users.
How is it possible to control enabling of a contribution item which belongs to a certain view only by the selection in this view?
I would like to use declarative contribution items and not actions defined programmatically in the view itself.
Moreover, I want to avoid the extra burden of defining special workspace variables for each view (org.eclipse.ui.ISourceProvider). These workspace variables would be a solution if for the view class there were only one instance. If multiple instances of a view class are allowed we have the same problem.
I know that the required behaviour is possible with the extension point org.eclipse.ui.viewActions. However this extension point is deprecated as of Kepler.
Is there a solution using declarative contribution items?
Thank you - Michael
PS: I have posted a similar question on SO but have received no answer until now.
[Updated on: Thu, 10 October 2013 07:02]
Report message to a moderator