title: Creating context menu only for a particular item selected in the Tree Viewer
body: <p>I have a <code>TreeViewer</code>, and I created a context menu with some actions.</p>
  
  <p>With this code snippet below, I get the context menu for all tree items. </p>
  
  <pre><code>protected void createMasterPart(final IManagedForm managedForm, final Composite parent)
  {
   Tree t = toolkit.createTree(client, SWT.NULL);
   GridData gd = new GridData(GridData.FILL_BOTH);
   gd.heightHint = 20;
   gd.widthHint = 100;
   t.setLayoutData(gd);
   toolkit.paintBordersFor(client);
   section.setClient(client);
   final SectionPart spart = new SectionPart(section);
   managedForm.addPart(spart);
   viewer = new TreeViewer(t);
   viewer.addSelectionChangedListener(new ISelectionChangedListener() 
   {
   public void selectionChanged(SelectionChangedEvent event) 
   {
      managedForm.fireSelectionChanged(spart, event.getSelection());
   }
   });
   viewer.setContentProvider(new MasterTreeContentProvider());
   viewer.setInput(page.getEditor().getEditorInput());
  
   m_newKeyAction = new AddNewKeyAction(viewer, parent.getShell());
  
   m_newValueAction = new AddNewValueAction(viewer, parent.getShell());
  
   hookContextMenu();
  } 
  private void hookContextMenu()
  {
     MenuManager menuMgr = new MenuManager();
     menuMgr.setRemoveAllWhenShown(true);
     menuMgr.addMenuListener(new IMenuListener() {
     public void menuAboutToShow(IMenuManager manager) 
     {
     fillContextMenu(manager);
     }
     });
     Menu menu = menuMgr.createContextMenu(viewer.getControl());
     viewer.getControl().setMenu(menu);
  }
  
  protected void fillContextMenu( IMenuManager manager )
  {   
      manager.add( m_newKeyAction );
      manager.add( m_newValueAction );
  }
  </code></pre>
  
  <p>I want this context menu to be displayed only for tree items of particular type.
  Please let me know how do I get this done.</p>