DataFlavor[] df = t.getTransferDataFlavors();
if (df == null || df.length == 0)
return;
for (int i = 0; i < df.length; ++i) {
DataFlavor flavor = df[i];
Object o = null;
if (true) {
Logger.info("df " + i + " flavor " + flavor);
Logger.info(" class: " + flavor.getRepresentationClass().getName());
Logger.info(" mime : " + flavor.getMimeType());
}
if (flavor.getMimeType().startsWith("text/uri-list")
&& flavor.getRepresentationClass().getName().equals(
"java.lang.String")) {
/*
* This is one of the (many) flavors that KDE provides: df 2 flavour
* java.awt.datatransfer.DataFlavor[mimetype=text/uri-list;
* representationclass=java.lang.String] java.lang.String String: file
* :/home/egonw/data/Projects/SourceForge/Jmol/Jmol-HEAD/samples/
* cml/methanol2.cml
*
* A later KDE version gave me the following. Note the mime!! hence the
* startsWith above
*
* df 3 flavor java.awt.datatransfer.DataFlavor[mimetype=text/uri-list
* ;representationclass=java.lang.String] class: java.lang.String mime :
* text/uri-list; class=java.lang.String; charset=Unicode
*/
try {
o = null;
if (!isAccepted)
dtde.acceptDrop(DnDConstants.ACTION_COPY_OR_MOVE);
isAccepted = true;
o = t.getTransferData(flavor);
} catch (Exception e) {
Logger.error(null, e);
}
if (o instanceof String) {
if (Logger.debugging) {
Logger.debug(" String: " + o.toString());
}
loadFile(o.toString());
dtde.getDropTargetContext().dropComplete(true);
return;
}
} else if (flavor.getMimeType().equals(
"application/x-java-serialized-object; class=java.lang.String")) {
/*
* This is one of the flavors that jEdit provides:
*