Prechádzať zdrojové kódy

- fix issue with files in ProjectAssets showing with "unfold triangle"

Normen Hansen 10 rokov pred
rodič
commit
eeb73beb09

+ 10 - 1
jme3-core/src/com/jme3/gde/core/assets/nodes/AssetNode.java

@@ -48,12 +48,21 @@ public class AssetNode extends FilterNode {
     private Node node;
 
     public AssetNode(ProjectAssetManager manager, Node node) {
-        super(node, new AssetChildren(manager, node), createLookupProxy(manager, node));
+        super(node, isFile(node) ? Children.LEAF : new AssetChildren(manager, node), createLookupProxy(manager, node));
         this.node = node;
         enableDelegation(DELEGATE_GET_ACTIONS);
         enableDelegation(DELEGATE_GET_CONTEXT_ACTIONS);
     }
 
+    public static boolean isFile(Node node) {
+        DataObject obj = null;
+        obj = node.getLookup().lookup(DataObject.class);
+        if (obj != null) {
+            return !obj.getPrimaryFile().isFolder();
+        }
+        return false;
+    }
+
     public static Lookup createLookupProxy(ProjectAssetManager manager, Node node) {
         //TODO: This is causing the most silly exception for the most silly problem
         //      due to the most silly warning in netbeans platform