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/10/25 13:38:45 UTC

[GitHub] tmysik closed pull request #984: [NETBEANS-1550] Cannot set custom configuration of the inspection feature

tmysik closed pull request #984: [NETBEANS-1550] Cannot set custom configuration of the inspection feature
URL: https://github.com/apache/incubator-netbeans/pull/984
 
 
   

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/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/CodeSnifferCustomizerPanel.java b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/CodeSnifferCustomizerPanel.java
index 6a54df65c7..452385dc64 100644
--- a/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/CodeSnifferCustomizerPanel.java
+++ b/php/php.code.analysis/src/org/netbeans/modules/php/analysis/ui/analyzer/CodeSnifferCustomizerPanel.java
@@ -19,8 +19,6 @@
 package org.netbeans.modules.php.analysis.ui.analyzer;
 
 import java.awt.EventQueue;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
 import java.awt.event.ItemEvent;
 import java.awt.event.ItemListener;
 import java.util.concurrent.TimeUnit;
@@ -64,12 +62,20 @@ public CodeSnifferCustomizerPanel(Analyzer.CustomizerContext<Void, CodeSnifferCu
     }
 
     private void init() {
+        boolean isEnabled = settings.getBoolean(ENABLED, false);
+        enabledCheckBox.setSelected(isEnabled);
+        // don't set errors in initialization becuase NPE occurs
+        // so add the listener after setSelected method
         enabledCheckBox.addItemListener((e) -> {
             setStandardComponentsEnabled(enabledCheckBox.isSelected());
             setCodeSnifferEnabled();
+            if (!enabledCheckBox.isSelected()) {
+                // NETBEANS-1550 clear errors because user can't set other configurations
+                context.setError(null);
+            } else {
+                validateData();
+            }
         });
-        boolean isEnabled = settings.getBoolean(ENABLED, false);
-        enabledCheckBox.setSelected(isEnabled);
 
         standardComboBox.setModel(standardsModel);
         standardsModel.fetchStandards(standardComboBox);
@@ -78,7 +84,9 @@ private void init() {
         standardComboBox.addItemListener(new ItemListener() {
             @Override
             public void itemStateChanged(ItemEvent e) {
-                validateAndSetData();
+                if (enabledCheckBox.isSelected()) {
+                    validateAndSetData();
+                }
             }
         });
 


 

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