mbien commented on code in PR #9629:
URL: https://github.com/apache/netbeans/pull/9629#discussion_r4083487664


##########
ide/projectui/src/org/netbeans/modules/project/ui/actions/SetMainProject.java:
##########
@@ -162,7 +162,7 @@ public void run() {
         "LBL_NoneMainProject_Name=&None"
     })
     private void createSubMenu(Project[] projects) {    
-        Arrays.sort(projects, OpenProjectList.projectByDisplayName());

Review Comment:
   > Please, let me show an annecdoctical evidence of the randomness of the 
sorting by display name
   
   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.
   
   <img width="310" height="245" alt="image" 
src="https://github.com/user-attachments/assets/eea78984-e249-4155-8b1a-4a4da667316c";
 />
   
   
   
   > The ordering by path makes sense!
   
   yes I agree. I thought about this and tested that already back when I looked 
at https://github.com/apache/netbeans/pull/9602#discussion_r3939445752
   
   
   
   Since it sorts by String path, it should produce pretty good results. 
([Path.compareTo()](https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/nio/file/Path.html#compareTo(java.nio.file.Path))
 would have been slightly more dangerous - I remember the showstopper 
https://github.com/apache/netbeans/discussions/6361 which was hard to debug 
since the cause was completely removed from the symptom (that one was about 
weird `File` instances - `Path` may be backed by different file systems))



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to