sdedic commented on code in PR #5158:
URL: https://github.com/apache/netbeans/pull/5158#discussion_r1065481089


##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {

Review Comment:
   I'd advise to split this UI - related action from the data level. Reason: in 
headless / LSP / embedded scenario, the distribution could reimplement the 
chooser somehow, but leave all other logic intact
   
   Second thought: currently the JRPB is just a tiny wrapper around 
JavaPlatform - so potential override is just as simple. I assume it is because 
it is 'java artifact' in a lang-agnostic layer. If that's the intention, please 
make a doc comment in the JRPB implementation and the JavaRuntime API stating 
that, so no one gets clever idea to bloat the wrapper in the future :)



##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {
+
+    public static String DEFAULT_RUNTIME_ID = "default_platform"; //NOI18N
+    
+    Map<String, JavaRuntime> getAvailableRuntimes();
+
+    default Optional<Runnable> manageRuntimesAction() {
+        return Optional.empty();
+    }
+
+    default void addChangeListener(ChangeListener l) {}
+    default void removeChangeListener(ChangeListener l) {}
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, File 
javaHome) {
+        return new JavaRuntime(id, null, javaHome);
+    }
+
+    public static JavaRuntime createJavaRuntime(@NonNull String id, String 
displayName, File javaHome) {
+        return new JavaRuntime(id, displayName, javaHome);
+    }
+
+    public final class JavaRuntime implements Comparable<JavaRuntime> {

Review Comment:
   I'd add a Lookup to the Runtime, so java-aware clients might eventually find 
the actual `JavaPlatform` and can work with its specifics.
   
   There's JavaRunUtils that can extract JavaPlatform, but is not public.



##########
extide/gradle/src/org/netbeans/modules/gradle/spi/execute/JavaRuntimeManager.java:
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.modules.gradle.spi.execute;
+
+import java.io.File;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Optional;
+import javax.swing.event.ChangeListener;
+import org.netbeans.api.annotations.common.NonNull;
+
+/**
+ *
+ * @author Laszlo Kishalmi
+ */
+public interface JavaRuntimeManager {

Review Comment:
   If intending to merge before NB17 branching, javadocs + apichanges should be 
added for this + other API changes. Maybe some overview javadoc that explains 
purpose / difference between JavaPlatform and JavaRuntime.



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