File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed
src/com/magento/idea/magento2plugin/indexes Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change 12
12
import com .intellij .psi .PsiDirectory ;
13
13
import com .intellij .psi .PsiManager ;
14
14
import com .intellij .psi .search .GlobalSearchScope ;
15
+ import com .intellij .util .SlowOperations ;
15
16
import com .intellij .util .indexing .FileBasedIndex ;
16
17
import com .jetbrains .php .lang .PhpFileType ;
17
18
import com .magento .idea .magento2plugin .magento .packages .Package ;
@@ -116,6 +117,7 @@ private List<String> getNames(
116
117
* Returns PSI directory of the certain module.
117
118
*
118
119
* @param moduleName String
120
+ *
119
121
* @return PsiDirectory
120
122
*/
121
123
public @ Nullable PsiDirectory getModuleDirectoryByModuleName (final String moduleName ) {
@@ -124,14 +126,20 @@ private List<String> getNames(
124
126
}
125
127
final FileBasedIndex index = FileBasedIndex
126
128
.getInstance ();
127
-
128
- final Collection <VirtualFile > files = index .getContainingFiles (
129
- ModuleNameIndex .KEY ,
130
- moduleName ,
131
- GlobalSearchScope .getScopeRestrictedByFileTypes (
132
- GlobalSearchScope .allScope (project ),
133
- PhpFileType .INSTANCE
134
- ));
129
+ final Collection <VirtualFile > files = new ArrayList <>();
130
+
131
+ SlowOperations .allowSlowOperations (() -> {
132
+ files .addAll (
133
+ index .getContainingFiles (
134
+ ModuleNameIndex .KEY ,
135
+ moduleName ,
136
+ GlobalSearchScope .getScopeRestrictedByFileTypes (
137
+ GlobalSearchScope .allScope (project ),
138
+ PhpFileType .INSTANCE
139
+ )
140
+ )
141
+ );
142
+ });
135
143
136
144
if (files .isEmpty ()) {
137
145
return null ;
You can’t perform that action at this time.
0 commit comments