예제 #1
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);
  }