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.

Bug 211060

Summary: org.netbeans.api.fileinfo.FolderSegment
Product: projects Reporter: Jesse Glick <jglick>
Component: Generic InfrastructureAssignee: Tomas Stupka <tstupka>
Status: REOPENED ---    
Severity: normal CC: jbecicka, ralphbenjamin
Priority: P3 Keywords: API
Version: 7.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on:    
Bug Blocks: 52271, 210315, 215264    

Description Jesse Glick 2012-04-12 03:25:49 UTC
For the purpose of fixing Java refactoring-related code to treat reduced tree mode naturally, it would be helpful to have an explicit representation of a segment of a tree:

src/
src/org/
src/org/here/
src/org/here/Main.java
src/org/here/api/
src/org/here/api/Api.java
src/org/here/internal/
src/org/here/internal/Impl.java

DataFolder adequately represents src/org/here/ and all its recursive contents; NonRecursiveFolder represents src/org/here/* (i.e. just Main.java). To treat the org.here subtree of src/, the DataFolder works for most purposes (i.e. searching, or adding things) but fails for a few purposes (moving or deleting).

Could perhaps have something like the following in a Node.lookup:

public interface FolderSegment {
  FileObject top();
  FileObject bottom();
}

with the invariants

bottom.isFolder()
top==bottom || FileUtil.isParentOf(top, bottom)
∀ FileObject f: FileUtil.isParentOf(top, f) → f==bottom || FileUtil.isParentOf(f, bottom) || FileUtil.isParentOf(bottom, f)

Thus top=src/org/ and bottom=src/org/here/ is a legitimate segment, but top=src/org/ and bottom=src/org/here/api/ is not (pick f=src/org/here/Main.java for example).

More descriptive terminology welcome; I am not sure if the above concept has a standard name.

The node would typically include bottom (and/or DataFolder.findFolder(bottom)) in its lookup as well, for callers which do not care about the top and need not use this API.
Comment 1 Martin Balin 2016-07-07 08:38:06 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss
Comment 2 Ralph Ruijs 2016-07-07 08:55:49 UTC
This still needs a proper fix.