this.mainFrame = mainFrame;
for (DataFlavor flavor : dataFlavors) { if (flavor.isFlavorJavaFileListType() || flavor.isFlavorTextType()) { return true; } } return false;
if (path.startsWith("file://")) path = path.substring("file://".length()); if (path.indexOf('\n") != -1) path = path.substring(0, path.indexOf('\n")); if (path.indexOf('\r") != -1) path = path.substring(0, path.indexOf('\r")); return path;
try { for (DataFlavor flavor : transferable.getTransferDataFlavors()) { if (flavor.isFlavorJavaFileListType()) { Object data = transferable.getTransferData(DataFlavor.javaFileListFlavor); //noinspection unchecked final File file = ((List<File>) data).get(0); mainFrame.open(file).execute(); return true; } else if (flavor.isFlavorTextType()) { if (flavor.getRepresentationClass() == String.class) { String mime = flavor.getMimeType(); DataFlavor flave = new DataFlavor(mime); Object data = transferable.getTransferData(flave); final String path = convertPath(data.toString()); mainFrame.open(new File(path)).execute(); return true; } } } } catch (UnsupportedFlavorException e) { // Ignore } catch (MalformedURLException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return false;