1 19 20 package org.openharmonise.him.dnd; 21 22 import java.awt.Component ; 23 import java.awt.Cursor ; 24 import java.awt.Point ; 25 import java.awt.Toolkit ; 26 import java.awt.dnd.DragGestureEvent ; 27 import java.awt.dnd.DragGestureListener ; 28 import java.awt.dnd.DragGestureRecognizer ; 29 import java.awt.dnd.DragSource ; 30 import java.awt.dnd.DragSourceDragEvent ; 31 import java.awt.dnd.DragSourceDropEvent ; 32 import java.awt.dnd.DragSourceEvent ; 33 import java.awt.dnd.DragSourceListener ; 34 35 import javax.swing.ImageIcon ; 36 37 import org.openharmonise.him.swing.resourcetree.*; 38 import org.openharmonise.vfs.gui.*; 39 40 41 49 public class TreeDragSource 50 implements DragSourceListener , DragGestureListener { 51 52 DragSource m_source; 53 DragGestureRecognizer m_recognizer; 54 ResourceTree m_tree; 55 56 63 public TreeDragSource(ResourceTree tree, Component comp, int actions) { 64 super(); 65 this.m_tree = tree; 66 this.m_source = new DragSource (); 67 this.m_recognizer = this.m_source.createDefaultDragGestureRecognizer(comp, actions, this); 68 } 69 70 73 public void dragEnter(DragSourceDragEvent arg0) { 74 } 75 76 79 public void dragOver(DragSourceDragEvent arg0) { 80 } 81 82 85 public void dropActionChanged(DragSourceDragEvent arg0) { 86 } 87 88 91 public void dragDropEnd(DragSourceDropEvent arg0) { 92 } 93 94 97 public void dragExit(DragSourceEvent arg0) { 98 } 99 100 103 public void dragGestureRecognized(DragGestureEvent dge) { 104 Cursor cursor = Toolkit.getDefaultToolkit().createCustomCursor( ((ImageIcon )IconManager.getInstance().getIcon("16-pointer-drag.gif")).getImage(), new Point (3,1),"COPY"); 105 106 this.m_source.startDrag(dge, cursor, new VirtualFileTransferable( this.m_tree.getSelectedResource().getVFS().getVirtualFile(this.m_tree.getSelectedResource().getFullPath()).getResource() ), this); 107 } 108 109 } | Popular Tags |