3
3
* See COPYING.txt for license details.
4
4
*/
5
5
6
- package com .magento .idea .magento2plugin .actions .generation .dialog . NewSetupDataPatch ;
6
+ package com .magento .idea .magento2plugin .actions .generation .dialog ;
7
7
8
8
import com .intellij .openapi .project .Project ;
9
9
import com .intellij .psi .PsiDirectory ;
10
10
import com .intellij .psi .PsiFile ;
11
11
import com .magento .idea .magento2plugin .actions .context .php .NewSetupDataPatchAction ;
12
12
import com .magento .idea .magento2plugin .actions .generation .ModuleSetupDataPatchData ;
13
- import com .magento .idea .magento2plugin .actions .generation .dialog .AbstractDialog ;
14
13
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .annotation .FieldValidation ;
15
14
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .annotation .RuleRegistry ;
16
15
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .NotEmptyRule ;
17
16
import com .magento .idea .magento2plugin .actions .generation .dialog .validator .rule .PhpClassRule ;
18
17
import com .magento .idea .magento2plugin .actions .generation .generator .ModuleSetupDataPatchGenerator ;
19
18
import com .magento .idea .magento2plugin .magento .files .ModuleSetupDataPatchFile ;
20
19
21
-
22
20
import javax .swing .JButton ;
23
21
import javax .swing .JComponent ;
24
22
import javax .swing .JLabel ;
25
23
import javax .swing .JPanel ;
26
24
import javax .swing .JTextField ;
27
- import javax .swing .KeyStroke ;
28
25
import java .awt .event .ActionEvent ;
29
26
import java .awt .event .KeyEvent ;
30
27
import java .awt .event .WindowAdapter ;
31
28
import java .awt .event .WindowEvent ;
32
29
import java .util .Objects ;
30
+ import javax .swing .KeyStroke ;
33
31
34
32
public class NewSetupDataPatchDialog extends AbstractDialog {
35
33
@@ -151,7 +149,7 @@ public String getClassName() {
151
149
private boolean validateFields () {
152
150
PsiDirectory targetDirectory = getDirectory (baseDir );
153
151
154
- if (targetDirectory .getName ().equals (NewSetupDataPatchAction .DATA_DIRECTORY )) {
152
+ if (targetDirectory .getName ().equals (NewSetupDataPatchAction .DATA_DIRECTORY )){
155
153
final PsiFile [] files = targetDirectory .getFiles ();
156
154
for (PsiFile file : files ) {
157
155
if (file .getName ().equals (getClassName () + ModuleSetupDataPatchFile .FILE_NAME )) {
@@ -168,28 +166,29 @@ private boolean validateFields() {
168
166
}
169
167
170
168
private PsiDirectory getDirectory (PsiDirectory targetDirectory ){
171
- if (baseDir .getName ().equals (NewSetupDataPatchAction .ROOT_DIRECTORY )) {
172
- PsiDirectory subDirectoryPatch =
173
- baseDir .findSubdirectory (NewSetupDataPatchAction .PATCH_DIRECTORY );
169
+ if (baseDir .getName ().equals (NewSetupDataPatchAction .ROOT_DIRECTORY )){
170
+ PsiDirectory subDirectoryPatch = baseDir .findSubdirectory (
171
+ NewSetupDataPatchAction .PATCH_DIRECTORY
172
+ );
174
173
175
174
if (subDirectoryPatch != null ) {
176
175
return subDirectoryPatch .findSubdirectory (NewSetupDataPatchAction .DATA_DIRECTORY );
177
176
}
178
177
}
179
- if (baseDir .getName ().equals (NewSetupDataPatchAction .PATCH_DIRECTORY )) {
178
+ if (baseDir .getName ().equals (NewSetupDataPatchAction .PATCH_DIRECTORY )) {
180
179
return baseDir .findSubdirectory (NewSetupDataPatchAction .DATA_DIRECTORY );
181
180
}
182
181
183
182
return targetDirectory ;
184
183
}
185
184
186
185
private PsiDirectory createDirectory (PsiDirectory targetDirectory ) {
187
- if (targetDirectory .getName ().equals (NewSetupDataPatchAction .ROOT_DIRECTORY )){
186
+ if (targetDirectory .getName ().equals (NewSetupDataPatchAction .ROOT_DIRECTORY )){
188
187
PsiDirectory subDirectoryPatch = targetDirectory .findSubdirectory (
189
188
NewSetupDataPatchAction .PATCH_DIRECTORY
190
189
);
191
190
192
- if (subDirectoryPatch == null ) {
191
+ if (subDirectoryPatch == null ){
193
192
return targetDirectory .createSubdirectory (
194
193
NewSetupDataPatchAction .PATCH_DIRECTORY
195
194
).createSubdirectory (NewSetupDataPatchAction .DATA_DIRECTORY );
@@ -204,7 +203,7 @@ private PsiDirectory createDirectory(PsiDirectory targetDirectory) {
204
203
)
205
204
);
206
205
}
207
- if (targetDirectory .getName ().equals (NewSetupDataPatchAction .PATCH_DIRECTORY )){
206
+ if (targetDirectory .getName ().equals (NewSetupDataPatchAction .PATCH_DIRECTORY )){
208
207
PsiDirectory subDirectoryData = targetDirectory .findSubdirectory (
209
208
NewSetupDataPatchAction .DATA_DIRECTORY
210
209
);
0 commit comments