Repository navigation
Consistently sort Projects and Files view by path #9629
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -75,7 +75,7 @@ public class SetMainProject extends ProjectAction implements PropertyChangeListe | |||||||||||||||||||||
| private static Preferences prefs() { | ||||||||||||||||||||||
| return NbPreferences.forModule(SetMainProject.class); | ||||||||||||||||||||||
| } | ||||||||||||||||||||||
| private static RequestProcessor RP = new RequestProcessor(SetMainProject.class); | ||||||||||||||||||||||
| private static final RequestProcessor RP = new RequestProcessor(SetMainProject.class); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| protected JMenu subMenu; | ||||||||||||||||||||||
| private boolean empty; | ||||||||||||||||||||||
|
|
@@ -162,7 +162,7 @@ public void run() { | |||||||||||||||||||||
| "LBL_NoneMainProject_Name=&None" | ||||||||||||||||||||||
| }) | ||||||||||||||||||||||
| private void createSubMenu(Project[] projects) { | ||||||||||||||||||||||
| Arrays.sort(projects, OpenProjectList.projectByDisplayName()); | ||||||||||||||||||||||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, let me show an annecdoctical evidence of the randomness of the sorting by display name. Sometimes I am mixing projects from multiple repositories. Today I had projects from NetBeans own code base, as well as projects from GraalVM repository open. This is how it looks like in NetBeans 31:
It is easy to recognize what projects are coming from which repository as they have different icons. But the order! Because the projects are sorted by display name, those two independent sets of projects are intermixed with each other. The ordering is random, basically. Today I decided to switch to the latest development version and voilá:
The ordering by path makes sense! First of all there is a group of projects from the GraalVM repository, then there is the group of projects from the NetBeans repository. There is no nesting in the hierarchy of those groups (that'd be subject of #9624 for example), but even the grouping by path is a tremendous step forward. PS: I've been so shocked realizing how better the ordering is! I've just had to install the (already deleted) old NetBeans again to take the picture. As it speaks for thousand of words.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I believe seeing somewhere lazy/non-blocking init mechanisms where display names were used only when available. If its there it is used, if not it falls back to something else. I an imagine - if used for sorting - it can be placed at the wrong spot initially - until the full list is refreshed. the group-by-project dropdown of the file list behaves similarly. If it can't list all projects fast enough it will display a simple list on very first open. Once the cached, it will properly group. NB has a lot of caching behind the scenes.
yes I agree. I thought about this and tested that already back when I looked at #9602 (comment) Since it sorts by String path, it should produce pretty good results. (Path.compareTo() would have been slightly more dangerous - I remember the showstopper #6361 which was hard to debug since the cause was completely removed from the symptom (that one was about weird
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||||||||||||||||||
| Arrays.sort(projects, OpenProjectList.projectByPath()); | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| // Enable disable the action according to number of open projects | ||||||||||||||||||||||
| if (projects.length == 0) { | ||||||||||||||||||||||
|
|
||||||||||||||||||||||



There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue @mclaborn opened at #9813 is probably a better place for ongoing discussion than a merged PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where would you like my comments, here or in #9813 ?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Neil is right. The issue is a better place. I didn't notice the issue existence before asking here. The only worry I have is the "threaded discussion" won't be possible in the issue. But yes, please, answer there. Or even modify the issue description, with a text that answers my questions.