Don't display __pycache__ folder in project view
authorJulien Enselme <jenselme@netbeans.org>
Fri, 11 Sep 2015 14:35:00 +0200
changeset 183036fbd2e6ee661
parent 18302 b9b119679ed6
child 18304 a075d988c9d5
Don't display __pycache__ folder in project view
python.project2/src/org/netbeans/modules/python/project2/ui/PackageViewChildren.java
     1.1 --- a/python.project2/src/org/netbeans/modules/python/project2/ui/PackageViewChildren.java	Mon Aug 31 15:31:15 2015 -0400
     1.2 +++ b/python.project2/src/org/netbeans/modules/python/project2/ui/PackageViewChildren.java	Fri Sep 11 14:35:00 2015 +0200
     1.3 @@ -305,7 +305,7 @@
     1.4              }
     1.5              return;
     1.6          }
     1.7 -        
     1.8 +
     1.9          while ( FileUtil.isParentOf( root, parent ) ) {
    1.10              PackageNode n = get( parent );
    1.11              if ( n != null && n.isLeaf() ) {
    1.12 @@ -320,6 +320,12 @@
    1.13      // in on place (PackageView) 
    1.14      void add(FileObject fo, boolean empty, boolean refreshImmediately) {
    1.15          String path = FileUtil.getRelativePath( root, fo );
    1.16 +        // Special case for __pycache__: it should never contain code, we can
    1.17 +        // safely ignore it.
    1.18 +        if (path.endsWith("__pycache__")) {
    1.19 +            return;
    1.20 +        }
    1.21 +
    1.22          assert path != null : "Adding wrong folder " + fo +"(valid="+fo.isValid()+")"+ "under root" + this.root + "(valid="+this.root.isValid()+")";
    1.23          if ( get( fo ) == null ) { 
    1.24              names2nodes.put( path, empty ? NODE_NOT_CREATED_EMPTY : NODE_NOT_CREATED );