File tree Expand file tree Collapse file tree 3 files changed +25
-23
lines changed
src/com/magento/idea/magento2plugin
actions/generation/dialog Expand file tree Collapse file tree 3 files changed +25
-23
lines changed Original file line number Diff line number Diff line change @@ -73,7 +73,7 @@ public class NewModuleDialog extends AbstractDialog implements ListSelectionList
73
73
private JLabel moduleDescriptionLabel ;//NOPMD
74
74
private JLabel moduleNameLabel ;//NOPMD
75
75
76
- private static final String MAGENTO_OLD_VERSION = "2.2.11" ;
76
+ private static final String MAGENTO_BEFORE_DECLARATIVE_SCHEMA_VERSION = "2.2.11" ;
77
77
78
78
/**
79
79
* Constructor.
@@ -238,22 +238,20 @@ public String getModuleVersion() {
238
238
}
239
239
240
240
/**
241
- * get Module Version .
241
+ * Get module version .
242
242
*
243
243
* @return string|null
244
244
*/
245
245
public String getSetupVersion () {
246
- String setupVersion = null ;
247
246
final String magentoVersion = getMagentoVersion ();
248
-
249
- if (!MagentoVersion .compareMagentoVersion (magentoVersion , MAGENTO_OLD_VERSION )) {
250
- setupVersion = this .moduleVersion .getText ().trim ();
247
+ if (!MagentoVersion .compare (magentoVersion , MAGENTO_BEFORE_DECLARATIVE_SCHEMA_VERSION )) {
248
+ return this .moduleVersion .getText ().trim ();
251
249
}
252
- return setupVersion ;
250
+ return null ;
253
251
}
254
252
255
253
/**
256
- * get Magento Version .
254
+ * Get magento version .
257
255
*
258
256
* @return string
259
257
*/
@@ -362,7 +360,7 @@ public void valueChanged(final ListSelectionEvent listSelectionEvent) {
362
360
}
363
361
364
362
/**
365
- * get setting .
363
+ * Get settings .
366
364
*
367
365
* @return Settings
368
366
*/
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public boolean isPrimaryGenerator() {
64
64
}
65
65
66
66
/**
67
- * generateProject .
67
+ * Generate project .
68
68
*
69
69
* @param project Project
70
70
* @param baseDir Base directory
@@ -102,7 +102,7 @@ public void generateProject(
102
102
}
103
103
104
104
/**
105
- * generateComposerJson .
105
+ * Generate composer json .
106
106
*
107
107
* @param project Project
108
108
* @param baseDir Base directory
@@ -128,7 +128,8 @@ private PsiFile generateComposerJson(
128
128
}
129
129
130
130
/**
131
- * generateRegistrationPhp.
131
+ * Generate registration php.
132
+ *
132
133
* @param project Project
133
134
* @param baseDir Base directory
134
135
* @param settings Settings
@@ -148,7 +149,7 @@ private PsiFile generateRegistrationPhp(
148
149
}
149
150
150
151
/**
151
- * generateModuleXml .
152
+ * Generate module xml .
152
153
*
153
154
* @param project Project
154
155
* @param baseDir Base directory
Original file line number Diff line number Diff line change @@ -72,20 +72,23 @@ private static String getFilePath(final String magentoPath) {
72
72
}
73
73
74
74
/**
75
- * compare Magento Version .
75
+ * Compare two magento version .
76
76
*
77
- * @param str1 String
78
- * @param str2 String
79
- * @return boolean
77
+ * @param version1 String
78
+ * @param version2 String
79
+ * @return the value {@code true} if the argument version1 is greater than equal to version2;
80
+ * the value {@code false} if the argument version1 is less than to version2.
80
81
*/
81
- public static boolean compareMagentoVersion (final String str1 , final String str2 ) {
82
- if (str1 .equals (str2 )) return true ;
82
+ public static boolean compare (final String version1 , final String version2 ) {
83
+ if (version1 .equals (version2 )) {
84
+ return true ;
85
+ }
83
86
84
- final String [] str1s = str1 .split ("\\ ." );
85
- final String [] str2s = str2 .split ("\\ ." );
87
+ final String [] version1s = version1 .split ("\\ ." );
88
+ final String [] version2s = version2 .split ("\\ ." );
86
89
for (int i = 0 ; i < 2 ; i ++) {
87
- final Integer value1 = Integer .parseInt (str1s [i ]);
88
- final Integer value2 = Integer .parseInt (str2s [i ]);
90
+ final int value1 = Integer .parseInt (version1s [i ]);
91
+ final int value2 = Integer .parseInt (version2s [i ]);
89
92
if (value1 > value2 ) {
90
93
return true ;
91
94
}
You can’t perform that action at this time.
0 commit comments