Ejemplo n.º 1
0
 private void hookContextMenu() {
   MenuManager menuMgr = new MenuManager("#PopupMenu");
   menuMgr.setRemoveAllWhenShown(true);
   menuMgr.addMenuListener(
       new IMenuListener() {
         public void menuAboutToShow(IMenuManager manager) {
           ResultsView.this.fillContextMenu(manager);
         }
       });
   Menu menu = menuMgr.createContextMenu(viewer.getControl());
   viewer.getControl().setMenu(menu);
   getSite().registerContextMenu(menuMgr, viewer);
 }
Ejemplo n.º 2
0
 private void hookDoubleClickAction() {
   viewer.addDoubleClickListener(
       new IDoubleClickListener() {
         public void doubleClick(DoubleClickEvent event) {
           doubleClickAction.run();
         }
       });
 }
Ejemplo n.º 3
0
  /** This is a callback that will allow us to create the viewer and initialize it. */
  public void createPartControl(Composite parent) {
    viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    drillDownAdapter = new DrillDownAdapter(viewer);
    viewer.setContentProvider(new ViewContentProvider());
    viewer.setLabelProvider(new ViewLabelProvider());
    viewer.setSorter(new NameSorter());
    viewer.setInput(getViewSite());

    // Create the help context id for the viewer's control
    PlatformUI.getWorkbench()
        .getHelpSystem()
        .setHelp(viewer.getControl(), "cyrilqc-eclipse.viewer");
    makeActions();
    hookContextMenu();
    hookDoubleClickAction();
    contributeToActionBars();
  }
Ejemplo n.º 4
0
 /** Passing the focus request to the viewer's control. */
 public void setFocus() {
   viewer.getControl().setFocus();
 }
Ejemplo n.º 5
0
 private void showMessage(String message) {
   MessageDialog.openInformation(viewer.getControl().getShell(), "Results View", message);
 }