Program: 136861
Project: 136861
Buggy source:
/** 
 * DOC xqliu Comment method "installDND". bug 8791 2009-08-31.
 * @param myTable
 */
public static void installDND(final Table 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 TableDropTargetEffect(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 DBColumnRepNode) {
        receiver=new ColumnReceiverTable();
      }
      if (receiver == null) {
        event.detail=DND.DROP_NONE;
      }
 else {
        event.feedback=DND.FEEDBACK_EXPAND;
        receiver.doDropValidation(event,commonViewer);
      }
    }
    @Override public void dragOver(    DropTargetEvent event){
      if (receiver == null) {
        return;
      }
      super.dragOver(event);
      receiver.doDropValidation(event,commonViewer);
    }
    @SuppressWarnings("String_Node_Str") @Override public void drop(    DropTargetEvent event){
      if (receiver == null) {
        return;
      }
      int index=targetControl.getItemCount();
      super.drop(event);
      if (event.item == null) {
        index=-1;
      }
 else {
        TableItem item=(TableItem)event.item;
        TableItem[] 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 xqliu Comment method "installDND". bug 8791 2009-08-31.
 * @param myTable
 */
public static void installDND(final Table 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 TableDropTargetEffect(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 DBColumnRepNode) {
        receiver=new ColumnReceiverTable();
      }
      if (receiver == null) {
        event.detail=DND.DROP_NONE;
      }
 else {
        event.feedback=DND.FEEDBACK_EXPAND;
        receiver.doDropValidation(event,commonViewer);
      }
    }
    @Override public void dragOver(    DropTargetEvent event){
      if (receiver == null) {
        return;
      }
      super.dragOver(event);
      receiver.doDropValidation(event,commonViewer);
    }
    @Override public void drop(    DropTargetEvent event){
      if (receiver == null) {
        return;
      }
      int index=targetControl.getItemCount();
      super.drop(event);
      if (event.item == null) {
        index=-1;
      }
 else {
        TableItem item=(TableItem)event.item;
        TableItem[] 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);
}