You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by he...@apache.org on 2020/04/09 21:43:11 UTC

[netbeans] branch NETBEANS-4029 updated (a49d845 -> df60dd9)

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

hectorespert pushed a change to branch NETBEANS-4029
in repository https://gitbox.apache.org/repos/asf/netbeans.git.


 discard a49d845  WIP
 discard abe985c  [NETBEANS-4029] Fix feature dialog
     new df60dd9  [NETBEANS-4029] Fix feature dialog

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (a49d845)
            \
             N -- N -- N   refs/heads/NETBEANS-4029 (df60dd9)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java    | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)


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


[netbeans] 01/01: [NETBEANS-4029] Fix feature dialog

Posted by he...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hectorespert pushed a commit to branch NETBEANS-4029
in repository https://gitbox.apache.org/repos/asf/netbeans.git

commit df60dd98a3bdb494e0c0f913283957cf81100356
Author: Hector Espert <he...@gmail.com>
AuthorDate: Thu Apr 9 23:21:11 2020 +0200

    [NETBEANS-4029] Fix feature dialog
---
 .../ide/ergonomics/fod/ConfigurationPanel.java     | 53 ++++++++++++++--------
 1 file changed, 34 insertions(+), 19 deletions(-)

diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java
index be78b57..f038985 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.java
@@ -24,9 +24,11 @@ import java.awt.EventQueue;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.Callable;
@@ -49,7 +51,6 @@ import org.netbeans.api.progress.ProgressHandle;
 import org.netbeans.api.progress.ProgressHandleFactory;
 import org.netbeans.modules.autoupdate.ui.api.PluginManager;
 import org.openide.awt.Mnemonics;
-import org.openide.modules.SpecificationVersion;
 import org.openide.util.Exceptions;
 import org.openide.util.NbBundle;
 import org.openide.util.RequestProcessor.Task;
@@ -93,7 +94,7 @@ public class ConfigurationPanel extends JPanel implements Runnable {
     public void setInfo(FeatureInfo info, String displayName, Collection<UpdateElement> toInstall,
             Collection<FeatureInfo.ExtraModuleInfo> missingModules,
             Map<FeatureInfo.ExtraModuleInfo, FeatureInfo> extrasMap, boolean required) {
-        this.extrasFilter = new HashSet<FeatureInfo.ExtraModuleInfo>();
+        this.extrasFilter = new HashSet<>();
         this.featureInfo = info;
         this.featureInstall = toInstall;
         boolean activateNow = toInstall.isEmpty() && missingModules.isEmpty();
@@ -142,29 +143,17 @@ public class ConfigurationPanel extends JPanel implements Runnable {
             downloadLabel.setVisible(true);
             activateButton.setVisible(true);
             downloadButton.setVisible(true);
-            StringBuilder sbDownload = new StringBuilder();
-
+            
             // collect descriptions from features contributing installed extras
-            for (FeatureInfo fi : extrasMap.values()) {
-                String s = required
-                        ? fi.getExtraModulesRequiredText()
-                        : fi.getExtraModulesRecommendedText();
-                if (s != null) {
-                    if (sbDownload.length() > 0) {
-                        sbDownload.append("\n");
-                    }
-                    sbDownload.append(s);
-                }
-            }
+            List<String> downloadStringList = collectDescriptionsFromFeatures(extrasMap.values(), required);
+            String lblDownloadMsg = generateDownloadMessageFromDescriptions(downloadStringList);
+            
             if (required) {
                 activateButton.setEnabled(false);
             } else {
                 activateButton.setEnabled(true);
             }
 
-            String lblDownloadMsg = sbDownload.toString();
-
-            String list = "";
             if (!missingModules.isEmpty()) {
                 StringBuilder sb = new StringBuilder();
                 for (FeatureInfo.ExtraModuleInfo s : missingModules) {
@@ -173,7 +162,7 @@ public class ConfigurationPanel extends JPanel implements Runnable {
                     }
                     sb.append(s.displayName());
                 }
-                list = sb.toString();
+                String list = sb.toString();
                 if (required) {
                     lblDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_MissingRequiredModules", displayName, list);
                     activateButton.setEnabled(false);
@@ -194,6 +183,32 @@ public class ConfigurationPanel extends JPanel implements Runnable {
             org.openide.awt.Mnemonics.setLocalizedText(downloadButton, btnDownloadMsg);
         }
     }
+    
+    private List<String> collectDescriptionsFromFeatures(Collection<FeatureInfo> features, boolean required) {
+        List<String> descriptionsList = new ArrayList<>();
+        for (FeatureInfo fi : features) {
+            String s = required ? fi.getExtraModulesRequiredText(): fi.getExtraModulesRecommendedText();
+            if (!descriptionsList.contains(s)) {
+                descriptionsList.add(s);
+            }
+        }
+        return descriptionsList;
+    } 
+    
+    private String generateDownloadMessageFromDescriptions(List<String> descriptions) {
+        StringBuilder sbDownload = new StringBuilder();
+        if (!descriptions.isEmpty()) {
+            sbDownload.append("<html><body>");
+            for (int i = 0; i < descriptions.size(); i++) {
+                sbDownload.append(descriptions.get(i));
+                if (i > 0 || i < descriptions.size() - 1) {
+                    sbDownload.append("<br>");
+                }
+            }
+            sbDownload.append("</body></html>");
+        }
+        return sbDownload.toString();
+    }
 
     @Override
     public void removeNotify() {


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