You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by "neilcsmith-net (via GitHub)" <gi...@apache.org> on 2026/06/23 09:02:45 UTC
[PR] Open files from imported projects on first run after update. [netbeans]
neilcsmith-net opened a new pull request, #9464:
URL: https://github.com/apache/netbeans/pull/9464
Open files from imported projects on first run after update. This follows on from #9449 and uses the now imported attributes to maintain the open files after updating the IDE. This (partly) resolves #9443
The code first checks whether any editors are already open, otherwise it interferes with the last focused tab on subsequent runs. The other option would be to check for first run after update, but I'm not sure we have an easy way to do that?
The real project is extracted from the project lookup as the configuration cannot be read using the ergonomics wrapper project. (bug??)
Draft for now - needs more testing.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4788290311
Thanks @mbien
I've pushed an update that checks and stores the build number so that this only triggers on first run after import. I think that might be more efficient and better matches the purpose of this change?
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4834650808
Unless further comments will aim to merge tomorrow.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4790665441
I've added an extra note that explains why I said it partly resolves the issue.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3467886659
##########
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:
i think we can swap left and right here
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3468091287
##########
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:
Yes, but the side effect is required by this check the second time you run the IDE!
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3467987983
##########
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:
No, we can't. The check has side effects.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net merged PR #9464:
URL: https://github.com/apache/netbeans/pull/9464
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4790249130
I didn't mind the first version since it ran in ~1ms on EDT which is probably not noticeable.
The only suggestion I would have had was to change `findFirst()` into `findAny()`. Once done, a jackpot rule I had active matched and it could be simplified into:
```java
boolean hasEditor = wman.getModes().stream()
.filter(mode -> wman.isEditorMode(mode))
.flatMap(m -> Stream.of(wman.getOpenedTopComponents(m)))
.anyMatch(tc -> tc.getLookup().lookup(DataObject.class) != null);
```
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4790580985
Thanks. I should have used `anyMatch` (not thinking - I blame the heat!) However, the primary reason I changed is not performance, but to ensure it definitely only runs the first time when dealing with an imported context. After that standard window support takes over. It couldn't be a boolean because that would be imported as-is - needs to be something that differentiates the running IDE version from the one where the data was written. I checked and this also works better and as expected with `Tools / Options / Import...` after first run.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
neilcsmith-net commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3468091287
##########
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:
No, but the side effect is required inside this check the second time you run the IDE!
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3468035802
##########
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:
yes but the side effects are not required by anything outside of the check itself.
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4790590703
maybe worth mentioning that this will only open files which actually belong to a project. E.g it didn't open `.github/workflows/main.yaml`
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "neilcsmith-net (via GitHub)" <gi...@apache.org>.
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on code in PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#discussion_r3468384802
##########
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:
I don't see how this would be a problem but it isn't an important change anyway
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: [PR] Open files from imported projects on first run after update. [netbeans]
Posted by "mbien (via GitHub)" <gi...@apache.org>.
mbien commented on PR #9464:
URL: https://github.com/apache/netbeans/pull/9464#issuecomment-4782911513
seems to work pretty well!
--
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: notifications-unsubscribe@netbeans.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists