Program: 148404
Project: 148404
Buggy source:
public IStatus doAction(){
  try {
    ISelection selection=page.getTreeViewer().getSelection();
    XSDElementDeclaration decl=(XSDElementDeclaration)((IStructuredSelection)selection).getFirstElement();
    ArrayList<Object> objList=new ArrayList<Object>();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getTreeViewer().getContentProvider();
    Object[] objs=Util.getAllObject(page.getSite(),objList,provider);
    String oldName=decl.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new IInputValidator(){
      public String isValid(      String newText){
        if ((newText == null) || "String_Node_Str".equals(newText))         return "String_Node_Str";
        if (Pattern.compile("String_Node_Str").matcher(newText).matches() || newText.trim().replaceAll("String_Node_Str","String_Node_Str").length() != newText.trim().length())         return "String_Node_Str";
        EList list=schema.getElementDeclarations();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
          if (d.getName().equals(newText.trim()))           return "String_Node_Str";
        }
        return null;
      }
    }
);
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    decl.setName(id.getValue().trim());
    decl.updateElement();
    Util.updateReference(decl,objs,id.getValue());
    EList list=decl.getIdentityConstraintDefinitions();
    XSDIdentityConstraintDefinition toUpdate=null;
    for (Iterator iter=list.iterator(); iter.hasNext(); ) {
      XSDIdentityConstraintDefinition icd=(XSDIdentityConstraintDefinition)iter.next();
      if (icd.getName().equals(oldName)) {
        toUpdate=icd;
        break;
      }
    }
    if (toUpdate != null) {
      toUpdate.setName(id.getValue());
      toUpdate.updateElement();
    }
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    log.error(e.getStackTrace());
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}

Fixed version (ground truth):
public IStatus doAction(){
  try {
    ISelection selection=page.getTreeViewer().getSelection();
    XSDElementDeclaration decl=(XSDElementDeclaration)((IStructuredSelection)selection).getFirstElement();
    ArrayList<Object> objList=new ArrayList<Object>();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getTreeViewer().getContentProvider();
    Object[] objs=Util.getAllObject(page.getSite(),objList,provider);
    String oldName=decl.getName();
    InputDialog id=new InputDialog(page.getSite().getShell(),"String_Node_Str","String_Node_Str",oldName,new IInputValidator(){
      public String isValid(      String newText){
        if ((newText == null) || "String_Node_Str".equals(newText))         return "String_Node_Str";
        if (Pattern.compile("String_Node_Str").matcher(newText).matches() || newText.trim().replaceAll("String_Node_Str","String_Node_Str").length() != newText.trim().length())         return "String_Node_Str";
        EList list=schema.getElementDeclarations();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
          if (d.getName().equals(newText.trim()))           return "String_Node_Str";
        }
        return null;
      }
    }
);
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Dialog.CANCEL) {
      return Status.CANCEL_STATUS;
    }
    decl.setName(id.getValue().trim());
    decl.updateElement();
    Util.updateReference(decl,objs,id.getValue());
    EList list=decl.getIdentityConstraintDefinitions();
    XSDIdentityConstraintDefinition toUpdate=null;
    for (Iterator iter=list.iterator(); iter.hasNext(); ) {
      XSDIdentityConstraintDefinition icd=(XSDIdentityConstraintDefinition)iter.next();
      if (icd.getName().equals(oldName)) {
        toUpdate=icd;
        break;
      }
    }
    if (toUpdate != null) {
      toUpdate.setName(id.getValue());
      toUpdate.updateElement();
    }
    page.refresh();
    page.markDirty();
  }
 catch (  Exception e) {
    log.error(e.getMessage(),e);
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}