neilcsmith-net commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3468481381


##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -428,15 +429,37 @@ private void updateGlobalState() {
             }
             });
             
-            INSTANCE.pchSupport.firePropertyChange(PROPERTY_OPEN_PROJECTS, new 
Project[0], lazilyOpenedProjects.toArray(new Project[0]));
+            Project[] opened = lazilyOpenedProjects.toArray(Project[]::new);
+            INSTANCE.pchSupport.firePropertyChange(PROPERTY_OPEN_PROJECTS, new 
Project[0], opened);
             Project main = INSTANCE.mainProject;
             if (main != null) { // else PROPERTY_MAIN_PROJECT would be fired 
spuriously
                 INSTANCE.pchSupport.firePropertyChange(PROPERTY_MAIN_PROJECT, 
null, main);
             }
 
+            if (checkFirstRun() && opened.length > 0) {

Review Comment:
   Because it'll change the user's focused tab.  That's the reason either of 
these checks were there, as on a subsequent run the referenced files are all 
open anyway.  However, when an already opened file is re-"opened", it is 
brought to the front.  This happens for each file in a not necessarily useful 
order.  Checking if the opened projects array is empty before scheduling the 
task was an additional optimization.  The check for first run / imported data, 
and making sure it doesn't rerun on subsequent runs, are the important bit.  I 
should have called this method something else!



-- 
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