@Override
 public void dispose() {
   if (selProvider != null) {
     selProvider.removeSelectionChangedListener(this);
   }
   disposeActions();
   super.dispose();
 }
    @Override
    public void contribute(
        IMenuManager menu,
        boolean menuAppendIfMissing,
        IToolBarManager toolbar,
        boolean toolAppendIfMissing) {
      boolean visible = true;

      if (visibilityTest != null) {
        ISelection selection = selProvider.getSelection();
        if (selection instanceof IStructuredSelection) {
          visible = visibilityTest.isEnabledFor((IStructuredSelection) selection);
        } else {
          visible = visibilityTest.isEnabledFor(selection);
        }
      }

      if (visible) {
        super.contribute(menu, menuAppendIfMissing, toolbar, toolAppendIfMissing);
      }
    }