diff -r 757e172c5c5d openide.loaders/src/org/openide/loaders/DataNode.java --- a/openide.loaders/src/org/openide/loaders/DataNode.java Thu Mar 31 17:13:52 2016 +0000 +++ b/openide.loaders/src/org/openide/loaders/DataNode.java Fri Apr 01 15:35:10 2016 +0200 @@ -356,7 +356,7 @@ Node n = l.lookup(Node.class); if (n != null) { Node parentNode = n.getParentNode(); - if (parentNode != null) { + if (parentNode != null && DataNode.isNodeForFolder(parentNode)) { PasteType[] pts = parentNode.getPasteTypes(t); PasteType[] updated = updateParentPasteTypes(pts); return Arrays.asList(updated); @@ -366,6 +366,34 @@ return Collections.emptyList(); } + /** + * Check whether a node represents a file-system folder. + *

+ * Note: Simply checking type for FolderNode is not sufficient, as we need + * to support also FolderNodes wrapped in FilterNodes. + *

+ * + * @param node Node to check. + * @return True if the node represents a folder, false otherwise. + */ + private static boolean isNodeForFolder(Node node) { + Collection fos = node.getLookup().lookupAll(FileObject.class); + if (fos.size() == 1) { + FileObject fo = fos.iterator().next(); + if (fo.isFolder()) { + return true; + } + } + Collection dos = node.getLookup().lookupAll(DataObject.class); + if (dos.size() == 1) { + DataObject dob = dos.iterator().next(); + if (dob.getPrimaryFile().isFolder()) { + return true; + } + } + return false; + } + @NbBundle.Messages({ "# Text appended to action name so that it is clear that the action", "# will be invoked on parent node. For example:",