Skip to content

Commit a9c7c86

Browse files
author
Vitaliy
authored
Merge pull request #317 from drpayyne/bug/disabled-validator
Fixed validator when plugin is disabled
2 parents 1d85ef9 + 251f450 commit a9c7c86

File tree

2 files changed

+23
-25
lines changed

2 files changed

+23
-25
lines changed

src/com/magento/idea/magento2plugin/project/SettingsForm.form

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</constraints>
8181
<properties>
8282
<horizontalAlignment value="0"/>
83-
<text value="Regenerate URN mappings:"/>
83+
<text value="Regenerate URN mappings"/>
8484
</properties>
8585
</component>
8686
<component id="aad3b" class="javax.swing.JTextField" binding="magentoVersion">

src/com/magento/idea/magento2plugin/project/validator/SettingsFormValidator.java

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,33 +24,31 @@ public SettingsFormValidator(
2424
}
2525

2626
/**
27-
* Validate form.
27+
* Validates form if plugin is enabled.
2828
*
2929
* @throws ConfigurationException Exception
3030
*/
3131
public void validate() throws ConfigurationException {
32-
if (!form.getSettings().pluginEnabled) {
33-
return;
34-
}
35-
36-
if (!MagentoBasePathUtil.isMagentoFolderValid(form.getMagentoPath())) {
37-
throw new ConfigurationException(
38-
validatorBundle.message("validator.package.validPath")
39-
);
40-
}
41-
42-
final String magentoVersion = form.getMagentoVersion();
43-
if (magentoVersion.length() == 0) {
44-
throw new ConfigurationException(
45-
validatorBundle.message("validator.notEmpty", "Magento Version")
46-
);
47-
}
48-
49-
if (!magentoVersion.matches(RegExUtil.MAGENTO_VERSION)
50-
&& !magentoVersion.equals(MagentoVersionUtil.DEFAULT_VERSION)) {
51-
throw new ConfigurationException(
52-
validatorBundle.message("validator.magentoVersionInvalid")
53-
);
32+
if (form.isBeingUsed()) {
33+
if (!MagentoBasePathUtil.isMagentoFolderValid(form.getMagentoPath())) {
34+
throw new ConfigurationException(
35+
validatorBundle.message("validator.package.validPath")
36+
);
37+
}
38+
39+
final String magentoVersion = form.getMagentoVersion();
40+
if (magentoVersion.length() == 0) {
41+
throw new ConfigurationException(
42+
validatorBundle.message("validator.notEmpty", "Magento Version")
43+
);
44+
}
45+
46+
if (!magentoVersion.matches(RegExUtil.MAGENTO_VERSION)
47+
&& !magentoVersion.equals(MagentoVersionUtil.DEFAULT_VERSION)) {
48+
throw new ConfigurationException(
49+
validatorBundle.message("validator.magentoVersionInvalid")
50+
);
51+
}
5452
}
5553
}
56-
}
54+
}

0 commit comments

Comments
 (0)