You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by ne...@apache.org on 2021/08/23 09:40:59 UTC

[netbeans] branch delivery updated: Fix silent errors in Disco support when no valid response for quick selection.

This is an automated email from the ASF dual-hosted git repository.

neilcsmith pushed a commit to branch delivery
in repository https://gitbox.apache.org/repos/asf/netbeans.git


The following commit(s) were added to refs/heads/delivery by this push:
     new c9e194b  Fix silent errors in Disco support when no valid response for quick selection.
     new 1bca448  Merge pull request #3104 from neilcsmith-net/disco-validate-quickpkg
c9e194b is described below

commit c9e194bc914418f775a057337b8cbe52b3891087
Author: Neil C Smith <ne...@apache.org>
AuthorDate: Wed Aug 11 15:35:05 2021 +0100

    Fix silent errors in Disco support when no valid response for quick selection.
    
    If quick selection, show Searching... text and wait for Disco response before
    enabling next button in wizard. Show error message and keep next button disabled
    if Disco lookup fails.
---
 .../netbeans/modules/java/disco/BrowsePanel.java   | 31 +++++++++++++---------
 .../modules/java/disco/BrowseWizardPanel.java      |  2 +-
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/java/java.disco/src/org/netbeans/modules/java/disco/BrowsePanel.java b/java/java.disco/src/org/netbeans/modules/java/disco/BrowsePanel.java
index 744dff4..fa69532 100644
--- a/java/java.disco/src/org/netbeans/modules/java/disco/BrowsePanel.java
+++ b/java/java.disco/src/org/netbeans/modules/java/disco/BrowsePanel.java
@@ -19,26 +19,28 @@
 package org.netbeans.modules.java.disco;
 
 import static org.netbeans.modules.java.disco.SwingWorker2.submit;
+
 import java.io.File;
 import javax.swing.JFileChooser;
 import org.checkerframework.checker.guieffect.qual.UIEffect;
 import org.checkerframework.checker.nullness.qual.NonNull;
+import org.openide.util.NbBundle;
 
+@NbBundle.Messages({
+    "DiscoBrowsePanel.searching=Searching...",
+    "DiscoBrowsePanel.error=Requested JDK not found."
+})
 public class BrowsePanel extends javax.swing.JPanel {
 
+    private final BrowseWizardPanel panel;
     private final WizardState state;
     private final Client discoClient;
 
-    @UIEffect
-    public static BrowsePanel create(WizardState state) {
-        BrowsePanel d = new BrowsePanel(state);
-        d.init();
-        return d;
-    }
-
-    public BrowsePanel(WizardState state) {
+    public BrowsePanel(BrowseWizardPanel panel, WizardState state) {
+        this.panel = panel;
         this.state = state;
         this.discoClient = Client.getInstance();
+        init();
     }
 
     @UIEffect
@@ -53,21 +55,26 @@ public class BrowsePanel extends javax.swing.JPanel {
     public void addNotify() {
         super.addNotify();
         //we do this every time
-        jdkDescription.setText(state.selection.getFileName());
         if (state.selection.get(null) == null) {
+            jdkDescription.setText(Bundle.DiscoBrowsePanel_searching());
             //OK, we have a quick selection so the file name was not the best, let's try to load it
             submit(() -> {
                 return state.selection.get(discoClient);
             }).then(pkg -> {
                 //re-set the name
                 jdkDescription.setText(state.selection.getFileName());
-
-            }).execute(); //NOTE: ignoring errors on purpose...
+                panel.fireChangeListeners();
+            }).handle(ex -> {
+                jdkDescription.setText(Bundle.DiscoBrowsePanel_error());
+            }).execute();
+        } else {
+            jdkDescription.setText(state.selection.getFileName());
         }
     }
 
     public boolean isOK() {
-        return !downloadPathText.getText().isEmpty();
+        return state.selection.get(null) != null
+                && !downloadPathText.getText().isEmpty();
     }
 
     @NonNull
diff --git a/java/java.disco/src/org/netbeans/modules/java/disco/BrowseWizardPanel.java b/java/java.disco/src/org/netbeans/modules/java/disco/BrowseWizardPanel.java
index 2a080e0..cf4abb4 100644
--- a/java/java.disco/src/org/netbeans/modules/java/disco/BrowseWizardPanel.java
+++ b/java/java.disco/src/org/netbeans/modules/java/disco/BrowseWizardPanel.java
@@ -30,7 +30,7 @@ public class BrowseWizardPanel extends AbstractWizardPanel<BrowsePanel> {
 
     @Override
     protected BrowsePanel createComponent() {
-        return BrowsePanel.create(state);
+        return new BrowsePanel(this, state);
     }
 
     @Override

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

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