Program: 119702
Project: 119702
Buggy source:
@Override public void drop(DropTargetEvent event){
  DropTarget dropTarget=(DropTarget)event.getSource();
  Item targetItem=(Item)event.item;
  if (targetItem == null) {
    return;
  }
  Control control=dropTarget.getControl();
  String row=(String)control.getData("String_Node_Str");
  if (getManager().getFoxComponent().istFileOutputMSXML()) {
    row=getManager().getCurrentSchema();
  }
  LocalDraggedData draggedData=LocalDataTransfer.getInstance().getDraggedData();
  List<Object> dragdedData=draggedData.getTransferableEntryList();
  IMetadataTable table=null;
  if (draggedData.getTable() instanceof IMetadataTable) {
    table=(IMetadataTable)draggedData.getTable();
  }
  FOXTreeNode targetNode=(FOXTreeNode)(targetItem.getData());
  if (dragdedData.size() == 1 && isDropRelatedColumn(event)) {
    IMetadataColumn metaColumn=(IMetadataColumn)dragdedData.get(0);
    targetNode.setDefaultValue(null);
    targetNode.setColumn(metaColumn);
    targetNode.setTable(table);
    targetNode.setRow(row);
    linker.getXMLViewer().refresh(targetNode);
    Display display=linker.getSource().getDisplay();
    Cursor cursor=new Cursor(display,SWT.CURSOR_WAIT);
    linker.getSource().getShell().setCursor(cursor);
    linker.valuedChanged(targetItem);
    linker.getSource().getShell().setCursor(null);
  }
 else   if (dragdedData.size() > 0) {
    DragAndDrogDialog dialog=null;
    if (getManager().getFoxComponent().istWriteJSONField()) {
      dialog=new DragAndDrogDialog(null,true);
    }
 else {
      dialog=new DragAndDrogDialog(null);
    }
    dialog.open();
    if (dialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
      return;
    }
    if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_TEXT)) {
      if (hasElementChildren(targetNode)) {
        List<FOXTreeNode> children=targetNode.getChildren();
        for (        FOXTreeNode foxTreeNode : children) {
          if (!(foxTreeNode instanceof Attribute)) {
            MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
            return;
          }
        }
      }
 else       if (targetNode.getParent() == null) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      IMetadataColumn metaColumn=(IMetadataColumn)dragdedData.get(0);
      targetNode.setColumn(metaColumn);
      targetNode.setDefaultValue(null);
    }
 else     if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_SUBELEMENT)) {
      if (!(targetNode instanceof Element)) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      if (targetNode.getColumn() != null) {
        if (!MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str") + targetNode.getLabel() + "String_Node_Str")) {
          return;
        }
        targetNode.setColumn(null);
      }
      for (      Object obj : dragdedData) {
        IMetadataColumn metaColumn=(IMetadataColumn)obj;
        boolean isContain=false;
        for (        FOXTreeNode node : ((Element)targetNode).getElementChildren()) {
          if (node.getLabel().equals(metaColumn.getLabel())) {
            node.setColumn(metaColumn);
            node.setRow(row);
            node.setTable(table);
            setDefaultFixValue(node);
            isContain=true;
          }
        }
        if (!isContain) {
          FOXTreeNode child=new Element(metaColumn.getLabel());
          child.setColumn(metaColumn);
          child.setTable(table);
          child.setRow(row);
          targetNode.addChild(child);
        }
      }
      setDefaultFixValue(targetNode);
    }
 else     if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_ATTRIBUTE)) {
      if (!(targetNode instanceof Element)) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      for (      Object obj : dragdedData) {
        IMetadataColumn metaColumn=(IMetadataColumn)obj;
        boolean isContain=false;
        for (        FOXTreeNode node : ((Element)targetNode).getAttributeChildren()) {
          if (node.getLabel().equals(metaColumn.getLabel())) {
            node.setColumn(metaColumn);
            node.setTable(table);
            node.setRow(row);
            setDefaultFixValue(node);
            isContain=true;
          }
        }
        if (!isContain) {
          FOXTreeNode child=new Attribute(metaColumn.getLabel());
          child.setColumn(metaColumn);
          child.setTable(table);
          child.setRow(row);
          targetNode.addChild(child);
        }
      }
    }
    if (row != null) {
      targetNode.setRow(row);
      if (!getManager().getFoxComponent().istFileOutputMSXML()) {
        FOXTreeNode root=(FOXTreeNode)linker.getXMLViewer().getTree().getItem(0).getData();
        setTreeNodeRow(root,row);
      }
    }
    linker.getXMLViewer().refresh();
    Display display=linker.getSource().getDisplay();
    Cursor cursor=new Cursor(display,SWT.CURSOR_WAIT);
    linker.getSource().getShell().setCursor(cursor);
    linker.valuedChanged(targetItem);
    linker.getSource().getShell().setCursor(null);
  }
  if (row != null) {
    targetNode.setRow(row);
    if (!getManager().getFoxComponent().istFileOutputMSXML()) {
      FOXTreeNode root=(FOXTreeNode)linker.getXMLViewer().getTree().getItem(0).getData();
      setTreeNodeRow(root,row);
    }
  }
  linker.getXMLViewer().refresh();
  linker.updateLinksStyleAndControlsSelection(control,true);
}

Fixed version (ground truth):
@Override public void drop(DropTargetEvent event){
  DropTarget dropTarget=(DropTarget)event.getSource();
  Item targetItem=(Item)event.item;
  if (targetItem == null) {
    return;
  }
  Control control=dropTarget.getControl();
  String row=(String)control.getData("String_Node_Str");
  if (getManager().getFoxComponent().istFileOutputMSXML()) {
    row=getManager().getCurrentSchema();
  }
  LocalDraggedData draggedData=LocalDataTransfer.getInstance().getDraggedData();
  List<Object> dragdedData=draggedData.getTransferableEntryList();
  IMetadataTable table=null;
  if (draggedData.getTable() instanceof IMetadataTable) {
    table=(IMetadataTable)draggedData.getTable();
  }
  FOXTreeNode targetNode=(FOXTreeNode)(targetItem.getData());
  if (dragdedData.size() == 1 && isDropRelatedColumn(event)) {
    IMetadataColumn metaColumn=(IMetadataColumn)dragdedData.get(0);
    targetNode.setDefaultValue(null);
    targetNode.setColumn(metaColumn);
    targetNode.setTable(table);
    targetNode.setRow(row);
    linker.getXMLViewer().refresh(targetNode);
    Display display=linker.getSource().getDisplay();
    Cursor cursor=new Cursor(display,SWT.CURSOR_WAIT);
    linker.getSource().getShell().setCursor(cursor);
    linker.valuedChanged(targetItem);
    linker.getSource().getShell().setCursor(null);
  }
 else   if (dragdedData.size() > 0) {
    DragAndDrogDialog dialog=null;
    if (getManager().getFoxComponent().istWriteJSONField()) {
      dialog=new DragAndDrogDialog(null,true);
    }
 else {
      dialog=new DragAndDrogDialog(null);
    }
    dialog.open();
    if (dialog.getReturnCode() == IDialogConstants.CANCEL_ID) {
      return;
    }
    if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_TEXT)) {
      if (hasElementChildren(targetNode)) {
        List<FOXTreeNode> children=targetNode.getChildren();
        for (        FOXTreeNode foxTreeNode : children) {
          if (!(foxTreeNode instanceof Attribute)) {
            MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
            return;
          }
        }
      }
 else       if (targetNode.getParent() == null) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      IMetadataColumn metaColumn=(IMetadataColumn)dragdedData.get(0);
      targetNode.setColumn(metaColumn);
      targetNode.setDefaultValue(null);
    }
 else     if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_SUBELEMENT)) {
      if (!(targetNode instanceof Element)) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      if (targetNode.getColumn() != null) {
        if (!MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),Messages.getString("String_Node_Str") + targetNode.getLabel() + "String_Node_Str")) {
          return;
        }
        targetNode.setColumn(null);
      }
      for (      Object obj : dragdedData) {
        IMetadataColumn metaColumn=(IMetadataColumn)obj;
        boolean isContain=false;
        for (        FOXTreeNode node : ((Element)targetNode).getElementChildren()) {
          if (node.getLabel().equals(metaColumn.getLabel())) {
            node.setColumn(metaColumn);
            node.setRow(row);
            node.setTable(table);
            setDefaultFixValue(node);
            isContain=true;
          }
        }
        if (!isContain) {
          FOXTreeNode child=new Element(metaColumn.getLabel());
          child.setColumn(metaColumn);
          child.setTable(table);
          child.setRow(row);
          targetNode.addChild(child);
        }
      }
      setDefaultFixValue(targetNode);
    }
 else     if (dialog.getSelectValue().equals(DragAndDrogDialog.CREATE_AS_ATTRIBUTE)) {
      if (!(targetNode instanceof Element)) {
        MessageDialog.openConfirm(control.getShell(),Messages.getString("String_Node_Str"),"String_Node_Str" + targetNode.getLabel() + "String_Node_Str"+ Messages.getString("String_Node_Str"));
        return;
      }
      for (      Object obj : dragdedData) {
        IMetadataColumn metaColumn=(IMetadataColumn)obj;
        boolean isContain=false;
        for (        FOXTreeNode node : ((Element)targetNode).getAttributeChildren()) {
          if (node.getLabel().equals(metaColumn.getLabel())) {
            node.setColumn(metaColumn);
            node.setTable(table);
            node.setRow(row);
            setDefaultFixValue(node);
            isContain=true;
          }
        }
        if (!isContain) {
          FOXTreeNode child=new Attribute(metaColumn.getLabel());
          child.setColumn(metaColumn);
          child.setTable(table);
          child.setRow(row);
          targetNode.addChild(child);
        }
      }
    }
    if (row != null) {
      targetNode.setRow(row);
      if (!getManager().getFoxComponent().istFileOutputMSXML()) {
        FOXTreeNode root=(FOXTreeNode)linker.getXMLViewer().getTree().getItem(0).getData();
        setTreeNodeRow(root,row);
      }
    }
    linker.getXMLViewer().refresh();
    Display display=linker.getSource().getDisplay();
    Cursor cursor=new Cursor(display,SWT.CURSOR_WAIT);
    linker.getSource().getShell().setCursor(cursor);
    linker.valuedChanged(targetItem);
    linker.getSource().getShell().setCursor(null);
  }
  if (row != null) {
    targetNode.setRow(row);
    if (!getManager().getFoxComponent().istFileOutputMSXML()) {
      FOXTreeNode root=(FOXTreeNode)linker.getXMLViewer().getTree().getItem(0).getData();
      setTreeNodeRow(root,row);
    }
  }
  linker.getXMLViewer().refresh();
  linker.getXMLViewer().expandAll();
  linker.updateLinksStyleAndControlsSelection(control,true);
}