title: Java, swt, How to distinguish right-click from left-click on popup menu
body: <p>How can I distinguish right-click from left-click on popup menu in swt?</p>
  
  <p>By adding a SelectionListener I can act on both left and right-click, but how
  do I know which one was used? Is it possible to have a MouseListener on a MenuItem?</p>
  
  <p>What I want to do is similar to a browser-favorites menu, left-click to select
  and right-click for a favorite context menu.</p>
  
  <pre><code>Button bn = new Button(shell, SWT.FLAT);
  bn.setText("Right Click to see the popup menu");
  
  Menu popupMenu = new Menu(bn);
  MenuItem newItem = new MenuItem(popupMenu, SWT.CASCADE);
  newItem.setText("New");
  
  newItem.addSelectionListener(new SelectionListener() {
   public void widgetSelected(SelectionEvent e) {    
        System.out.print("SELECTED1\n" );
   }
   public void widgetDefaultSelected(SelectionEvent e) {
        System.out.print("SELECTED2\n" );
   }
  });
  </code></pre>
  
  <p>To clarify:
  Sorry, did not manage to include a screen shot, but I think you can see what I mean if you follow this description.</p>
  
  <ol>
  <li>Select the Favorites menu in Windows Explorer (or probably any other browser)</li>
  <li>If you left-click on one of your favorites the browser will open this URL, 
  but you may also Right-click on this favorite.</li>
  <li>Right-click will bring up a context menu valid for the selected favorite.</li>
  </ol>
  
  <p>I also need two different actions for the same MenuItem (actually for the same purpose as the browser).</p>