@@ -40,6 +40,7 @@ public class ConfigurationDialog extends AbstractDialog {
40
40
private LabeledComponent <TextFieldWithBrowseButton > modulePath ;
41
41
private LabeledComponent <TextFieldWithBrowseButton > additionalPath ;
42
42
private JCheckBox ignoreCurrentVersion ;
43
+ private JCheckBox hasAdditionalPath ;
43
44
private JComboBox <ComboBoxItemData > currentVersion ;
44
45
private JComboBox <ComboBoxItemData > targetVersion ;
45
46
private JComboBox <ComboBoxItemData > issueSeverityLevel ;
@@ -54,7 +55,6 @@ public class ConfigurationDialog extends AbstractDialog {
54
55
private JLabel modulePathError ;//NOPMD
55
56
private JLabel enableComment ;//NOPMD
56
57
private JLabel enableCommentPath ;//NOPMD
57
- private JCheckBox hasAdditionalPath ;
58
58
private JLabel additionalPathLabel ;//NOPMD
59
59
private JLabel additionalPathError ;//NOPMD
60
60
@@ -103,6 +103,7 @@ public void windowClosing(final WindowEvent event) {
103
103
enableComment .setForeground (JBColor .blue );
104
104
enableCommentPath .setForeground (JBColor .blue );
105
105
setDefaultValues ();
106
+ refreshAdditionalFields (hasAdditionalPath .isSelected ());
106
107
}
107
108
108
109
/**
@@ -129,8 +130,9 @@ private void onOK() {
129
130
modulePathError .setText ("The `Path To Analyse` field is empty or invalid" );
130
131
return ;
131
132
}
132
- if (additionalPath .getComponent ().getText ().isEmpty ()
133
- || !UctModulePathValidatorUtil .validate (additionalPath .getComponent ().getText ())) {
133
+ if (hasAdditionalPath .isSelected () && additionalPath .getComponent ().getText ().isEmpty ()
134
+ || hasAdditionalPath .isSelected ()
135
+ && !UctModulePathValidatorUtil .validate (additionalPath .getComponent ().getText ())) {
134
136
additionalPathError .setText ("The `Path To Analyse` field is empty or invalid" );
135
137
return ;
136
138
}
@@ -232,17 +234,11 @@ private void setDefaultValues() {
232
234
ignoreCurrentVersion .setSelected (Objects .requireNonNullElse (shouldIgnore , false ));
233
235
234
236
final Boolean isShowAdditionalPath = settingsService .getHasAdditionalPath ();
235
- additionalPath . setEnabled (
237
+ hasAdditionalPath . setSelected (
236
238
Objects .requireNonNullElse (isShowAdditionalPath , false )
237
239
);
238
240
239
- if (settingsService .getAdditionalPath () == null ) {
240
- final String basePath = Settings .getMagentoPath (project );
241
-
242
- if (basePath != null ) {
243
- additionalPath .getComponent ().setText (basePath );
244
- }
245
- } else {
241
+ if (settingsService .getAdditionalPath () != null ) {
246
242
additionalPath .getComponent ().setText (settingsService .getAdditionalPath ());
247
243
}
248
244
}
@@ -307,5 +303,8 @@ private void createUIComponents() {
307
303
308
304
private void refreshAdditionalFields (final boolean isEnabled ) {
309
305
additionalPath .setEnabled (isEnabled );
306
+ additionalPath .setVisible (isEnabled );
307
+ additionalPathLabel .setVisible (isEnabled );
308
+ additionalPathError .setVisible (isEnabled );
310
309
}
311
310
}
0 commit comments