00001 package edu.ksu.cis.bandera.pdgslicer.dependency;
00002
00003 import javax.swing.*;
00004 import javax.swing.tree.*;
00005
00006
00007 import java.awt.dnd.*;
00008 import java.awt.datatransfer.*;
00009
00010
00011
00012
00013
00014
00015 public class DraggableMethodTree extends DraggableTree {
00016
00017
00018
00019
00020 public DraggableMethodTree() {
00021 super();
00022 }
00023
00024
00025
00026
00027 public DraggableMethodTree(javax.swing.tree.TreeModel model) {
00028 super(model);
00029 }
00030
00031
00032 public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {
00033 TreePath path = getSelectionPath();
00034 if (path == null) {
00035
00036 currentDraggingTreeNode = null;
00037 draggingTreeNode = false;
00038 System.out.println("Nothing selected - beep");
00039 getToolkit().beep();
00040 } else {
00041 DefaultMutableTreeNode selection = (DefaultMutableTreeNode) path.getLastPathComponent();
00042 currentDraggingTreeNode = new TransferableTreeNode(selection);
00043 draggingTreeNode = true;
00044 dragSource.startDrag(dragGestureEvent, DragSource.DefaultCopyDrop, currentDraggingTreeNode, DraggableMethodTree.this.dragSourceListener);
00045 }
00046 }
00047 }