Program: 148918
Project: 148918
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";
        EList list=schema.getElementDeclarations();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
          if (d.getName().equals(newText))           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());
    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();
    page.refreshPage();
  }
 catch (  Exception e) {
    e.printStackTrace();
    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";
        EList list=schema.getElementDeclarations();
        for (Iterator iter=list.iterator(); iter.hasNext(); ) {
          XSDElementDeclaration d=(XSDElementDeclaration)iter.next();
          if (d.getName().equals(newText))           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());
    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) {
    e.printStackTrace();
    MessageDialog.openError(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    return Status.CANCEL_STATUS;
  }
  return Status.OK_STATUS;
}