/**
  * @param anEvent An event indicating the current selection of the {@link CommonViewer}
  * @see
  *     org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
  */
 public void selectionChanged(SelectionChangedEvent anEvent) {
   if (anEvent.getSelection() instanceof IStructuredSelection) {
     IStructuredSelection structuredSelection = (IStructuredSelection) anEvent.getSelection();
     actionService.setContext(new ActionContext(structuredSelection));
     actionService.fillActionBars(commonNavigator.getViewSite().getActionBars());
   }
 }
  /** Initializes and registers the context menu. */
  protected void initContextMenu() {
    MenuManager menuMgr = new MenuManager(contentService.getViewerDescriptor().getPopupMenuId());
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(
        new IMenuListener() {

          public void menuAboutToShow(IMenuManager manager) {
            fillContextMenu(manager);
          }
        });
    TreeViewer commonViewer = commonNavigator.getCommonViewer();
    Menu menu = menuMgr.createContextMenu(commonViewer.getTree());

    commonViewer.getTree().setMenu(menu);

    actionService.prepareMenuForPlatformContributions(menuMgr, commonViewer, false);
  }
 /**
  * Fills aMenuManager with menu contributions from the {@link NavigatorActionService}.
  *
  * @param aMenuManager A popup menu
  * @see NavigatorActionService#fillContextMenu(IMenuManager)
  */
 protected void fillContextMenu(IMenuManager aMenuManager) {
   ISelection selection = commonNavigator.getCommonViewer().getSelection();
   actionService.setContext(new ActionContext(selection));
   actionService.fillContextMenu(aMenuManager);
 }
 /**
  * @param aMemento Used to save state of action extensions via the {@link NavigatorActionService}.
  */
 public void saveState(IMemento aMemento) {
   actionService.saveState(aMemento);
 }
 /**
  * @param aMemento Used to restore state of action extensions via the {@link
  *     NavigatorActionService}.
  */
 public void restoreState(IMemento aMemento) {
   actionService.restoreState(aMemento);
 }
 /** Called by {@link CommonNavigator} when the View Part is disposed. */
 public void dispose() {
   commonNavigator.getCommonViewer().removeSelectionChangedListener(this);
   commonNavigator.getCommonViewer().removeSelectionChangedListener(statusBarListener);
   actionService.dispose();
 }