Program: 139924
Project: 139924
Buggy source:
/** 
 * DOC qzhang Comment method "installDND".
 */
public static void installDND(final Tree targetControl){
  IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  DQRespositoryView findView=(DQRespositoryView)activePage.findView(DQRespositoryView.ID);
  final CommonViewer commonViewer=findView.getCommonViewer();
  final LocalSelectionTransfer transfer=LocalSelectionTransfer.getTransfer();
  int operations=DND.DROP_COPY | DND.DROP_MOVE;
  Transfer[] transfers=new Transfer[]{transfer};
  DropTarget dropTarget=new DropTarget(targetControl,operations);
  dropTarget.setTransfer(transfers);
  DropTargetListener dndListener=new TreeDropTargetEffect(targetControl){
    ISelectionReceiver receiver=null;
    @Override public void dragEnter(    DropTargetEvent event){
      super.dragEnter(event);
      IStructuredSelection selection=(IStructuredSelection)LocalSelectionTransfer.getTransfer().getSelection();
      Object object=selection.getFirstElement();
      if (object instanceof IFile) {
        receiver=new PatternReceiver();
      }
      if (object instanceof TdColumn) {
        receiver=new ColumnReceiver();
      }
      if (receiver == null) {
        event.detail=DND.DROP_NONE;
      }
 else {
        event.feedback=DND.FEEDBACK_EXPAND;
        receiver.doDropValidation(event,commonViewer);
      }
    }
    @Override public void dragOver(    DropTargetEvent event){
      super.dragOver(event);
      receiver.doDropValidation(event,commonViewer);
    }
    @SuppressWarnings("String_Node_Str") @Override public void drop(    DropTargetEvent event){
      int index=targetControl.getItemCount();
      super.drop(event);
      if (event.item == null) {
      }
 else {
        TreeItem item=(TreeItem)event.item;
        TreeItem[] items=targetControl.getItems();
        for (int i=0; i < items.length; i++) {
          if (items[i] == item) {
            index=i;
            break;
          }
        }
      }
      receiver.drop(event,commonViewer,index);
    }
  }
;
  dropTarget.addDropListener(dndListener);
}

Fixed version (ground truth):
/** 
 * DOC qzhang Comment method "installDND".
 */
public static void installDND(final Tree targetControl){
  IWorkbenchPage activePage=PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  DQRespositoryView findView=(DQRespositoryView)activePage.findView(DQRespositoryView.ID);
  final CommonViewer commonViewer=findView.getCommonViewer();
  final LocalSelectionTransfer transfer=LocalSelectionTransfer.getTransfer();
  int operations=DND.DROP_COPY | DND.DROP_MOVE;
  Transfer[] transfers=new Transfer[]{transfer};
  DropTarget dropTarget=new DropTarget(targetControl,operations);
  dropTarget.setTransfer(transfers);
  DropTargetListener dndListener=new TreeDropTargetEffect(targetControl){
    ISelectionReceiver receiver=null;
    @Override public void dragEnter(    DropTargetEvent event){
      super.dragEnter(event);
      IStructuredSelection selection=(IStructuredSelection)LocalSelectionTransfer.getTransfer().getSelection();
      Object object=selection.getFirstElement();
      if (object instanceof IFile) {
        receiver=new PatternReceiver();
      }
      if (object instanceof TdColumn) {
        receiver=new ColumnReceiver();
      }
      if (receiver == null) {
        event.detail=DND.DROP_NONE;
      }
 else {
        event.feedback=DND.FEEDBACK_EXPAND;
        receiver.doDropValidation(event,commonViewer);
      }
    }
    @Override public void dragOver(    DropTargetEvent event){
      super.dragOver(event);
      receiver.doDropValidation(event,commonViewer);
    }
    @SuppressWarnings("String_Node_Str") @Override public void drop(    DropTargetEvent event){
      int index=targetControl.getItemCount();
      super.drop(event);
      if (event.item == null) {
        index=0;
      }
 else {
        TreeItem item=(TreeItem)event.item;
        TreeItem[] items=targetControl.getItems();
        for (int i=0; i < items.length; i++) {
          if (items[i] == item) {
            index=i;
            break;
          }
        }
      }
      receiver.drop(event,commonViewer,index);
    }
  }
;
  dropTarget.addDropListener(dndListener);
}