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 - org.netbeans.api.fileinfo.FolderSegment
Summary: org.netbeans.api.fileinfo.FolderSegment
Status: REOPENED
Alias: None
Product: projects
Classification: Unclassified
Component: Generic Infrastructure (show other bugs)
Version: 7.2
Hardware: All All
: P3 normal (vote)
Assignee: Tomas Stupka
URL:
Keywords: API
Depends on:
Blocks: 52271 210315 215264
  Show dependency tree
 
Reported: 2012-04-12 03:25 UTC by Jesse Glick
Modified: 2016-07-07 08:55 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.