I have an RCP application and I want disable/enable some elements of the toolbar when I perform some actions. My extension:
No, there's no way to get access to the main toolbar. The IActionBars
toolbar returns the view toolbar (right next to the view tab).
But you enable/disable a command based on the enablement of the active handler. Your handler is responsible for determining its enabled state.
Programmaticly, if you subclass org.eclipse.core.commands.AbstractHandler
you would call setBaseEnabled(boolean state)
to make sure it fires the correct event.
Declaratively, when contributed via org.eclipse.ui.handlers
it has support for an enabledWhen
element as well. That has access to the application state listed in org.eclipse.ui.ISources