@@ -117,8 +117,8 @@ protected void onOK() {
117117 exit ();
118118 }
119119
120- private PsiFile generateFile () {
121- return new ModuleBlockClassGenerator (new BlockFileData (
120+ private void generateFile () {
121+ new ModuleBlockClassGenerator (new BlockFileData (
122122 getBlockDirectory (),
123123 getBlockName (),
124124 getModuleName (),
@@ -140,13 +140,15 @@ public String getBlockDirectory() {
140140
141141 private void suggestBlockDirectory () {
142142 final String moduleIdentifierPath = getModuleIdentifierPath ();
143+
143144 if (moduleIdentifierPath == null ) {
144145 blockParentDir .setText (BlockPhp .DEFAULT_DIR );
145146 return ;
146147 }
147148 final String path = baseDir .getVirtualFile ().getPath ();
148149 final String [] pathParts = path .split (moduleIdentifierPath );
149150 final int minimumPathParts = 2 ;
151+
150152 if (pathParts .length != minimumPathParts ) {
151153 blockParentDir .setText (BlockPhp .DEFAULT_DIR );
152154 return ;
@@ -161,27 +163,25 @@ private void suggestBlockDirectory() {
161163
162164 private String getModuleIdentifierPath () {
163165 final String []parts = moduleName .split (Package .vendorModuleNameSeparator );
166+
164167 if (parts [0 ] == null || parts [1 ] == null || parts .length > 2 ) {
165168 return null ;
166169 }
170+
167171 return parts [0 ] + File .separator + parts [1 ];
168172 }
169173
170174 private String getNamespace () {
171175 final String []parts = moduleName .split (Package .vendorModuleNameSeparator );
176+
172177 if (parts [0 ] == null || parts [1 ] == null || parts .length > 2 ) {
173178 return null ;
174179 }
175180 final String directoryPart = getBlockDirectory ().replace (
176181 File .separator ,
177182 Package .fqnSeparator
178183 );
179- return parts [0 ] + Package .fqnSeparator + parts [1 ] + Package .fqnSeparator + directoryPart ;
180- }
181184
182- @ Override
183- public void onCancel () {
184- // add your code here if necessary
185- dispose ();
185+ return parts [0 ] + Package .fqnSeparator + parts [1 ] + Package .fqnSeparator + directoryPart ;
186186 }
187187}
0 commit comments