event.acceptDrop(DnDConstants.ACTION_COPY);
Transferable transferable = event.getTransferable();
MessageCollection messages = new MessageCollection();
try {
List<File> files = (List<File>) transferable.getTransferData(DataFlavor.javaFileListFlavor);
for (File file : files) {
try {
ResourceLocator locator = new ResourceLocator(file.getAbsolutePath());
IGV.getInstance().load(locator, panel);
} catch (DataLoadException de) {
messages.append(de.getMessage());
}
}
String obj = transferable.getTransferData(DataFlavor.stringFlavor).toString();
if (HttpUtils.isRemoteURL(obj)) {
IGV.getInstance().load(new ResourceLocator(obj), panel);
}
if (messages != null && !messages.isEmpty()) {
log.error(messages.getFormattedMessage());
MessageUtils.showMessage(messages.getFormattedMessage());
}
} catch (Exception e) {
String obj = null;
try {
obj = transferable.getTransferData(DataFlavor.stringFlavor).toString();
if (HttpUtils.isRemoteURL(obj)) {
IGV.getInstance().load(new ResourceLocator(obj), panel);
}
} catch (Exception e1) {
log.error(e1);
if (messages != null && !messages.isEmpty()) {
MessageUtils.showMessage(messages.getFormattedMessage());
}
}
}
IGV.getMainFrame().repaint();
event.dropComplete(true);