Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

DraggableHierTree.java

00001 package edu.ksu.cis.bandera.pdgslicer.dependency;
00002 
00003 import javax.swing.*;
00004 import javax.swing.tree.*;
00005 import java.awt.dnd.*;
00006 import java.awt.datatransfer.*;
00007 //import ca.mcgill.sable.soot.*;
00008 import edu.ksu.cis.bandera.annotation.*;
00009 import edu.ksu.cis.bandera.pdgslicer.datastructure.*;
00010 /**
00011  * Insert the type's description here.
00012  * Creation date: (00-11-16 14:21:20)
00013  * @author: 
00014  */
00015 public class DraggableHierTree extends DraggableTree {
00016 /**
00017  * HierTree constructor comment.
00018  */
00019 public DraggableHierTree() {
00020     super();
00021 }
00022 /**
00023  * HierTree constructor comment.
00024  * @param model javax.swing.tree.TreeModel
00025  */
00026 public DraggableHierTree(javax.swing.tree.TreeModel model) {
00027     //super(model);
00028 }
00029 // DragGestureListener
00030 
00031 public void dragGestureRecognized(DragGestureEvent dragGestureEvent) {
00032     TreePath path = getSelectionPath();
00033     if (path == null) {
00034         // Nothing selected, nothing to drag
00035         currentDraggingTreeNode = null;
00036         draggingTreeNode = false;
00037         System.out.println("Nothing selected - beep");
00038         getToolkit().beep();
00039     } else {
00040         DefaultMutableTreeNode selection = (DefaultMutableTreeNode) path.getLastPathComponent();
00041         Object userObject = selection.getUserObject();
00042         if (userObject instanceof FieldDeclarationAnnotation) {
00043             FieldDeclarationAnnotation fda = (FieldDeclarationAnnotation) userObject;
00044             SliceVariable sf = new SliceField(fda.getSootField().getDeclaringClass(), fda.getSootField());
00045             currentDraggingTreeNode = new TransferableSliceVariable(sf);
00046             draggingTreeNode = true;
00047             dragSource.startDrag(dragGestureEvent, DragSource.DefaultCopyDrop, currentDraggingTreeNode, DraggableHierTree.this.dragSourceListener);
00048         } else {
00049             System.out.println("Select wrong node - beep");
00050             currentDraggingTreeNode = null;
00051             draggingTreeNode = false;
00052             getToolkit().beep();
00053         }
00054     }
00055 }
00056 }

Generated at Thu Feb 7 06:44:38 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001