From 9ae0e5776e456d42280b5012798a0e2e6d52749a Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 7 Jan 2019 15:40:15 +0100 Subject: [PATCH] require psiManager when need --- .../cache/impl/IndexTodoCacheManagerImpl.java | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/IndexTodoCacheManagerImpl.java b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/IndexTodoCacheManagerImpl.java index 3144239c016b..d56985146531 100644 --- a/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/IndexTodoCacheManagerImpl.java +++ b/platform/editor-ui-ex/src/com/intellij/psi/impl/cache/impl/IndexTodoCacheManagerImpl.java @@ -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 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); }