/** Gets right transferable of given nodes (according to given
* drag action) and also converts the transferable.<br>
* Can be called only with correct action constant.
* @return The transferable.
*/
static Transferable getNodeTransferable(Node[] nodes, int dragAction)
throws IOException {
Transferable[] tArray = new Transferable[nodes.length];
for (int i = 0; i < nodes.length; i++) {
if ((dragAction & DnDConstants.ACTION_MOVE) != 0) {
tArray[i] = nodes[i].clipboardCut();
} else {
tArray[i] = nodes[i].drag ();
}
}
Transferable result;
if (tArray.length == 1) {
// only one node, so return regular single transferable
result = tArray[0];
} else {
// enclose the transferables into multi transferable
result = ExternalDragAndDrop.maybeAddExternalFileDnd( new Multi(tArray) );
}
Clipboard c = getClipboard();
if (c instanceof ExClipboard) {
return ((ExClipboard) c).convert(result);
} else {
return result;
}
}
DragDropUtilities.java 文件源码
java
阅读 26
收藏 0
点赞 0
评论 0
项目:incubator-netbeans
作者:
评论列表
文章目录