Program: 148398
Project: 148398
Buggy source:
public IStatus doAction(){
  List<IStatus> results=new ArrayList<IStatus>();
  try {
    IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
    if (delObjs.isEmpty()) {
      return Status.CANCEL_STATUS;
    }
 else {
      boolean sameType=checkInSameClassType(delObjs.toArray(),delObjs.get(0).getClass());
      String deleteLabel="String_Node_Str";
      String elemDesc=((Action)clsAction.get(delObjs.get(0).getClass())).getText();
      int backPos=elemDesc.indexOf("String_Node_Str");
      if (delObjs.size() > 1) {
        deleteLabel+=elemDesc.substring(0,backPos) + "String_Node_Str" + delObjs.size()+ "String_Node_Str"+ (!sameType ? "String_Node_Str" : elemDesc.substring(backPos + 1));
        if (deleteLabel.endsWith("String_Node_Str")) {
          deleteLabel=deleteLabel.substring(0,deleteLabel.length() - 1) + "String_Node_Str";
        }
 else         deleteLabel=deleteLabel + "String_Node_Str";
      }
 else       deleteLabel+=elemDesc.substring(0,backPos) + "String_Node_Str" + (!sameType ? "String_Node_Str" : elemDesc.substring(backPos + 1));
      if (!MessageDialog.openConfirm(page.getSite().getShell(),"String_Node_Str",deleteLabel)) {
        return Status.CANCEL_STATUS;
      }
    }
    for (Iterator iterator=delObjs.iterator(); iterator.hasNext(); ) {
      Object toDel=(Object)iterator.next();
      UndoAction delExecute=null;
      boolean isElem=true;
      if (toDel instanceof XSDElementDeclaration) {
        XSDElementDeclaration decl=(XSDElementDeclaration)toDel;
        EList l=decl.getIdentityConstraintDefinitions();
        for (Iterator iter=l.iterator(); iter.hasNext(); ) {
          XSDIdentityConstraintDefinition icd=(XSDIdentityConstraintDefinition)iter.next();
          if (icd.getIdentityConstraintCategory().equals(XSDIdentityConstraintCategory.UNIQUE_LITERAL)) {
            isElem=false;
            break;
          }
        }
      }
      if (toDel instanceof XSDXPathDefinition) {
        XSDXPathDefinition xpath=(XSDXPathDefinition)toDel;
        if (!xpath.getVariety().equals(XSDXPathVariety.FIELD_LITERAL))         continue;
      }
      delExecute=clsAction.get(toDel.getClass());
      if (isElem && toDel instanceof XSDElementDeclaration) {
        delExecute=clsAction.get(null);
      }
      if (delExecute instanceof XSDDeleteConceptAction && toDel instanceof XSDElementDeclaration) {
        ((XSDDeleteConceptAction)delExecute).setXSDTODel((XSDElementDeclaration)toDel);
      }
 else       if (delExecute instanceof XSDDeleteElementAction && toDel instanceof XSDElementDeclaration) {
        ((XSDDeleteElementAction)delExecute).setXSDTODel((XSDElementDeclaration)toDel);
      }
 else       if (delExecute instanceof XSDDeleteParticleAction && toDel instanceof XSDParticle) {
        ((XSDDeleteParticleAction)delExecute).setXSDTODel((XSDParticle)toDel);
      }
 else       if (delExecute instanceof XSDDeleteXPathAction && toDel instanceof XSDXPathDefinition) {
        ((XSDDeleteXPathAction)delExecute).setXSDTODel((XSDXPathDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteIdentityConstraintAction && toDel instanceof XSDIdentityConstraintDefinition) {
        ((XSDDeleteIdentityConstraintAction)delExecute).setXSDTODel((XSDIdentityConstraintDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteTypeDefinition && toDel instanceof XSDComplexTypeDefinition) {
        ((XSDDeleteTypeDefinition)delExecute).setXSDTODel((XSDComplexTypeDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteTypeDefinition && toDel instanceof XSDSimpleTypeDefinition) {
        ((XSDDeleteTypeDefinition)delExecute).setXSDTODel((XSDSimpleTypeDefinition)toDel);
      }
 else       return Status.CANCEL_STATUS;
      results.add(delExecute.execute());
    }
  }
 catch (  Exception e) {
    log.error(e.getStackTrace());
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return (results.indexOf(Status.OK_STATUS) >= 0 ? Status.OK_STATUS : Status.CANCEL_STATUS);
  }
  return (results.indexOf(Status.OK_STATUS) >= 0 ? Status.OK_STATUS : Status.CANCEL_STATUS);
}

Fixed version (ground truth):
public IStatus doAction(){
  List<IStatus> results=new ArrayList<IStatus>();
  try {
    IStructuredSelection selection=(IStructuredSelection)page.getTreeViewer().getSelection();
    if (delObjs.isEmpty()) {
      return Status.CANCEL_STATUS;
    }
 else {
      boolean sameType=checkInSameClassType(delObjs.toArray(),delObjs.get(0).getClass());
      String deleteLabel="String_Node_Str";
      String elemDesc=((Action)clsAction.get(delObjs.get(0).getClass())).getText();
      int backPos=elemDesc.indexOf("String_Node_Str");
      if (delObjs.size() > 1) {
        deleteLabel+=elemDesc.substring(0,backPos) + "String_Node_Str" + delObjs.size()+ "String_Node_Str"+ (!sameType ? "String_Node_Str" : elemDesc.substring(backPos + 1));
        if (deleteLabel.endsWith("String_Node_Str")) {
          deleteLabel=deleteLabel.substring(0,deleteLabel.length() - 1) + "String_Node_Str";
        }
 else         deleteLabel=deleteLabel + "String_Node_Str";
      }
 else       deleteLabel+=elemDesc.substring(0,backPos) + "String_Node_Str" + (!sameType ? "String_Node_Str" : elemDesc.substring(backPos + 1));
      if (!MessageDialog.openConfirm(page.getSite().getShell(),"String_Node_Str",deleteLabel)) {
        return Status.CANCEL_STATUS;
      }
    }
    for (Iterator iterator=delObjs.iterator(); iterator.hasNext(); ) {
      Object toDel=(Object)iterator.next();
      UndoAction delExecute=null;
      boolean isElem=true;
      if (toDel instanceof XSDElementDeclaration) {
        XSDElementDeclaration decl=(XSDElementDeclaration)toDel;
        EList l=decl.getIdentityConstraintDefinitions();
        for (Iterator iter=l.iterator(); iter.hasNext(); ) {
          XSDIdentityConstraintDefinition icd=(XSDIdentityConstraintDefinition)iter.next();
          if (icd.getIdentityConstraintCategory().equals(XSDIdentityConstraintCategory.UNIQUE_LITERAL)) {
            isElem=false;
            break;
          }
        }
      }
      if (toDel instanceof XSDXPathDefinition) {
        XSDXPathDefinition xpath=(XSDXPathDefinition)toDel;
        if (!xpath.getVariety().equals(XSDXPathVariety.FIELD_LITERAL))         continue;
      }
      delExecute=clsAction.get(toDel.getClass());
      if (isElem && toDel instanceof XSDElementDeclaration) {
        delExecute=clsAction.get(null);
      }
      if (delExecute instanceof XSDDeleteConceptAction && toDel instanceof XSDElementDeclaration) {
        ((XSDDeleteConceptAction)delExecute).setXSDTODel((XSDElementDeclaration)toDel);
      }
 else       if (delExecute instanceof XSDDeleteElementAction && toDel instanceof XSDElementDeclaration) {
        ((XSDDeleteElementAction)delExecute).setXSDTODel((XSDElementDeclaration)toDel);
      }
 else       if (delExecute instanceof XSDDeleteParticleAction && toDel instanceof XSDParticle) {
        ((XSDDeleteParticleAction)delExecute).setXSDTODel((XSDParticle)toDel);
      }
 else       if (delExecute instanceof XSDDeleteXPathAction && toDel instanceof XSDXPathDefinition) {
        ((XSDDeleteXPathAction)delExecute).setXSDTODel((XSDXPathDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteIdentityConstraintAction && toDel instanceof XSDIdentityConstraintDefinition) {
        ((XSDDeleteIdentityConstraintAction)delExecute).setXSDTODel((XSDIdentityConstraintDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteTypeDefinition && toDel instanceof XSDComplexTypeDefinition) {
        ((XSDDeleteTypeDefinition)delExecute).setXSDTODel((XSDComplexTypeDefinition)toDel);
      }
 else       if (delExecute instanceof XSDDeleteTypeDefinition && toDel instanceof XSDSimpleTypeDefinition) {
        ((XSDDeleteTypeDefinition)delExecute).setXSDTODel((XSDSimpleTypeDefinition)toDel);
      }
 else       return Status.CANCEL_STATUS;
      results.add(delExecute.execute());
    }
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return (results.indexOf(Status.OK_STATUS) >= 0 ? Status.OK_STATUS : Status.CANCEL_STATUS);
  }
  return (results.indexOf(Status.OK_STATUS) >= 0 ? Status.OK_STATUS : Status.CANCEL_STATUS);
}