Support for project JDK settings.
This PR is based on prototype done by @lahodaj . I have just updated it to fit into the current codebase + integrated with the new JDK configuration command.
- NBLS now has a new setting:
netbeans.project.jdkhome. This holds a path to a JDK that is used as a default platform. - to avoid possible issues with default platform changing (i.e. changes from JDK21 to JDK8, ouch!), NBLS is still restarted when
netbeans.project.jdhomechanges
The Project Runtime Java setting in JDK Configuration command was changed, so it configures both JDK table in java.configuration.runtimes (JDT) and netbeans.project.jdkhome (NBLS).
// cc: @jisedlac -- pls review, can't put you as a reviewer.
Currently the feature is designed to provide one item/checkbox per setting. It displays the setting key and the current value. This way we can use the first step of the "wizard" as an immediate overview of the current settings.
If I understand correctly, you want to merge two different settings for the Java Runtime for Projects - the current for RH and a new one for NBLS. How will be the other setting key and its value displayed in the first step? It's not clear from the provided screenshot.
I understand the motivation to join the related settings into one item, but that's not the way it's designed right now. Note that the Maven Runtime JAVA_HOME setting also controls the JDK used for running Maven projects. Using the suggested approach, you should probably merge this one, too.
I'm not ready to agree with the current solution. We should either discuss in more details to make it consistent with all the other settings, or start with a separate item/checkbox if we need to deliver something asap.
OK, to summarize offline discussion:
- currently the feature is designed as 'UI to change preference items'. Following this course, the setting for NBLS should be separate item in the list.
Looking at the overall user experience:
- when RH+NBLS are both active (as it is for example for oci-devops extension users), settings of those should be consistent.
- since the user can work independently in the vscode Terminal window, or execute maven commands from Projects view (Maven for Java extension), even integrated terminal settings and Maven terminal settings should be somehow consistent with the
java.configuration.runtimesandnetbeans.project.jdkhomeso Maven runs the same way
The current PR implementation mixes those two approaches (does not separate settings, and does not ensure complete consistency).
Let's discuss what path should be followed.
Thanks for doing this, BTW!
I reworked the PR as discussed in the conversation. Now there are separate settings for project JDKs for RH and NBLS:
I updated the NBLS runtime property to machine-overridable and allowed its definition in workspace scope.
Rebased on latest master, retrofitted to handle #7555 - if projectJdk is defined, it's compared against project settings. If undefined, the NBLS runtime jdk is compared.
@petrovic-d pls review the changes in JDK validation.
Nitpick: I would rename this method parameters to give it a bit more context. Maybe languageServerJavaPath and projectJavaPath, but it's up to you.
Other than that it looks good to me.