/** Runs the default action (open file). */
 public void runDefaultAction(IStructuredSelection selection) {
   Object element = selection.getFirstElement();
   if (element instanceof IPage) {
     openFileAction.selectionChanged(selection);
     openFileAction.run();
   }
 }
Exemple #2
0
 private boolean selectionChangedToEGL(IStructuredSelection selection) {
   if (selection.size() == 1) {
     if (selection.getFirstElement() instanceof IEGLFile) {
       IEGLElement eglElem = (IEGLElement) selection.getFirstElement();
       IResource resource = eglElem.getResource();
       if (resource != null) {
         openFileAction.selectionChanged(new StructuredSelection(resource));
         return true;
       }
     } else if (selection.getFirstElement() instanceof IClassFile) {
       IEGLElement eglElem = (IEGLElement) selection.getFirstElement();
       openIRFileAction.setClassFile(((IClassFile) eglElem));
       return true;
     }
   }
   return false;
 }
Exemple #3
0
  public void fillContextMenu(IMenuManager menu) {
    if (!contribute || getContext().getSelection().isEmpty()) {
      return;
    }
    IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();

    if (selection.size() == 1) {
      Object selObj = selection.getFirstElement();
      if (selObj instanceof IClassFile) {
        openIRFileAction.setClassFile((IClassFile) selObj);
        menu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openIRFileAction);
      }
    } else {
      openFileAction.selectionChanged(selection);
      if (openFileAction.isEnabled())
        menu.insertAfter(ICommonMenuConstants.GROUP_OPEN, openFileAction);
    }
    addOpenWithMenu(selection, menu);
  }
 public void fillContextMenu(IMenuManager menu, IStructuredSelection selection) {
   MenuManager subMenu = new MenuManager("New");
   menu.add(subMenu);
   for (int i = 0; i < this.addRemoteRepositoryActions.length; i++) {
     subMenu.add(this.addRemoteRepositoryActions[i]);
   }
   subMenu.add(new Separator());
   subMenu.add(this.addSpaceAction);
   subMenu.add(this.addPageAction);
   subMenu.add(new Separator());
   subMenu.add(this.newOtherAction);
   openFileAction.selectionChanged(selection);
   menu.add(openFileAction);
   fillOpenWithMenu(menu, selection.getFirstElement());
   menu.add(new Separator());
   drillDownAdapter.addNavigationActions(menu);
   menu.add(new Separator());
   menu.add(this.deleteAction);
   menu.add(new Separator());
   menu.add(this.refreshAction);
   menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
   menu.add(new Separator());
   menu.add(this.propertyDialogAction);
 }