[hg] main-silver: #227653: disable the manage button when the pr...

  • From: Jan Lahoda < >
  • To:
  • Subject: [hg] main-silver: #227653: disable the manage button when the pr...
  • Date: Fri, 29 Mar 2013 15:43:36 -0700

changeset 0d801445a784 in main-silver ((none))
details: http://hg.netbeans.org/main-silver/rev/0d801445a784
description:
        #227653: disable the manage button when the predefined configurations 
are selected, properly select configurations on opening/closing the 
Configuration manager

diffstat:

 code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java        
    |  8 +++++---
 
code.analysis/src/org/netbeans/modules/analysis/ui/AdjustConfigurationPanel.java
 |  9 ++++++++-
 2 files changed, 13 insertions(+), 4 deletions(-)

diffs (76 lines):

diff --git 
a/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java 
b/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
--- a/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
+++ b/code.analysis/src/org/netbeans/modules/analysis/RunAnalysisPanel.java
@@ -262,6 +262,7 @@
                     configurationCombo.setSelectedItem(currentItem);
                 } else {
                     currentItem = tempItem;
+                    updateEnableDisable();
                 }
             }
         });
@@ -634,11 +635,12 @@
 
     @Messages("LBL_Configurations=Configurations")
     private void manageActionPerformed(java.awt.event.ActionEvent evt) 
{//GEN-FIRST:event_manageActionPerformed
-        AdjustConfigurationPanel panel = new 
AdjustConfigurationPanel(analyzers, null, null);
+        AdjustConfigurationPanel panel = new 
AdjustConfigurationPanel(analyzers, null, null, (Configuration) 
configurationCombo.getSelectedItem());
         DialogDescriptor nd = new DialogDescriptor(panel, 
Bundle.LBL_Configurations(), true, NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.OK_OPTION, null);
 
         if (DialogDisplayer.getDefault().notify(nd) == 
NotifyDescriptor.OK_OPTION) {
             panel.save();
+            
configurationCombo.setSelectedItem(panel.getSelectedConfiguration());
         }
     }//GEN-LAST:event_manageActionPerformed
 
@@ -664,7 +666,7 @@
             warningToSelect = "";
         }
 
-        AdjustConfigurationPanel panel = new 
AdjustConfigurationPanel(analyzers, analyzerToSelect, warningToSelect);
+        AdjustConfigurationPanel panel = new 
AdjustConfigurationPanel(analyzers, analyzerToSelect, warningToSelect, null);
         DialogDescriptor nd = new DialogDescriptor(panel, 
Bundle.LBL_Browse(), true, NotifyDescriptor.OK_CANCEL_OPTION, 
NotifyDescriptor.OK_OPTION, null);
 
         if (DialogDisplayer.getDefault().notify(nd) == 
NotifyDescriptor.OK_OPTION) {
@@ -691,7 +693,7 @@
         boolean configuration = configurationRadio.isSelected();
 
         configurationCombo.setEnabled(configuration);
-        manage.setEnabled(configuration);
+        manage.setEnabled(configuration && 
configurationCombo.getSelectedItem() instanceof Configuration);
         inspectionCombo.setEnabled(!configuration);
         browse.setEnabled(!configuration);
         
diff --git 
a/code.analysis/src/org/netbeans/modules/analysis/ui/AdjustConfigurationPanel.java
 
b/code.analysis/src/org/netbeans/modules/analysis/ui/AdjustConfigurationPanel.java
--- 
a/code.analysis/src/org/netbeans/modules/analysis/ui/AdjustConfigurationPanel.java
+++ 
b/code.analysis/src/org/netbeans/modules/analysis/ui/AdjustConfigurationPanel.java
@@ -84,7 +84,7 @@
     private ModifiedPreferences currentPreferencesOverlay;
     private final String preselected;
 
-    public AdjustConfigurationPanel(Iterable<? extends AnalyzerFactory> 
analyzers, AnalyzerFactory preselectedAnalyzer, String preselected) {
+    public AdjustConfigurationPanel(Iterable<? extends AnalyzerFactory> 
analyzers, AnalyzerFactory preselectedAnalyzer, String preselected, 
Configuration configurationToSelect) {
         this.preselected = preselected;
         initComponents();
 
@@ -133,6 +133,9 @@
         analyzerCombo.setRenderer(new AnalyzerRenderer());
 
         updateConfiguration();
+        
+        if (configurationToSelect != null)
+            configurationCombo.setSelectedItem(configurationToSelect);
     }
 
     private void updateConfiguration() {
@@ -182,6 +185,10 @@
         currentPreferencesOverlay.store(currentPreferences);
     }
 
+    public Configuration getSelectedConfiguration() {
+        return (Configuration) configurationCombo.getSelectedItem();
+    }
+    
     /**
      * This method is called from within the constructor to initialize the 
form.
      * WARNING: Do NOT modify this code. The content of this method is always

[hg] main-silver: #227653: disable the manage button when the pr...

Jan Lahoda 03/29/2013

Project Features

About this Project

Editor was started in November 2009, is owned by Martin Ryzl, and has 147 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close