Program: 71625
Project: 71625
Buggy source:
/** 
 * Builds the context menu. Single selection menu and multiple selection menu are created while selecting just single element or multiple elements
 * @param menu the menu
 */
public void buildContextMenu(IMenuManager menu){
  if (Policy.TRACING_MENU_SHOW) {
    System.out.println("String_Node_Str");
  }
  resetActionStatus();
  menu.removeAll();
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  menu.add(new Separator());
  IStructuredSelection selection=(IStructuredSelection)page.getSelection();
  if (selection != null && selection.getFirstElement() != null) {
    Object selected=selection.getFirstElement();
    if (selected instanceof ReportResourceEntry) {
      selected=((ReportResourceEntry)selected).getReportElement();
    }
    if (selected instanceof ResourceEntryWrapper) {
      int type=((ResourceEntryWrapper)selected).getType();
      if (type == ResourceEntryWrapper.LIBRARY) {
        menu.add(useLibraryAction);
      }
 else       if (type == ResourceEntryWrapper.CSS_STYLE_SHEET) {
        menu.add(useCSSAction);
      }
      if (((ResourceEntryWrapper)selected).getParent() instanceof PathResourceEntry) {
        menu.add(new Separator());
        menu.add(newMenuGroup);
        menu.add(addResourceAction);
      }
      menu.add(new Separator());
      menu.add(copyResourceAction);
      if (((ResourceEntryWrapper)selected).getParent() instanceof PathResourceEntry) {
        menu.add(pasteResourceAction);
        menu.add(deleteResourceAction);
        menu.add(moveResourceAction);
        menu.add(renameResourceAction);
        menu.add(new Separator());
      }
    }
 else     if (selected instanceof LibraryHandle) {
      menu.add(useLibraryAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof CssStyleSheetHandle) {
      menu.add(useCSSAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof PathResourceEntry) {
      menu.add(newMenuGroup);
      menu.add(addResourceAction);
      menu.add(new Separator());
      menu.add(copyResourceAction);
      menu.add(pasteResourceAction);
      menu.add(deleteResourceAction);
      menu.add(moveResourceAction);
      menu.add(renameResourceAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof FragmentResourceEntry) {
      if (copyResourceAction.isEnabled()) {
        menu.add(copyResourceAction);
        menu.add(new Separator());
      }
    }
    if (canAddtoReport(selected)) {
      if (selection.size() == 1) {
        AddElementtoReport addElementAction=new AddElementtoReport((StructuredViewer)getViewer());
        addElementAction.setSelectedElement(selected);
        menu.add(addElementAction);
        menu.add(new Separator());
      }
    }
    menu.add(new Separator());
    menu.add(refreshExplorerAction);
  }
 else {
    menu.add(addResourceAction);
    menu.add(new Separator());
    menu.add(refreshExplorerAction);
  }
}

Fixed version (ground truth):
/** 
 * Builds the context menu. Single selection menu and multiple selection menu are created while selecting just single element or multiple elements
 * @param menu the menu
 */
public void buildContextMenu(IMenuManager menu){
  if (Policy.TRACING_MENU_SHOW) {
    System.out.println("String_Node_Str");
  }
  resetActionStatus();
  menu.removeAll();
  menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
  menu.add(new Separator());
  IStructuredSelection selection=(IStructuredSelection)page.getSelection();
  IMenuManager newMenuGroup=new MenuManager(Messages.getString("String_Node_Str"));
  newMenuGroup.add(newFolderAction);
  newMenuGroup.add(newLibraryAction);
  if (selection != null && selection.getFirstElement() != null) {
    Object selected=selection.getFirstElement();
    if (selected instanceof ReportResourceEntry) {
      selected=((ReportResourceEntry)selected).getReportElement();
    }
    if (selected instanceof ResourceEntryWrapper) {
      int type=((ResourceEntryWrapper)selected).getType();
      if (type == ResourceEntryWrapper.LIBRARY) {
        menu.add(useLibraryAction);
      }
 else       if (type == ResourceEntryWrapper.CSS_STYLE_SHEET) {
        menu.add(useCSSAction);
      }
      if (((ResourceEntryWrapper)selected).getParent() instanceof PathResourceEntry) {
        menu.add(new Separator());
        menu.add(newMenuGroup);
        menu.add(addResourceAction);
      }
      menu.add(new Separator());
      menu.add(copyResourceAction);
      if (((ResourceEntryWrapper)selected).getParent() instanceof PathResourceEntry) {
        menu.add(pasteResourceAction);
        menu.add(deleteResourceAction);
        menu.add(moveResourceAction);
        menu.add(renameResourceAction);
        menu.add(new Separator());
      }
    }
 else     if (selected instanceof LibraryHandle) {
      menu.add(useLibraryAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof CssStyleSheetHandle) {
      menu.add(useCSSAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof PathResourceEntry) {
      menu.add(newMenuGroup);
      menu.add(addResourceAction);
      menu.add(new Separator());
      menu.add(copyResourceAction);
      menu.add(pasteResourceAction);
      menu.add(deleteResourceAction);
      menu.add(moveResourceAction);
      menu.add(renameResourceAction);
      menu.add(new Separator());
    }
 else     if (selected instanceof FragmentResourceEntry) {
      if (copyResourceAction.isEnabled()) {
        menu.add(copyResourceAction);
        menu.add(new Separator());
      }
    }
    if (canAddtoReport(selected)) {
      if (selection.size() == 1) {
        AddElementtoReport addElementAction=new AddElementtoReport((StructuredViewer)getViewer());
        addElementAction.setSelectedElement(selected);
        menu.add(addElementAction);
        menu.add(new Separator());
      }
    }
    menu.add(new Separator());
    menu.add(refreshExplorerAction);
  }
 else {
    menu.add(addResourceAction);
    menu.add(new Separator());
    menu.add(refreshExplorerAction);
  }
}