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
7373 private JLabel moduleDescriptionLabel ;//NOPMD
7474 private JLabel moduleNameLabel ;//NOPMD
7575
76- private static final String MAGENTO_OLD_VERSION = "2.2.11" ;
76+ private static final String MAGENTO_BEFORE_DECLARATIVE_SCHEMA_VERSION = "2.2.11" ;
7777
7878 /**
7979 * Constructor.
@@ -238,22 +238,20 @@ public String getModuleVersion() {
238238 }
239239
240240 /**
241- * get Module Version .
241+ * Get module version .
242242 *
243243 * @return string|null
244244 */
245245 public String getSetupVersion () {
246- String setupVersion = null ;
247246 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 ();
251249 }
252- return setupVersion ;
250+ return null ;
253251 }
254252
255253 /**
256- * get Magento Version .
254+ * Get magento version .
257255 *
258256 * @return string
259257 */
@@ -362,7 +360,7 @@ public void valueChanged(final ListSelectionEvent listSelectionEvent) {
362360 }
363361
364362 /**
365- * get setting .
363+ * Get settings .
366364 *
367365 * @return Settings
368366 */
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public boolean isPrimaryGenerator() {
6464 }
6565
6666 /**
67- * generateProject .
67+ * Generate project .
6868 *
6969 * @param project Project
7070 * @param baseDir Base directory
@@ -102,7 +102,7 @@ public void generateProject(
102102 }
103103
104104 /**
105- * generateComposerJson .
105+ * Generate composer json .
106106 *
107107 * @param project Project
108108 * @param baseDir Base directory
@@ -128,7 +128,8 @@ private PsiFile generateComposerJson(
128128 }
129129
130130 /**
131- * generateRegistrationPhp.
131+ * Generate registration php.
132+ *
132133 * @param project Project
133134 * @param baseDir Base directory
134135 * @param settings Settings
@@ -148,7 +149,7 @@ private PsiFile generateRegistrationPhp(
148149 }
149150
150151 /**
151- * generateModuleXml .
152+ * Generate module xml .
152153 *
153154 * @param project Project
154155 * @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) {
7272 }
7373
7474 /**
75- * compare Magento Version .
75+ * Compare two magento version .
7676 *
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.
8081 */
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+ }
8386
84- final String [] str1s = str1 .split ("\\ ." );
85- final String [] str2s = str2 .split ("\\ ." );
87+ final String [] version1s = version1 .split ("\\ ." );
88+ final String [] version2s = version2 .split ("\\ ." );
8689 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 ]);
8992 if (value1 > value2 ) {
9093 return true ;
9194 }
You can’t perform that action at this time.
0 commit comments