Program: 148405
Project: 148405
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 EditXSDEleDecNameValidator(schema));
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Window.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) {
    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 EditXSDEleDecNameValidator(schema));
    id.setBlockOnOpen(true);
    int ret=id.open();
    if (ret == Window.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) {
    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;
}