use of com.sldeditor.datasource.extension.filesystem.dataflavour.TransferredData in project sldeditor by robward-scisys.
the class TreeTransferHandler method exportDone.
/*
* (non-Javadoc)
*
* @see javax.swing.TransferHandler#exportDone(javax.swing.JComponent, java.awt.datatransfer.Transferable, int)
*/
@Override
protected void exportDone(JComponent source, Transferable data, int action) {
if (!(source instanceof JTree) || (data == null)) {
return;
}
JTree tree = (JTree) source;
NodeInterface destinationTreeNode = (NodeInterface) tree.getLastSelectedPathComponent();
DefaultTreeModel model = (DefaultTreeModel) tree.getModel();
DataFlavor destDataFlavour = destinationTreeNode.getDataFlavour();
TransferredData transferredData = null;
try {
transferredData = (TransferredData) data.getTransferData(destDataFlavour);
} catch (UnsupportedFlavorException e) {
ConsoleManager.getInstance().exception(this, e);
} catch (IOException e) {
ConsoleManager.getInstance().exception(this, e);
}
if (action == MOVE) {
DataFlavourManager.deleteNodes(model, transferredData);
}
if (action != NONE) {
DataFlavourManager.displayMessages(destinationTreeNode, transferredData, action);
}
setDragging(false);
}
Aggregations