Stop using deprecated method

This commit is contained in:
Roman Shevchenko
2012-08-24 22:19:12 +04:00
parent 451fba2c78
commit 3ad72015bf
7 changed files with 47 additions and 20 deletions
@@ -1,3 +1,19 @@
/*
* Copyright 2000-2012 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.
*/
/*
* User: anna
* Date: 11-Sep-2007
@@ -8,9 +24,9 @@ import com.intellij.JavaTestUtil;
import com.intellij.codeInspection.ex.LocalInspectionToolWrapper;
import com.intellij.codeInspection.java15api.Java15APIUsageInspection;
import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.impl.FileIndexImplUtil;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.pom.java.LanguageLevel;
@@ -45,6 +61,7 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
doTest();
}
@SuppressWarnings("UnusedDeclaration")
public void _testCollectSinceApiUsages() {
final String version = "1.4";
final ContentIterator contentIterator = new ContentIterator() {
@@ -77,6 +94,7 @@ public class JavaAPIUsagesInspectionTest extends InspectionTestCase {
}
};
final VirtualFile srcFile = JarFileSystem.getInstance().findFileByPath("c:/program files/java/jdk1.6.0_12/src.zip!/");
FileIndexImplUtil.iterateRecursively(srcFile, VirtualFileFilter.ALL, contentIterator);
assert srcFile != null;
VfsUtilCore.iterateChildrenRecursively(srcFile, VirtualFileFilter.ALL, contentIterator);
}
}
@@ -29,12 +29,12 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.project.ProjectUtil;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.impl.FileIndexImplUtil;
import com.intellij.openapi.roots.libraries.LibraryUtil;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.profile.ProjectProfileManager;
@@ -269,7 +269,7 @@ public class AnalysisScope {
if (mySearchInLibraries) {
final VirtualFile[] libraryRoots = LibraryUtil.getLibraryRoots(myProject, false, false);
for (VirtualFile libraryRoot : libraryRoots) {
FileIndexImplUtil.iterateRecursively(libraryRoot, VirtualFileFilter.ALL, contentIterator);
VfsUtilCore.iterateChildrenRecursively(libraryRoot, VirtualFileFilter.ALL, contentIterator);
}
}
}
@@ -396,7 +396,7 @@ public class AnalysisScope {
final Project project = dir.getProject();
final PsiManager psiManager = PsiManager.getInstance(project);
final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();
FileIndexImplUtil.iterateRecursively(dir.getVirtualFile(), VirtualFileFilter.ALL, new ContentIterator() {
VfsUtilCore.iterateChildrenRecursively(dir.getVirtualFile(), VirtualFileFilter.ALL, new ContentIterator() {
@Override
@SuppressWarnings({"SimplifiableIfStatement"})
public boolean processFile(@NotNull final VirtualFile fileOrDir) {
@@ -34,9 +34,11 @@ import com.intellij.openapi.module.ModuleManager;
import com.intellij.openapi.progress.ProcessCanceledException;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.openapi.project.*;
import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.project.ProjectCoreUtil;
import com.intellij.openapi.roots.*;
import com.intellij.openapi.roots.impl.FileIndexImplUtil;
import com.intellij.openapi.ui.MessageType;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Factory;
@@ -45,17 +47,17 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.util.text.TrigramBuilder;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.openapi.vfs.*;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.openapi.wm.ToolWindowManager;
import com.intellij.psi.*;
import com.intellij.psi.impl.cache.CacheManager;
import com.intellij.psi.search.*;
import com.intellij.usageView.UsageInfo;
import com.intellij.usages.*;
import com.intellij.usages.FindUsagesProcessPresentation;
import com.intellij.usages.UsageLimitUtil;
import com.intellij.usages.UsageTarget;
import com.intellij.usages.UsageViewPresentation;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Function;
import com.intellij.util.PatternUtil;
@@ -454,7 +456,7 @@ public class FindInProjectUtil {
}
};
for (VirtualFile file : files) {
if (!FileIndexImplUtil.iterateRecursively(file, contentFilter, iterator)) return false;
if (!VfsUtilCore.iterateChildrenRecursively(file, contentFilter, iterator)) return false;
}
return true;
}
@@ -21,9 +21,14 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import org.jetbrains.annotations.NotNull;
@SuppressWarnings("UnusedDeclaration")
public class FileIndexImplUtil {
private FileIndexImplUtil() { }
/**
* @deprecated use {@linkplain VfsUtilCore#iterateChildrenRecursively(com.intellij.openapi.vfs.VirtualFile,
* com.intellij.openapi.vfs.VirtualFileFilter, com.intellij.openapi.roots.ContentIterator)} (to remove in IDEA 13)
*/
public static boolean iterateRecursively(@NotNull final VirtualFile root,
@NotNull final VirtualFileFilter filter,
@NotNull final ContentIterator iterator) {
@@ -23,6 +23,7 @@ import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.ModuleFileIndex;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import com.intellij.util.SmartList;
@@ -57,7 +58,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
if (parentInfo != null && myModule.equals(parentInfo.module)) continue; // inner content - skip it
}
boolean finished = FileIndexImplUtil.iterateRecursively(contentRoot, myContentFilter, iterator);
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
if (!finished) return false;
}
@@ -66,7 +67,7 @@ public class ModuleFileIndexImpl implements ModuleFileIndex {
@Override
public boolean iterateContentUnderDirectory(@NotNull VirtualFile dir, @NotNull ContentIterator iterator) {
return FileIndexImplUtil.iterateRecursively(dir, myContentFilter, iterator);
return VfsUtilCore.iterateChildrenRecursively(dir, myContentFilter, iterator);
}
@Override
@@ -27,6 +27,7 @@ import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.ModuleRootManager;
import com.intellij.openapi.roots.OrderEntry;
import com.intellij.openapi.roots.ProjectFileIndex;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
import org.jetbrains.annotations.NotNull;
@@ -67,7 +68,7 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
if (parentInfo != null && parentInfo.module != null) continue; // inner content - skip it
}
boolean finished = FileIndexImplUtil.iterateRecursively(contentRoot, myContentFilter, iterator);
boolean finished = VfsUtilCore.iterateChildrenRecursively(contentRoot, myContentFilter, iterator);
if (!finished) return false;
}
}
@@ -85,7 +86,7 @@ public class ProjectFileIndexImpl implements ProjectFileIndex {
}
public boolean iterateContentUnderDirectory(@NotNull VirtualFile dir, @NotNull ContentIterator iterator) {
return FileIndexImplUtil.iterateRecursively(dir, myContentFilter, iterator);
return VfsUtilCore.iterateChildrenRecursively(dir, myContentFilter, iterator);
}
public boolean isIgnored(@NotNull VirtualFile file) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2012 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.
@@ -20,7 +20,6 @@ import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ContentIterator;
import com.intellij.openapi.roots.FileIndexFacade;
import com.intellij.openapi.roots.impl.FileIndexImplUtil;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.*;
@@ -28,6 +27,7 @@ import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vcs.changes.LocalChangeList;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vfs.VfsUtilCore;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.openapi.vfs.VirtualFileFilter;
@@ -88,7 +88,7 @@ public class CommonCheckinFilesAction extends AbstractCommonCheckinAction {
});
}
};
FileIndexImplUtil.iterateRecursively(file, filter, new ContentIterator() {
VfsUtilCore.iterateChildrenRecursively(file, filter, new ContentIterator() {
public boolean processFile(final VirtualFile fileOrDir) {
final Change c = changeListManager.getChange(fileOrDir);
if (c != null) {