Hi,
I have a small problem and hope somebody can help me.
I have implemented a view (... extends ViewPart ...). The only control in this view is a TableViewer which I set as the selection provider for the Site.
@Override
public void createPartControl(Composite parent)
{
// ...
// create TableViewer
// ...
getSite().setSelectionProvider(tableViewer)
}
I also added a local toolbar for this view through a menuContribution in my plugin.xml. The commands in this toolbar only have a default handler assigned. The default handler implements the isEnabled method to enable/disable the command depending on the selection of the view.
@Override
public boolean isEnabled()
{
ISelection sel = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection("id of my view");
if (/* case a */)
return true;
return false;
}
Imho the isEnabled method of my CommandHandler should be called everytime the selection in my view changes, but it does not.
What have I to implement also, that I can react in the isEnabled method on the selections in my view.
Thanks in advance.
--Martin