Program: 148518
Project: 148518
Buggy source:
public IStatus doAction(){
  try {
    XSDElementDeclaration decl=xsdElem;
    if (decl == null) {
      ISelection selection=page.getTreeViewer().getSelection();
      decl=(XSDElementDeclaration)((IStructuredSelection)selection).getFirstElement();
    }
    XtentisPort port=null;
    try {
      port=Util.getPort(page.getXObject());
    }
 catch (    XtentisException e) {
      e.printStackTrace();
    }
    Set<String> list=Util.getForeignKeys();
    if (list == null) {
      list=new HashSet<String>();
      Util.getForeingKeyInDataModel(list,page.getXObject().getParent(),port);
      Util.setForeignKeys(list);
    }
    if (list.contains(decl.getName())) {
      boolean confirmed=MessageDialog.openConfirm(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + decl.getName() + "String_Node_Str"+ "String_Node_Str");
      if (!confirmed) {
        return Status.CANCEL_STATUS;
      }
    }
    ArrayList<Object> objList=new ArrayList<Object>();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getTreeViewer().getContentProvider();
    Object[] objs=Util.getAllObject(page.getSite(),objList,provider);
    Util.deleteReference(decl,objs);
    if (schema == null)     schema=((ISchemaContentProvider)page.getTreeViewer().getContentProvider()).getXsdSchema();
    schema.getContents().remove(decl);
    schema.update();
    xsdElem=null;
    page.refresh();
    page.markDirtyWithoutCommit();
  }
 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 {
    XSDElementDeclaration decl=xsdElem;
    if (decl == null) {
      ISelection selection=page.getTreeViewer().getSelection();
      decl=(XSDElementDeclaration)((IStructuredSelection)selection).getFirstElement();
    }
    Set<String> list=Util.getForeignKeys();
    if (list == null) {
      XtentisPort port=null;
      try {
        port=Util.getPort(page.getXObject());
      }
 catch (      XtentisException e) {
        e.printStackTrace();
      }
      list=new HashSet<String>();
      Util.getForeingKeyInDataModel(list,page.getXObject().getParent(),port);
      Util.setForeignKeys(list);
    }
    if (list.contains(decl.getName())) {
      boolean confirmed=MessageDialog.openConfirm(page.getSite().getShell(),"String_Node_Str","String_Node_Str" + decl.getName() + "String_Node_Str"+ "String_Node_Str");
      if (!confirmed) {
        return Status.CANCEL_STATUS;
      }
    }
    ArrayList<Object> objList=new ArrayList<Object>();
    IStructuredContentProvider provider=(IStructuredContentProvider)page.getTreeViewer().getContentProvider();
    Object[] objs=Util.getAllObject(page.getSite(),objList,provider);
    Util.deleteReference(decl,objs);
    if (schema == null)     schema=((ISchemaContentProvider)page.getTreeViewer().getContentProvider()).getXsdSchema();
    schema.getContents().remove(decl);
    schema.update();
    xsdElem=null;
    page.refresh();
    page.markDirtyWithoutCommit();
  }
 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;
}