Program: 135895
Project: 135895
Buggy source:
public Object execute(ExecutionEvent event) throws ExecutionException {
  Spec spec=ToolboxHandle.getCurrentSpec();
  if (spec == null) {
    return null;
  }
  String oldModuleName=spec.getModuleToShow();
  if (oldModuleName != null) {
    IResource resource=ResourceHelper.getResourceByModuleName(oldModuleName);
    if (resource != null) {
      try {
        resource.deleteMarkers(SHOW_USE_MARKER_TYPE,false,99);
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
      spec.setMarkersToShow(null);
    }
  }
  TLAEditor tlaEditor=EditorUtil.getTLAEditorWithFocus();
  if (tlaEditor == null) {
    return null;
  }
  String moduleName=tlaEditor.getModuleName();
  ModuleNode moduleNode=ResourceHelper.getModuleNode(moduleName);
  if (moduleNode == null) {
    return null;
  }
  TokenSpec currentTokenSpec=TokenSpec.findCurrentTokenSpec();
  if (currentTokenSpec == null || currentTokenSpec.resolvedSymbol == null) {
    return null;
  }
  SymbolNode resolvedSymbol=currentTokenSpec.resolvedSymbol;
  String[] tempModuleNames=ResourceHelper.getModuleNames();
  int numberOfModulesUsedIn=0;
  SemanticNode[][] tempUsesArray=new SemanticNode[tempModuleNames.length][];
  for (int i=0; i < tempModuleNames.length; i++) {
    tempUsesArray[i]=ResourceHelper.getUsesOfSymbol(resolvedSymbol,ResourceHelper.getModuleNode(tempModuleNames[i]));
    if ((tempUsesArray[i] != null) && (tempUsesArray[i].length > 0)) {
      numberOfModulesUsedIn++;
    }
  }
  if (numberOfModulesUsedIn == 0) {
    MessageDialog.openWarning(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str" + resolvedSymbol.getName());
    return null;
  }
  SemanticNode[][] usesArray=new SemanticNode[numberOfModulesUsedIn][];
  String[] moduleNames=new String[numberOfModulesUsedIn];
  int j=0;
  for (int i=0; i < tempModuleNames.length; i++) {
    if ((tempUsesArray[i] != null) && (tempUsesArray[i].length > 0)) {
      usesArray[j]=tempUsesArray[i];
      moduleNames[j]=tempModuleNames[i];
      j++;
    }
  }
  j=-1;
  for (int i=0; i < moduleNames.length; i++) {
    if (moduleName.equals(moduleNames[i])) {
      j=i;
      break;
    }
  }
  if (j > 0) {
    SemanticNode[] savedUses=usesArray[j];
    for (int i=j - 1; i > -1; i--) {
      usesArray[i + 1]=usesArray[i];
      moduleNames[i + 1]=moduleNames[i];
    }
    usesArray[0]=savedUses;
    moduleNames[0]=moduleName;
  }
  String moduleToShow=null;
  if (moduleNames.length > 1) {
    Shell parent=UIHelper.getShellProvider().getShell();
    ShowUsesPopupDialog popup=new ShowUsesPopupDialog(parent,moduleNames,usesArray);
    popup.open();
  }
 else {
    moduleToShow=moduleName;
    spec.setModuleToShow(moduleToShow);
    int moduleIndex=-1;
    for (int i=0; i < moduleNames.length; i++) {
      if (moduleNames[i].equals(moduleToShow)) {
        moduleIndex=i;
        break;
      }
    }
    if (moduleIndex < 0) {
      Activator.logDebug("String_Node_Str" + "String_Node_Str");
      return null;
    }
    SemanticNode[] uses=usesArray[moduleIndex];
    setUseMarkers(uses,moduleName,spec);
  }
  return null;
}

Fixed version (ground truth):
public Object execute(ExecutionEvent event) throws ExecutionException {
  Spec spec=ToolboxHandle.getCurrentSpec();
  if (spec == null) {
    return null;
  }
  String oldModuleName=spec.getModuleToShow();
  if (oldModuleName != null) {
    IResource resource=ResourceHelper.getResourceByModuleName(oldModuleName);
    if (resource != null) {
      try {
        resource.deleteMarkers(SHOW_USE_MARKER_TYPE,false,99);
      }
 catch (      CoreException e) {
        e.printStackTrace();
      }
      spec.setMarkersToShow(null);
    }
  }
  TLAEditor tlaEditor=EditorUtil.getTLAEditorWithFocus();
  if (tlaEditor == null) {
    return null;
  }
  String moduleName=tlaEditor.getModuleName();
  ModuleNode moduleNode=ResourceHelper.getModuleNode(moduleName);
  if (moduleNode == null) {
    return null;
  }
  TokenSpec currentTokenSpec=TokenSpec.findCurrentTokenSpec();
  if (currentTokenSpec == null || currentTokenSpec.resolvedSymbol == null) {
    return null;
  }
  SymbolNode resolvedSymbol=currentTokenSpec.resolvedSymbol;
  String[] tempModuleNames=ResourceHelper.getModuleNames();
  int numberOfModulesUsedIn=0;
  SemanticNode[][] tempUsesArray=new SemanticNode[tempModuleNames.length][];
  for (int i=0; i < tempModuleNames.length; i++) {
    tempUsesArray[i]=ResourceHelper.getUsesOfSymbol(resolvedSymbol,ResourceHelper.getModuleNode(tempModuleNames[i]));
    if ((tempUsesArray[i] != null) && (tempUsesArray[i].length > 0)) {
      numberOfModulesUsedIn++;
    }
  }
  if (numberOfModulesUsedIn == 0) {
    MessageDialog.openWarning(UIHelper.getShellProvider().getShell(),"String_Node_Str","String_Node_Str" + resolvedSymbol.getName());
    return null;
  }
  SemanticNode[][] usesArray=new SemanticNode[numberOfModulesUsedIn][];
  String[] moduleNames=new String[numberOfModulesUsedIn];
  int j=0;
  for (int i=0; i < tempModuleNames.length; i++) {
    if ((tempUsesArray[i] != null) && (tempUsesArray[i].length > 0)) {
      usesArray[j]=tempUsesArray[i];
      moduleNames[j]=tempModuleNames[i];
      j++;
    }
  }
  j=-1;
  for (int i=0; i < moduleNames.length; i++) {
    if (moduleName.equals(moduleNames[i])) {
      j=i;
      break;
    }
  }
  if (j > 0) {
    SemanticNode[] savedUses=usesArray[j];
    for (int i=j - 1; i > -1; i--) {
      usesArray[i + 1]=usesArray[i];
      moduleNames[i + 1]=moduleNames[i];
    }
    usesArray[0]=savedUses;
    moduleNames[0]=moduleName;
  }
  String moduleToShow=null;
  if (moduleNames.length > 1) {
    Shell parent=UIHelper.getShellProvider().getShell();
    ShowUsesPopupDialog popup=new ShowUsesPopupDialog(parent,moduleNames,usesArray);
    popup.open();
  }
 else {
    moduleName=moduleNames[0];
    moduleToShow=moduleName;
    spec.setModuleToShow(moduleToShow);
    int moduleIndex=-1;
    for (int i=0; i < moduleNames.length; i++) {
      if (moduleNames[i].equals(moduleToShow)) {
        moduleIndex=i;
        break;
      }
    }
    if (moduleIndex < 0) {
      Activator.logDebug("String_Node_Str" + "String_Node_Str");
      return null;
    }
    SemanticNode[] uses=usesArray[moduleIndex];
    setUseMarkers(uses,moduleName,spec);
  }
  return null;
}