Skip to content

Commit c67781d

Browse files
author
Vitaliy
authored
Merge branch '1.0.0-develop' into test-covered-for-graphql-resolver--task-115
2 parents 5090dd2 + 8d5b888 commit c67781d

File tree

4 files changed

+22
-6
lines changed

4 files changed

+22
-6
lines changed

resources/magento2/validation.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ validator.notEmpty={0} must not be empty
22
validator.package.validPath=Please specify a valid Magento 2 installation path
33
validator.alphaNumericCharacters={0} must contain letters and numbers only
44
validator.startWithNumberOrCapitalLetter={0} must start from a number or a capital letter
5+
validator.onlyNumbers={0} must contain numbers only
6+
validator.identifier={0} must contain letters, numbers, dashes, and underscores only
57
validator.directory.isNotValid={0} is not valid
68
validator.module.noSuchModule=No such module {0}
79
validator.file.alreadyExists={0} already exists
810
validator.file.cantBeCreated={0} can't be created
11+
validator.class.alreadyDeclared={0} already declared in the target module

src/com/magento/idea/magento2plugin/actions/generation/dialog/OverrideClassByAPreferenceDialog.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.magento.idea.magento2plugin.indexes.ModuleIndex;
1818
import com.magento.idea.magento2plugin.magento.packages.Package;
1919
import com.magento.idea.magento2plugin.ui.FilteredComboBox;
20+
import com.magento.idea.magento2plugin.validators.ValidatorBundle;
2021
import org.jetbrains.annotations.NotNull;
2122
import javax.swing.*;
2223
import java.awt.event.*;
@@ -123,7 +124,9 @@ private void onOK() {
123124
getPreferenceArea()
124125
), project).generate(OverrideClassByAPreferenceAction.ACTION_NAME);
125126
if (diXml == null) {
126-
JOptionPane.showMessageDialog(null, "Preference already declared in the target module!", "Error", JOptionPane.ERROR_MESSAGE);
127+
String errorMessage = ValidatorBundle.message("validator.class.alreadyDeclared", "Preference");
128+
JOptionPane.showMessageDialog(null, errorMessage, "Error", JOptionPane.ERROR_MESSAGE);
129+
127130
return;
128131
}
129132

src/com/magento/idea/magento2plugin/actions/generation/dialog/validator/CreateAPluginDialogValidator.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,9 @@ public boolean validate(Project project)
7575
}
7676

7777
if (!pluginName.matches(Regex.IDENTIFIER)) {
78-
JOptionPane.showMessageDialog(null, "Plugin Name must contain letters, numbers, dashes, and underscores only.", errorTitle, JOptionPane.ERROR_MESSAGE);
78+
String errorMessage = ValidatorBundle.message("validator.identifier", "Plugin Name");
79+
JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE);
80+
7981
return false;
8082
}
8183

@@ -88,7 +90,9 @@ public boolean validate(Project project)
8890
}
8991

9092
if (!sortOrder.matches(Regex.NUMERIC)) {
91-
JOptionPane.showMessageDialog(null, "Sort Order must contain numbers only.", errorTitle, JOptionPane.ERROR_MESSAGE);
93+
String errorMessage = ValidatorBundle.message("validator.onlyNumbers", "Sort Order");
94+
JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE);
95+
9296
return false;
9397
}
9498

@@ -102,7 +106,9 @@ public boolean validate(Project project)
102106

103107
List<String> allModulesList = ModuleIndex.getInstance(project).getEditableModuleNames();
104108
if (!allModulesList.contains(pluginModule)) {
105-
JOptionPane.showMessageDialog(null, "No such module '".concat(pluginModule).concat("'."), errorTitle, JOptionPane.ERROR_MESSAGE);
109+
String errorMessage = ValidatorBundle.message("validator.module.noSuchModule", pluginModule);
110+
JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE);
111+
106112
return false;
107113
}
108114

src/com/magento/idea/magento2plugin/actions/generation/dialog/validator/OverrideClassByAPreferenceDialogValidator.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,16 @@ public boolean validate(Project project)
3636
}
3737

3838
if (!preferenceClassName.matches(Regex.ALPHANUMERIC)) {
39-
JOptionPane.showMessageDialog(null, "Preference Class Name must contain letters and numbers only.", errorTitle, JOptionPane.ERROR_MESSAGE);
39+
String errorMessage = ValidatorBundle.message("validator.alphaNumericCharacters", "Preference Class");
40+
JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE);
41+
4042
return false;
4143
}
4244

4345
if (!Character.isUpperCase(preferenceClassName.charAt(0)) && !Character.isDigit(preferenceClassName.charAt(0))) {
44-
JOptionPane.showMessageDialog(null, "Preference Class Name must start from a number or a capital letter", errorTitle, JOptionPane.ERROR_MESSAGE);
46+
String errorMessage = ValidatorBundle.message("validator.startWithNumberOrCapitalLetter", "Preference Class");
47+
JOptionPane.showMessageDialog(null, errorMessage, errorTitle, JOptionPane.ERROR_MESSAGE);
48+
4549
return false;
4650
}
4751

0 commit comments

Comments
 (0)