diff --git a/openide.explorer/src/org/openide/explorer/view/OutlineView.java b/openide.explorer/src/org/openide/explorer/view/OutlineView.java --- a/openide.explorer/src/org/openide/explorer/view/OutlineView.java +++ b/openide.explorer/src/org/openide/explorer/view/OutlineView.java @@ -44,6 +44,7 @@ import java.awt.Component; import java.awt.Point; import java.awt.Rectangle; +import java.awt.datatransfer.Transferable; import java.awt.event.ActionEvent; import java.awt.event.MouseEvent; import java.awt.dnd.DnDConstants; @@ -734,6 +735,16 @@ return allowedDropActions; } + /** Actions constants from {@link java.awt.dnd.DnDConstants}. + * @param t The transferable for which the allowed drop actions are requested, + * or null to get actions for the creation of DropTarget for the view. + * @return int representing set of actions which are allowed when dropping + * into the asociated component. By default it returns {@link #getAllowedDropActions()}. + */ + protected int getAllowedDropActions(Transferable t) { + return getAllowedDropActions(); + } + /** Sets allowed actions for dropping. * @param actions new allowed drop actions, using {@link java.awt.dnd.DnDConstants} */ diff --git a/openide.explorer/src/org/openide/explorer/view/OutlineViewDropSupport.java b/openide.explorer/src/org/openide/explorer/view/OutlineViewDropSupport.java --- a/openide.explorer/src/org/openide/explorer/view/OutlineViewDropSupport.java +++ b/openide.explorer/src/org/openide/explorer/view/OutlineViewDropSupport.java @@ -161,7 +161,7 @@ ExplorerDnDManager.getDefault().setMaybeExternalDragAndDrop( true ); int dropAction = dtde.getDropAction(); - int allowedDropActions = view.getAllowedDropActions(); + int allowedDropActions = view.getAllowedDropActions(dtde.getTransferable()); dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( dropAction, allowedDropActions); @@ -385,12 +385,12 @@ if( null == nodes ) return; int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( - dtde.getDropAction(), view.getAllowedDropActions() + dtde.getDropAction(), view.getAllowedDropActions(dtde.getTransferable()) ); for (int i = 0; i < nodes.length; i++) { if ( - ((view.getAllowedDropActions() & dropAction) == 0) || + ((view.getAllowedDropActions(dtde.getTransferable()) & dropAction) == 0) || !DragDropUtilities.checkNodeForAction(nodes[i], dropAction) ) { // this action is not supported @@ -583,7 +583,7 @@ } // Test to see if the target node supports the drop action - if ((view.getAllowedDropActions() & dropAction) == 0) { + if ((view.getAllowedDropActions(dndEventTransferable) & dropAction) == 0) { return false; } @@ -640,7 +640,7 @@ Node[] dragNodes = ExplorerDnDManager.getDefault().getDraggedNodes(); int dropAction = ExplorerDnDManager.getDefault().getAdjustedDropAction( - dtde.getDropAction(), view.getAllowedDropActions() + dtde.getDropAction(), view.getAllowedDropActions(dtde.getTransferable()) ); if (!canDrop(dropNode, dropAction, dtde.getTransferable())) {