mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
require psiManager when need
This commit is contained in:
+5
-20
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
|
||||
package com.intellij.psi.impl.cache.impl;
|
||||
|
||||
@@ -44,11 +30,9 @@ import java.util.Set;
|
||||
*/
|
||||
public class IndexTodoCacheManagerImpl implements TodoCacheManager {
|
||||
private final Project myProject;
|
||||
private final PsiManager myPsiManager;
|
||||
|
||||
public IndexTodoCacheManagerImpl(PsiManager psiManager) {
|
||||
myPsiManager = psiManager;
|
||||
myProject = psiManager.getProject();
|
||||
public IndexTodoCacheManagerImpl(@NotNull Project project) {
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,10 +48,11 @@ public class IndexTodoCacheManagerImpl implements TodoCacheManager {
|
||||
final Collection<VirtualFile> files = fileBasedIndex.getContainingFiles(
|
||||
TodoIndex.NAME,
|
||||
new TodoIndexEntry(indexPattern.getPatternString(), indexPattern.isCaseSensitive()), GlobalSearchScope.allScope(myProject));
|
||||
PsiManager psiManager = PsiManager.getInstance(myProject);
|
||||
ApplicationManager.getApplication().runReadAction(() -> {
|
||||
for (VirtualFile file : files) {
|
||||
if (projectFileIndex.isInContent(file)) {
|
||||
final PsiFile psiFile = myPsiManager.findFile(file);
|
||||
final PsiFile psiFile = psiManager.findFile(file);
|
||||
if (psiFile != null) {
|
||||
allFiles.add(psiFile);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user