This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 242643

Summary: When you drag and drop files from the Projects window, they should export DataFlavor.javaFileListFlavor
Product: platform Reporter: kitfox <kitfox>
Component: Data SystemsAssignee: Jaroslav Havlin <jhavlin>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description kitfox 2014-03-07 02:22:35 UTC
I've been adding drag-and-drop support to a Java app I've written.  I created a form with a JTextField and added my own TransferHandler to it.  I'd like to be able to drag and drop files from the Projects window onto this field and have the text field automatically fill in the full name of the file.

While the TransferSupport returns true when I query it with 

    support.isDataFlavorSupported(DataFlavor.javaFileListFlavor)

when I get the data with 

    Object data = xfer.getTransferData(DataFlavor.javaFileListFlavor);

I am given an empty list.  The following exception is also thrown whenever I do a drag-and-drop from the projects list into my application:

Exception "java.lang.ClassNotFoundException: org.openide.loaders.DataObject"while constructing DataFlavor for: application/x-java-openide-dataobjectdnd; mask=1; class=org.openide.loaders.DataObject


It would be nice if the drag and drop support was extended to include DataFlavor.javaFileListFlavor.
Comment 1 Jaroslav Havlin 2015-11-06 14:16:19 UTC
I can reproduce the bug. Method isDataFlavorSupported returns true for DataFlavor.javaFileListFlavor when pasting a file from NetBeans to my application, but getTransferData(DataFlavor.javaFileListFlavor) returns null.

Data flavor javaFileListFlavor is added to the transferable in method DataNode.addExternalFileTransferable(), but retrieving of the data value in the second application is broken.

I'm not sure whether this is a bug in NetBeans or in JDK.
It'll require deeper investigation.

Thank you for reporting.

Product Version: NetBeans IDE 8.1 (Build 201510222201)
Java: 1.8.0_60; Java HotSpot(TM) 64-Bit Server VM 25.60-b23
Runtime: Java(TM) SE Runtime Environment 1.8.0_60-b27
System: Mac OS X version 10.10.5 running on x86_64; UTF-8; en_US (nb)