You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2018/09/19 16:52:08 UTC

[GitHub] geertjanw closed pull request #715: Download nbjavac when turning on support for Java

geertjanw closed pull request #715: Download nbjavac when turning on support for Java
URL: https://github.com/apache/incubator-netbeans/pull/715
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/ergonomics/ide.ergonomics/java.properties b/ergonomics/ide.ergonomics/java.properties
index 94b14fe008..31e21a7f53 100644
--- a/ergonomics/ide.ergonomics/java.properties
+++ b/ergonomics/ide.ergonomics/java.properties
@@ -20,4 +20,8 @@ project.file.../java.base/share/classes/java/lang/Object.java=org.netbeans.modul
 projectImporter=Eclipse
 
 mainModule=org.netbeans.modules.java.kit
+extra.modules=org.netbeans.modules.nbjavac
+extra.modules.recommended.min.jdk=9
 
+LBL_Ergonomics_Extra_Required=Additional modules are needed to run Java SE support on JDK 8.
+LBL_Ergonomics_Extra_Recommended=Additional modules are recommended to run Java SE support.
diff --git a/ergonomics/ide.ergonomics/nbproject/project.xml b/ergonomics/ide.ergonomics/nbproject/project.xml
index cea6c980d8..fa65dd915d 100644
--- a/ergonomics/ide.ergonomics/nbproject/project.xml
+++ b/ergonomics/ide.ergonomics/nbproject/project.xml
@@ -77,6 +77,14 @@
                         <specification-version>1.33</specification-version>
                     </run-dependency>
                 </dependency>
+                <dependency>
+                    <code-name-base>org.netbeans.modules.autoupdate.ui</code-name-base>
+                    <build-prerequisite/>
+                    <compile-dependency/>
+                    <run-dependency>
+                        <specification-version>1.48</specification-version>
+                    </run-dependency>
+                </dependency>
                 <dependency>
                     <code-name-base>org.netbeans.modules.options.api</code-name-base>
                     <build-prerequisite/>
@@ -197,7 +205,7 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
-                    <code-name-base>org.openide.util.ui</code-name-base>
+                    <code-name-base>org.openide.util</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
@@ -205,19 +213,19 @@
                     </run-dependency>
                 </dependency>
                 <dependency>
-                    <code-name-base>org.openide.util</code-name-base>
+                    <code-name-base>org.openide.util.lookup</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>9.3</specification-version>
+                        <specification-version>8.0</specification-version>
                     </run-dependency>
                 </dependency>
                 <dependency>
-                    <code-name-base>org.openide.util.lookup</code-name-base>
+                    <code-name-base>org.openide.util.ui</code-name-base>
                     <build-prerequisite/>
                     <compile-dependency/>
                     <run-dependency>
-                        <specification-version>8.0</specification-version>
+                        <specification-version>9.3</specification-version>
                     </run-dependency>
                 </dependency>
             </module-dependencies>
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/Utilities.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/Utilities.java
index 44fe48962e..011e3f3699 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/Utilities.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/Utilities.java
@@ -67,7 +67,7 @@ public JComponent call() throws Exception {
         descriptor[0] = Mutex.EVENT.readAccess(new Mutex.Action<DialogDescriptor>() {
             @Override
             public DialogDescriptor run() {
-                arr[0] = new ConfigurationPanel(featureName, call, featureInfo, true);
+                arr[0] = new ConfigurationPanel(featureName, call, featureInfo);
                 return new DialogDescriptor(arr[0], notFoundMessage);
             }
         });
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/debugger/AttachTypeProxy.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/debugger/AttachTypeProxy.java
index fcb11cb0bf..bd60c05e86 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/debugger/AttachTypeProxy.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/debugger/AttachTypeProxy.java
@@ -78,7 +78,7 @@ public String getTypeDisplayName() {
     @Override
     public JComponent getCustomizer() {
         if (delegate == null) {
-            return new ConfigurationPanel(attachTypeName, this, featureInfo, false);
+            return new ConfigurationPanel(attachTypeName, this, featureInfo);
         } else {
             return delegate.getCustomizer();
         }
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties
index be9007b889..270ee567d8 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/Bundle.properties
@@ -31,9 +31,9 @@ InstallerMissingModules_NeedsRestart=Restart IDE to complete instaling asked plu
 DebuggerConfigurationPanel.downloadButton.text=Download
 MSG_DownloadFailed=Module(s) download failed.
 MSG_EnableFailed=Module(s) activation failed.
-LBL_DownloadInfo=In order to use this functionality, support for {0} must be downloaded & installed.
+LBL_DownloadInfo=In order to use {0}, it is recommended to download & install additional modules.
 LBL_EnableInfo=In order to use this functionality, support for {0} must be activated.
-LBL_Download=&Download & Install
+LBL_Download=&Download and Activate...
 LBL_Enable=&Activate
 
 
@@ -83,3 +83,5 @@ FeatureBaseIDE=Base IDE
 
 # the following is HTML text used during compilation of this module
 MSG_NotEnabled=<body><em>This feature is not yet enabled. Press Next to activate it.</em><p>
+ConfigurationPanel.downloadLabel.text=dwn
+ConfigurationPanel.downloadButton.text=dwnBtn
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.form b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.form
index 9e3ff427a6..8fdc4d63dc 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.form
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ConfigurationPanel.form
@@ -41,9 +41,19 @@
               <EmptySpace max="-2" attributes="0"/>
               <Group type="103" groupAlignment="0" attributes="0">
                   <Component id="progressPanel" alignment="0" pref="374" max="32767" attributes="0"/>
-                  <Component id="infoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
-                  <Component id="downloadButton" alignment="0" min="-2" max="-2" attributes="0"/>
-                  <Component id="errorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+                  <Group type="102" attributes="0">
+                      <Group type="103" groupAlignment="0" attributes="0">
+                          <Component id="errorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Group type="102" alignment="0" attributes="0">
+                              <Component id="downloadButton" min="-2" max="-2" attributes="0"/>
+                              <EmptySpace max="-2" attributes="0"/>
+                              <Component id="activateButton" min="-2" max="-2" attributes="0"/>
+                          </Group>
+                          <Component id="downloadLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+                          <Component id="infoLabel" alignment="0" min="-2" max="-2" attributes="0"/>
+                      </Group>
+                      <EmptySpace min="0" pref="0" max="32767" attributes="0"/>
+                  </Group>
               </Group>
               <EmptySpace max="-2" attributes="0"/>
           </Group>
@@ -55,10 +65,15 @@
               <Component id="errorLabel" min="-2" max="-2" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
               <Component id="infoLabel" min="-2" max="-2" attributes="0"/>
-              <EmptySpace min="-2" max="-2" attributes="0"/>
-              <Component id="downloadButton" min="-2" max="-2" attributes="0"/>
-              <EmptySpace type="separate" max="-2" attributes="0"/>
-              <Component id="progressPanel" pref="131" max="32767" attributes="0"/>
+              <EmptySpace type="unrelated" max="-2" attributes="0"/>
+              <Component id="downloadLabel" min="-2" max="-2" attributes="0"/>
+              <EmptySpace min="-2" pref="18" max="-2" attributes="0"/>
+              <Group type="103" groupAlignment="3" attributes="0">
+                  <Component id="activateButton" alignment="3" min="-2" max="-2" attributes="0"/>
+                  <Component id="downloadButton" alignment="3" min="-2" max="-2" attributes="0"/>
+              </Group>
+              <EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
+              <Component id="progressPanel" pref="91" max="32767" attributes="0"/>
               <EmptySpace max="-2" attributes="0"/>
           </Group>
       </Group>
@@ -75,12 +90,12 @@
         <Property name="text" type="java.lang.String" value="dummy" noResource="true"/>
       </Properties>
     </Component>
-    <Component class="javax.swing.JButton" name="downloadButton">
+    <Component class="javax.swing.JButton" name="activateButton">
       <Properties>
         <Property name="text" type="java.lang.String" value="dummy" noResource="true"/>
       </Properties>
       <Events>
-        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="activateButtonActionPerformed"/>
       </Events>
     </Component>
     <Container class="javax.swing.JPanel" name="progressPanel">
@@ -89,5 +104,22 @@
         <Property name="axis" type="int" value="3"/>
       </Layout>
     </Container>
+    <Component class="javax.swing.JLabel" name="downloadLabel">
+      <Properties>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/netbeans/modules/ide/ergonomics/fod/Bundle.properties" key="ConfigurationPanel.downloadLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+    </Component>
+    <Component class="javax.swing.JButton" name="downloadButton">
+      <Properties>
+        <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+          <ResourceString bundle="org/netbeans/modules/ide/ergonomics/fod/Bundle.properties" key="ConfigurationPanel.downloadButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+        </Property>
+      </Properties>
+      <Events>
+        <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="downloadButtonActionPerformed"/>
+      </Events>
+    </Component>
   </SubComponents>
 </Form>
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 e4d006d987..92ae7c443f 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,6 +24,8 @@
 import java.awt.EventQueue;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.concurrent.Callable;
 import javax.swing.Box;
 import javax.swing.BoxLayout;
@@ -36,9 +38,14 @@
 import javax.swing.JPanel;
 import javax.swing.LayoutStyle.ComponentPlacement;
 import javax.swing.SwingUtilities;
+import org.netbeans.api.autoupdate.InstallSupport;
+import org.netbeans.api.autoupdate.OperationContainer;
+import org.netbeans.api.autoupdate.UpdateElement;
 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;
@@ -57,53 +64,55 @@
     final DownloadProgressMonitor progressMonitor = new DownloadProgressMonitor();
     private FeatureInfo featureInfo;
     private Callable<JComponent> callable;
-    private final Boolean autoActivate;
+    private Collection<UpdateElement> featureInstall;
 
-    public ConfigurationPanel(String displayName, final Callable<JComponent> callable, FeatureInfo info, Boolean auto) {
-        this(callable, auto);
-        setInfo(info);
-        setPanelName(displayName);
+    public ConfigurationPanel(String displayName, final Callable<JComponent> callable, FeatureInfo info) {
+        this(callable);
+        setInfo(info, displayName, Collections.<UpdateElement>emptyList());
     }
     
-    public ConfigurationPanel(final Callable<JComponent> callable, Boolean auto) {
+    public ConfigurationPanel(final Callable<JComponent> callable) {
         assert EventQueue.isDispatchThread();
         initComponents();
         this.featureInfo = null;
         this.callable = callable;
-        autoActivate = auto;
 
         setError(" "); // NOI18N
     }
 
-    public void setInfo(FeatureInfo info) {
+    public void setInfo(FeatureInfo info, String displayName, Collection<UpdateElement> toInstall) {
         this.featureInfo = info;
-        boolean activateNow;
-        if (autoActivate != null) {
-            activateNow = Boolean.TRUE.equals(autoActivate);
-        } else {
-            activateNow = Boolean.getBoolean("noActivateButton"); // NOI18N
-        }
+        this.featureInstall = toInstall;
+        boolean activateNow = toInstall.isEmpty();
         if (activateNow) {
             infoLabel.setVisible(false);
+            downloadLabel.setVisible(false);
+            activateButton.setVisible(false);
             downloadButton.setVisible(false);
-            downloadButtonActionPerformed(null);
-        }
-    }
-    
-    public void setPanelName(String displayName) {
-        FeatureManager.logUI("ERGO_QUESTION", featureInfo.clusterName, displayName);
-        String lblMsg = null;
-        String btnMsg = null;
-        if (featureInfo != null && featureInfo.isPresent()) {
-            lblMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_EnableInfo", displayName);
-            btnMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Enable");
+            activateButtonActionPerformed(null);
         } else {
-            lblMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_DownloadInfo", displayName);
-            btnMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Download");
+            FeatureManager.logUI("ERGO_QUESTION", featureInfo.clusterName, displayName);
+            infoLabel.setVisible(true);
+            downloadLabel.setVisible(true);
+            activateButton.setVisible(true);
+            downloadButton.setVisible(true);
+            SpecificationVersion jdk = new SpecificationVersion(System.getProperty("java.specification.version"));
+            String lblDownloadMsg;
+            if (jdk.compareTo(new SpecificationVersion(info.getExtraModulesRecommendedMinJDK())) < 0) {
+                lblDownloadMsg = info.getExtraModulesRequiredText();
+                activateButton.setEnabled(false);
+            } else {
+                lblDownloadMsg = info.getExtraModulesRecommendedText();
+                activateButton.setEnabled(true);
+            }
+            String lblActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_EnableInfo", displayName);
+            String btnActivateMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Enable");
+            String btnDownloadMsg = NbBundle.getMessage(ConfigurationPanel.class, "LBL_Download");
+            org.openide.awt.Mnemonics.setLocalizedText(infoLabel, lblActivateMsg);
+            org.openide.awt.Mnemonics.setLocalizedText(activateButton, btnActivateMsg);
+            org.openide.awt.Mnemonics.setLocalizedText(downloadLabel, lblDownloadMsg);
+            org.openide.awt.Mnemonics.setLocalizedText(downloadButton, btnDownloadMsg);
         }
-        org.openide.awt.Mnemonics.setLocalizedText(infoLabel, lblMsg);
-        org.openide.awt.Mnemonics.setLocalizedText(downloadButton, btnMsg);
-        
     }
     
     @Override
@@ -126,54 +135,76 @@ void setError(String msg) {
     // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
     private void initComponents() {
 
-
         errorLabel = BrokenProjectInfo.getErrorPane("dummy");
         infoLabel = new JLabel();
-        downloadButton = new JButton();
+        activateButton = new JButton();
         progressPanel = new JPanel();
-        Mnemonics.setLocalizedText(infoLabel, "dummy");
-        Mnemonics.setLocalizedText(downloadButton, "dummy");
-        downloadButton.addActionListener(new ActionListener() {
+        downloadLabel = new JLabel();
+        downloadButton = new JButton();
+
+        Mnemonics.setLocalizedText(infoLabel, "dummy"); // NOI18N
+
+        Mnemonics.setLocalizedText(activateButton, "dummy"); // NOI18N
+        activateButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent evt) {
-                downloadButtonActionPerformed(evt);
+                activateButtonActionPerformed(evt);
             }
         });
 
         progressPanel.setLayout(new BoxLayout(progressPanel, BoxLayout.PAGE_AXIS));
 
+        Mnemonics.setLocalizedText(downloadLabel, NbBundle.getMessage(ConfigurationPanel.class, "ConfigurationPanel.downloadLabel.text")); // NOI18N
+
+        Mnemonics.setLocalizedText(downloadButton, NbBundle.getMessage(ConfigurationPanel.class, "ConfigurationPanel.downloadButton.text")); // NOI18N
+        downloadButton.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent evt) {
+                downloadButtonActionPerformed(evt);
+            }
+        });
+
         GroupLayout layout = new GroupLayout(this);
         this.setLayout(layout);
-        layout.setHorizontalGroup(
-            layout.createParallelGroup(Alignment.LEADING)
+        layout.setHorizontalGroup(layout.createParallelGroup(Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
                 .addContainerGap()
                 .addGroup(layout.createParallelGroup(Alignment.LEADING)
                     .addComponent(progressPanel, GroupLayout.DEFAULT_SIZE, 374, Short.MAX_VALUE)
-                    .addComponent(infoLabel)
-                    .addComponent(downloadButton)
-                    .addComponent(errorLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
+                    .addGroup(layout.createSequentialGroup()
+                        .addGroup(layout.createParallelGroup(Alignment.LEADING)
+                            .addComponent(errorLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
+                            .addGroup(layout.createSequentialGroup()
+                                .addComponent(downloadButton)
+                                .addPreferredGap(ComponentPlacement.RELATED)
+                                .addComponent(activateButton))
+                            .addComponent(downloadLabel)
+                            .addComponent(infoLabel))
+                        .addGap(0, 0, Short.MAX_VALUE)))
                 .addContainerGap())
         );
-        layout.setVerticalGroup(
-            layout.createParallelGroup(Alignment.LEADING)
+        layout.setVerticalGroup(layout.createParallelGroup(Alignment.LEADING)
             .addGroup(layout.createSequentialGroup()
                 .addComponent(errorLabel, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                 .addPreferredGap(ComponentPlacement.RELATED)
                 .addComponent(infoLabel)
-                .addPreferredGap(ComponentPlacement.RELATED)
-                .addComponent(downloadButton)
+                .addPreferredGap(ComponentPlacement.UNRELATED)
+                .addComponent(downloadLabel)
                 .addGap(18, 18, 18)
-                .addComponent(progressPanel, GroupLayout.DEFAULT_SIZE, 131, Short.MAX_VALUE)
+                .addGroup(layout.createParallelGroup(Alignment.BASELINE)
+                    .addComponent(activateButton)
+                    .addComponent(downloadButton))
+                .addGap(19, 19, 19)
+                .addComponent(progressPanel, GroupLayout.DEFAULT_SIZE, 91, Short.MAX_VALUE)
                 .addContainerGap())
         );
     }// </editor-fold>//GEN-END:initComponents
 
     public void run() {
-        ModulesInstaller.installModules(progressMonitor, featureInfo);
+        ModulesInstaller.installModules(progressMonitor, featureInfo, featureInstall);
     }
 
-    private void downloadButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_downloadButtonActionPerformed
+    private void activateButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_activateButtonActionPerformed
         FeatureManager.logUI("ERGO_DOWNLOAD");
+        activateButton.setEnabled(false);
         downloadButton.setEnabled(false);
         Task task = FeatureManager.getInstance().create(this);
         task.addTaskListener(new TaskListener() {
@@ -201,7 +232,7 @@ public void run() {
                                 msg = NbBundle.getMessage(ConfigurationPanel.class, "MSG_DownloadFailed");
                             }
                             setError(msg);
-                            downloadButton.setEnabled(true);
+                            activateButton.setEnabled(true);
                             progressPanel.removeAll();
                             progressPanel.revalidate();
                             progressPanel.repaint();
@@ -211,10 +242,20 @@ public void run() {
             }
         });
         task.schedule(0);
+    }//GEN-LAST:event_activateButtonActionPerformed
+
+    private void downloadButtonActionPerformed(ActionEvent evt) {//GEN-FIRST:event_downloadButtonActionPerformed
+        OperationContainer<InstallSupport> op = OperationContainer.createForInstall();
+        op.add(featureInstall);
+        if (PluginManager.openInstallWizard(op)) {
+            activateButtonActionPerformed(null);
+        }
     }//GEN-LAST:event_downloadButtonActionPerformed
 
     // Variables declaration - do not modify//GEN-BEGIN:variables
+    private JButton activateButton;
     private JButton downloadButton;
+    private JLabel downloadLabel;
     private JEditorPane errorLabel;
     private JLabel infoLabel;
     private JPanel progressPanel;
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureInfo.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureInfo.java
index c581ac7cc2..c2f1c179c2 100755
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureInfo.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FeatureInfo.java
@@ -35,8 +35,6 @@
 import javax.xml.xpath.XPathExpressionException;
 import javax.xml.xpath.XPathFactory;
 import javax.xml.xpath.XPathExpression;
-import org.openide.filesystems.FileObject;
-import org.openide.filesystems.FileUtil;
 import org.w3c.dom.Document;
 import org.openide.modules.ModuleInfo;
 import org.openide.util.Lookup;
@@ -214,6 +212,27 @@ int isProject(FeatureProjectFactory.Data data) {
     public final Set<String> getCodeNames() {
         return Collections.unmodifiableSet(cnbs);
     }
+    
+    public final Set<String> getExtraModules() {
+        String cnbs = properties.getProperty("extra.modules"); // NOI18N
+        TreeSet<String> s = new TreeSet<String>();
+        if (cnbs != null) {
+            s.addAll(Arrays.asList(cnbs.split(",")));
+        }
+        return s;
+    }
+
+    public final String getExtraModulesRecommendedMinJDK() {
+        return properties.getProperty("extra.modules.recommended.min.jdk"); // NOI18N
+    }
+
+    public final String getExtraModulesRequiredText() {
+        return properties.getProperty("LBL_Ergonomics_Extra_Required"); // NOI18N
+    }
+
+    public final String getExtraModulesRecommendedText() {
+        return properties.getProperty("LBL_Ergonomics_Extra_Recommended"); // NOI18N
+    }
 
     public boolean isPresent() {
         Boolean p = cachePresent;
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FindComponentModules.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FindComponentModules.java
index 5814dc6586..881b9b0dc7 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FindComponentModules.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/FindComponentModules.java
@@ -19,6 +19,7 @@
 
 package org.netbeans.modules.ide.ergonomics.fod;
 
+import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -26,6 +27,7 @@
 import java.util.Enumeration;
 import java.util.HashSet;
 import java.util.LinkedList;
+import java.util.List;
 import java.util.Set;
 import java.util.StringTokenizer;
 import java.util.prefs.Preferences;
@@ -35,6 +37,9 @@
 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.openide.util.Exceptions;
 import org.openide.util.NbPreferences;
 import org.openide.util.RequestProcessor;
 import org.openide.util.Task;
@@ -175,10 +180,24 @@ public void run() {
 
     private void findComponentModules () {
         long start = System.currentTimeMillis();
-        Collection<UpdateUnit> units = UpdateManager.getDefault ().getUpdateUnits (UpdateManager.TYPE.MODULE);
-
-        // install missing modules
-        Collection<UpdateElement> elementsForInstall = getMissingModules (units);
+        Collection<UpdateUnit> units = null;
+        Collection<UpdateElement> elementsForInstall = null;
+        for (int[] refresh = { 2 }; refresh[0] > 0; ) {
+            if (units != null) {
+                List<UpdateUnitProvider> providers = UpdateUnitProviderFactory.getDefault().getUpdateUnitProviders(true);
+                for (UpdateUnitProvider p : providers) {
+                    try {
+                        p.refresh(null, true);
+                    } catch (IOException ex) {
+                        Exceptions.printStackTrace(ex);
+                    }
+                }
+                
+            }
+            units = UpdateManager.getDefault ().getUpdateUnits (UpdateManager.TYPE.MODULE);
+            // install missing modules
+            elementsForInstall = getMissingModules(units, refresh);
+        }
         forInstall = getAllForInstall (elementsForInstall);
 
         // install disabled modules
@@ -186,13 +205,33 @@ private void findComponentModules () {
         forEnable = getAllForEnable (elementsForEnable, units);
     }
     
-    private Collection<UpdateElement> getMissingModules (Collection<UpdateUnit> allUnits) {
+    private Collection<UpdateElement> getMissingModules(Collection<UpdateUnit> allUnits, int[] refresh) {
         Set<UpdateElement> res = new HashSet<UpdateElement> ();
         for (UpdateUnit unit : allUnits) {
-            if (unit.getInstalled () == null && codeNames.contains(unit.getCodeName ())) {
+            if (unit.getInstalled () == null && (
+                codeNames.contains(unit.getCodeName ())
+            )) {
                 res.add (unit.getAvailableUpdates ().get (0));
             }
         }
+        for (FeatureInfo fi : this.infos) {
+            Set<String> extraModules = fi.getExtraModules();
+            FOUND: for (String cnb : extraModules) {
+                for (UpdateUnit unit : allUnits) {
+                    if (cnb.equals(unit.getCodeName())) {
+                        if (unit.getInstalled() != null) {
+                            continue FOUND;
+                        } else {
+                            res.add(unit.getAvailableUpdates().get(0));
+                            continue FOUND;
+                        }
+                    }
+                }
+                refresh[0]--;
+                return res;
+            }
+        }
+        refresh[0] = 0;
         return res;
     }
     
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ModulesInstaller.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ModulesInstaller.java
index a9032a8f78..691bc6622c 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ModulesInstaller.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/ModulesInstaller.java
@@ -78,16 +78,15 @@ public ModulesInstaller (Collection<UpdateElement> modules, FindComponentModules
         }
     }
     
-    public static boolean installModules (FeatureInfo info) {
-        return installModules(null, info);
-    }
-
     static boolean success = false;
-    public static boolean installModules (ProgressMonitor monitor, FeatureInfo info) {
+    public static boolean installModules (
+        ProgressMonitor monitor, FeatureInfo info, Collection<UpdateElement> alreadyOffered
+    ) {
         assert ! SwingUtilities.isEventDispatchThread () : "Cannot run in EQ!";
         
         FindComponentModules findModules = new FindComponentModules(info);
         Collection<UpdateElement> toInstall = findModules.getModulesForInstall();
+        toInstall.removeAll(alreadyOffered);
         Collection<UpdateElement> toEnable = findModules.getModulesForEnable();
         if (toInstall != null && !toInstall.isEmpty()) {
             ModulesInstaller installer = new ModulesInstaller(toInstall, findModules, monitor);
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/OptionCntrl.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/OptionCntrl.java
index 8c8f79ccb0..0e4821209a 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/OptionCntrl.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/fod/OptionCntrl.java
@@ -79,7 +79,7 @@ public JComponent getComponent(Lookup masterLookup) {
             FeatureInfo info = FoDLayersProvider.getInstance().whichProvides(fo);
             assert info != null;
             master = masterLookup;
-            panel = new ConfigurationPanel(info.clusterName, this, info, false);
+            panel = new ConfigurationPanel(info.clusterName, this, info);
         }
         return panel;
     }
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/DescriptionStep.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/DescriptionStep.java
index 265bf0afcb..38f061b59d 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/DescriptionStep.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/DescriptionStep.java
@@ -74,10 +74,8 @@
     private FeatureInfo info;
     private WizardDescriptor wd;
     private ConfigurationPanel configPanel;
-    private final boolean autoEnable;
 
-    public DescriptionStep(boolean autoEnable) {
-        this.autoEnable = autoEnable;
+    public DescriptionStep() {
     }
 
     @Override
@@ -90,7 +88,7 @@ public JComponent call() throws Exception {
                     waitForDelegateWizard(true);
                     return new JLabel(" ");
                 }
-            }, autoEnable);
+            });
             panel = new ContentPanel (getBundle ("DescriptionPanel_Name"));
             panel.addPropertyChangeListener (findModules);
         }
@@ -153,12 +151,12 @@ final void presentModulesForActivation (FindComponentModules f) {
                 panel.replaceComponents ();
                 handle = null;
             }
+            final  Collection<UpdateElement> toInstall = f.getModulesForInstall();
             final  Collection<UpdateElement> elems = f.getModulesForEnable ();
             if (elems != null && !elems.isEmpty ()) {
                 Collection<UpdateElement> visible = f.getVisibleUpdateElements (elems);
                 final String name = ModulesInstaller.presentUpdateElements (visible);
-                configPanel.setInfo(info);
-                configPanel.setPanelName(name);
+                configPanel.setInfo(info, name, toInstall);
                 panel.replaceComponents(configPanel);
                 forEnable = elems;
                 fireChange ();
diff --git a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/FeatureOnDemandWizardIterator.java b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/FeatureOnDemandWizardIterator.java
index 6e2c1fc187..e4fedd976b 100644
--- a/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/FeatureOnDemandWizardIterator.java
+++ b/ergonomics/ide.ergonomics/src/org/netbeans/modules/ide/ergonomics/newproject/FeatureOnDemandWizardIterator.java
@@ -99,7 +99,7 @@ public FeatureOnDemandWizardIterator (FileObject template) {
         assert EventQueue.isDispatchThread();
         if (panels == null) {
             panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>> ();
-            panels.add (new DescriptionStep (autoEnable));
+            panels.add (new DescriptionStep ());
             names = new String [] {
                 NbBundle.getMessage (FeatureOnDemandWizardIterator.class, "DescriptionStep_Name"),
             
@@ -129,7 +129,7 @@ public FeatureOnDemandWizardIterator (FileObject template) {
     private void createPanelsForEnable () {
         if (getPanels() == null) {
             panels = new ArrayList<WizardDescriptor.Panel<WizardDescriptor>> ();
-            getPanels().add (new DescriptionStep (autoEnable));
+            getPanels().add (new DescriptionStep ());
             getPanels().add (new EnableStep ());
             names = new String [] {
                 NbBundle.getMessage (FeatureOnDemandWizardIterator.class, "DescriptionStep_Name"),
diff --git a/ergonomics/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/WizardDeadTest.java b/ergonomics/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/WizardDeadTest.java
index bc1b2a687e..315ef9ef2b 100644
--- a/ergonomics/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/WizardDeadTest.java
+++ b/ergonomics/ide.ergonomics/test/unit/src/org/netbeans/modules/ide/ergonomics/WizardDeadTest.java
@@ -56,7 +56,7 @@ public void testDescriptionStep() throws InterruptedException, InvocationTargetE
         assertNotNull("Template found", fob);
         wd.putProperty(FeatureOnDemandWizardIterator.CHOSEN_TEMPLATE, fob);
 
-        DescriptionStep step = new DescriptionStep(true);
+        DescriptionStep step = new DescriptionStep();
         step.readSettings(wd);
         JComponent panel = (JComponent) step.getComponent();
         assertFalse("Module not yet found", isModuleEnabled());


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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

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