This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 250134
Collapse All | Expand All

(-)a/openide.loaders/src/org/openide/loaders/DataNode.java (-1 / +29 lines)
Lines 356-362 Link Here
356
            Node n = l.lookup(Node.class);
356
            Node n = l.lookup(Node.class);
357
            if (n != null) {
357
            if (n != null) {
358
                Node parentNode = n.getParentNode();
358
                Node parentNode = n.getParentNode();
359
                if (parentNode != null) {
359
                if (parentNode != null && DataNode.isNodeForFolder(parentNode)) {
360
                    PasteType[] pts = parentNode.getPasteTypes(t);
360
                    PasteType[] pts = parentNode.getPasteTypes(t);
361
                    PasteType[] updated = updateParentPasteTypes(pts);
361
                    PasteType[] updated = updateParentPasteTypes(pts);
362
                    return Arrays.asList(updated);
362
                    return Arrays.asList(updated);
Lines 366-371 Link Here
366
        return Collections.emptyList();
366
        return Collections.emptyList();
367
    }
367
    }
368
368
369
    /**
370
     * Check whether a node represents a file-system folder.
371
     * <p>
372
     * Note: Simply checking type for FolderNode is not sufficient, as we need
373
     * to support also FolderNodes wrapped in FilterNodes.
374
     * </p>
375
     *
376
     * @param node Node to check.
377
     * @return True if the node represents a folder, false otherwise.
378
     */
379
    private static boolean isNodeForFolder(Node node) {
380
        Collection<? extends FileObject> fos = node.getLookup().lookupAll(FileObject.class);
381
        if (fos.size() == 1) {
382
            FileObject fo = fos.iterator().next();
383
            if (fo.isFolder()) {
384
                return true;
385
            }
386
        }
387
        Collection<? extends DataObject> dos = node.getLookup().lookupAll(DataObject.class);
388
        if (dos.size() == 1) {
389
            DataObject dob = dos.iterator().next();
390
            if (dob.getPrimaryFile().isFolder()) {
391
                return true;
392
            }
393
        }
394
        return false;
395
    }
396
369
    @NbBundle.Messages({
397
    @NbBundle.Messages({
370
        "# Text appended to action name so that it is clear that the action",
398
        "# Text appended to action name so that it is clear that the action",
371
        "# will be invoked on parent node. For example:",
399
        "# will be invoked on parent node. For example:",

Return to bug 250134