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 2022/10/11 16:37:24 UTC

[netbeans] branch master updated: Add update centre notifications to Check for Updates dialog when no updates available.

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 8c00bced80 Add update centre notifications to Check for Updates dialog when no updates available.
     new f369361d1e Merge pull request #4742 from neilcsmith-net/update-notify
8c00bced80 is described below

commit 8c00bced809c5132d74244a52df409b766064052
Author: Neil C Smith <ne...@apache.org>
AuthorDate: Thu Oct 6 17:01:48 2022 +0100

    Add update centre notifications to Check for Updates dialog when no updates available.
---
 .../autoupdate/ui/wizards/Bundle.properties        |  1 +
 .../ui/wizards/LazyOperationDescriptionStep.java   | 56 ++++++++++++++--------
 2 files changed, 38 insertions(+), 19 deletions(-)

diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/Bundle.properties b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/Bundle.properties
index 7086f1f5a5..4b4cc74599 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/Bundle.properties
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/Bundle.properties
@@ -135,6 +135,7 @@ ValidationWarningPanel_ACD=N/A
 UninstallUnitWizard_Title=Plugin Installer
 LazyOperationDescriptionStep_NoUpdates_Title=<h3>Your application is up to date!</h3>
 LazyOperationDescriptionStep_NoUpdates=There are no updates available.
+LazyOperationDescriptionStep_Notifications_Title=<h3>Notifications</h3>
 LazyOperationDescriptionStep_NoUpdatesWithProblems_Title=<h3>Checking for updates failed.</h3>
 LazyOperationDescriptionStep_NoUpdatesWithProblems=Check your network connection, verify that your proxy settings<br>are configured correctly, or try again later.
 LazyOperationDescriptionStep_FindUpdates_Title=<b>Checking for updates.</b><br>Please wait while the installer checks for available updates.
diff --git a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/LazyOperationDescriptionStep.java b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/LazyOperationDescriptionStep.java
index b36a05919b..edbfbb7cb6 100644
--- a/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/LazyOperationDescriptionStep.java
+++ b/platform/autoupdate.ui/src/org/netbeans/modules/autoupdate/ui/wizards/LazyOperationDescriptionStep.java
@@ -26,6 +26,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
+import java.util.stream.Collectors;
 import javax.swing.JPanel;
 import javax.swing.SwingUtilities;
 import javax.swing.event.ChangeEvent;
@@ -34,6 +35,8 @@ import org.netbeans.api.autoupdate.OperationContainer;
 import org.netbeans.api.autoupdate.UpdateElement;
 import org.netbeans.api.autoupdate.UpdateManager;
 import org.netbeans.api.autoupdate.UpdateUnit;
+import org.netbeans.api.autoupdate.UpdateUnitProvider;
+import org.netbeans.api.autoupdate.UpdateUnitProviderFactory;
 import org.netbeans.modules.autoupdate.ui.Utilities;
 import org.netbeans.modules.autoupdate.ui.actions.AutoupdateCheckScheduler;
 import org.netbeans.modules.autoupdate.ui.actions.Installer;
@@ -119,7 +122,8 @@ public class LazyOperationDescriptionStep implements WizardDescriptor.Panel<Wiza
     
     @SuppressWarnings("unchecked")
     private void checkRealUpdates () {
-        final Collection<String> problems=new ArrayList<String>();
+        final Collection<String> problems = new ArrayList<>();
+        final List<String> notifications = new ArrayList<>();
         checkRealUpdatesTask = Installer.RP.post (new Runnable () {
             @Override
             public void run () {
@@ -167,6 +171,14 @@ public class LazyOperationDescriptionStep implements WizardDescriptor.Panel<Wiza
                             }
                         });
                     }
+                } else {
+                    for (UpdateUnitProvider p :
+                            UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(true)) {
+                        String desc = p.getDescription();
+                        if (desc != null && desc.contains("<a name=\"autoupdate_catalog_parser\"")) {
+                            notifications.add(desc);
+                        }
+                    }
                 }
             }
         });
@@ -186,25 +198,31 @@ public class LazyOperationDescriptionStep implements WizardDescriptor.Panel<Wiza
             @Override
             public void run() {
                 JPanel body;
-                if(problems==null || problems.isEmpty())
-                {
-                    body = new OperationDescriptionPanel (
-                        getBundle ("LazyOperationDescriptionStep_NoUpdates_Title"), // NOI18N
-                        getBundle ("LazyOperationDescriptionStep_NoUpdates"), // NOI18N
-                        "", "",
-                        false);
-                }
-                else
-                {
-                    body = new OperationDescriptionPanel (
-                        getBundle ("LazyOperationDescriptionStep_NoUpdatesWithProblems_Title"), // NOI18N
-                        getBundle ("LazyOperationDescriptionStep_NoUpdatesWithProblems"), // NOI18N
-                        "", "",
-                        false);
+                if (problems.isEmpty()) {
+                    if (notifications.isEmpty()) {
+                        body = new OperationDescriptionPanel(
+                                getBundle("LazyOperationDescriptionStep_NoUpdates_Title"), // NOI18N
+                                getBundle("LazyOperationDescriptionStep_NoUpdates"), // NOI18N
+                                "", "",
+                                false);
+                    } else {
+                        String content = notifications.stream().collect(Collectors.joining("<br><br>"));
+                        body = new OperationDescriptionPanel(
+                                getBundle("LazyOperationDescriptionStep_Notifications_Title"), // NOI18N
+                                content, // NOI18N
+                                "", "",
+                                false);
+                    }
+                } else {
+                    body = new OperationDescriptionPanel(
+                            getBundle("LazyOperationDescriptionStep_NoUpdatesWithProblems_Title"), // NOI18N
+                            getBundle("LazyOperationDescriptionStep_NoUpdatesWithProblems"), // NOI18N
+                            "", "",
+                            false);
                 }
-                component.setBody (body);
-                component.setWaitingState (false);
-                fireChange ();
+                component.setBody(body);
+                component.setWaitingState(false);
+                fireChange();
             }
         }
         checkRealUpdatesTask.addTaskListener (new TLAndR());


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