|
25 | 25 | * |
26 | 26 | * @author Daniel Espendiller <daniel@espendiller.net> |
27 | 27 | */ |
| 28 | +@SuppressWarnings("deprecation") |
28 | 29 | abstract public class SymfonyTempCodeInsightFixtureTestCase extends UsefulTestCase { |
29 | 30 | private Project project; |
30 | 31 |
|
@@ -83,26 +84,24 @@ protected VirtualFile[] createFiles(@NotNull String... files) { |
83 | 84 | protected VirtualFile createFile(@NotNull String file, @Nullable String content) { |
84 | 85 | final VirtualFile[] childData = new VirtualFile[1]; |
85 | 86 |
|
86 | | - ApplicationManager.getApplication().runWriteAction(new Runnable() { |
87 | | - @Override |
88 | | - public void run() { |
89 | | - try { |
90 | | - String[] paths = file.split("/"); |
91 | | - |
92 | | - if(paths.length == 0) { |
93 | | - childData[0] = getProject().getBaseDir().createChildData(this, file); |
94 | | - } else { |
95 | | - childData[0] = VfsUtil.createDirectoryIfMissing( |
96 | | - getProject().getBaseDir(), |
97 | | - StringUtils.join(Arrays.copyOf(paths, paths.length - 1), "/") |
98 | | - ).createChildData(this, paths[paths.length - 1]); |
99 | | - } |
100 | | - |
101 | | - if(content != null) { |
102 | | - childData[0].setBinaryContent(content.getBytes()); |
103 | | - } |
104 | | - } catch (IOException ignored) { |
| 87 | + ApplicationManager.getApplication().runWriteAction(() -> { |
| 88 | + try { |
| 89 | + String[] paths = file.split("/"); |
| 90 | + VirtualFile baseDir = getProject().getBaseDir(); |
| 91 | + |
| 92 | + if(paths.length == 0) { |
| 93 | + childData[0] = baseDir.createChildData(SymfonyTempCodeInsightFixtureTestCase.this, file); |
| 94 | + } else { |
| 95 | + childData[0] = VfsUtil.createDirectoryIfMissing( |
| 96 | + baseDir, |
| 97 | + StringUtils.join(Arrays.copyOf(paths, paths.length - 1), "/") |
| 98 | + ).createChildData(SymfonyTempCodeInsightFixtureTestCase.this, paths[paths.length - 1]); |
105 | 99 | } |
| 100 | + |
| 101 | + if(content != null) { |
| 102 | + childData[0].setBinaryContent(content.getBytes()); |
| 103 | + } |
| 104 | + } catch (IOException ignored) { |
106 | 105 | } |
107 | 106 | }); |
108 | 107 |
|
|
0 commit comments