5 import java.awt.datatransfer.*;
8 import java.util.Iterator;
13 protected static ImageJ ij = null;
14 private static boolean enableDND =
true;
15 protected DataFlavor dFlavor;
17 public void run(String arg) {
18 String vers = System.getProperty(
"java.version");
19 if (vers.compareTo(
"1.3.1") < 0)
22 ij.setDropTarget(null);
23 DropTarget dropTarget =
new DropTarget(ij,
this);
26 public void drop(DropTargetDropEvent dtde) {
27 dtde.acceptDrop(DnDConstants.ACTION_COPY);
29 Transferable t = dtde.getTransferable();
30 if (t.isDataFlavorSupported(DataFlavor.javaFileListFlavor)) {
31 Object data = t.getTransferData(DataFlavor.javaFileListFlavor);
32 Iterator iterator = ((List)data).iterator();
33 while(iterator.hasNext()) {
34 File file = (File)iterator.next();
35 new Opener().open(file.getAbsolutePath());
40 dtde.dropComplete(
false);
43 dtde.dropComplete(
true);
46 public void dragEnter(DropTargetDragEvent dtde) {
47 dtde.acceptDrag(DnDConstants.ACTION_COPY);
50 public void dragOver(DropTargetDragEvent e) {}
51 public void dragExit(DropTargetEvent e) {}
52 public void dropActionChanged(DropTargetDragEvent e) {}