ProjectFileIndex#isIgnored renamed to 'isExcluded'

This commit is contained in:
nik
2014-07-22 16:31:23 +04:00
parent 0e6703225e
commit da81c5d0b6
20 changed files with 48 additions and 36 deletions
@@ -300,7 +300,7 @@ final class ThumbnailViewUI extends JPanel implements DataProvider, Disposable {
Project project = thumbnailView.getProject();
if (!project.isDisposed()) {
ProjectRootManager rootManager = ProjectRootManager.getInstance(project);
boolean projectIgnored = rootManager.getFileIndex().isIgnored(file);
boolean projectIgnored = rootManager.getFileIndex().isExcluded(file);
if (!projectIgnored && !FileTypeManager.getInstance().isFileIgnored(file)) {
ImageFileTypeManager typeManager = ImageFileTypeManager.getInstance();
@@ -70,7 +70,7 @@ public class JavaDirectoryIconProvider extends IconProvider implements DumbAware
else if (JavaDirectoryService.getInstance().getPackage(psiDirectory) != null) {
symbolIcon = PlatformIcons.PACKAGE_ICON;
}
else if (!Registry.is("ide.hide.excluded.files") && ProjectRootManager.getInstance(project).getFileIndex().isIgnored(vFile)) {
else if (!Registry.is("ide.hide.excluded.files") && ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile)) {
symbolIcon = AllIcons.Modules.ExcludeRoot;
}
else {
@@ -362,7 +362,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
VirtualFile ignoredFile = myModule1Dir.createChildData(this, "CVS");
DirectoryInfo info = myIndex.getInfoForFile(ignoredFile);
assertTrue(info.isIgnored());
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(ignoredFile));
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(ignoredFile));
}
public void testAddModule() throws Exception {
@@ -386,10 +386,10 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testModuleUnderIgnoredDir() throws IOException {
final VirtualFile ignored = myRootVFile.createChildDirectory(this, "RCS");
assertTrue(FileTypeManager.getInstance().isFileIgnored(ignored));
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(ignored));
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(ignored));
final VirtualFile module4 = ignored.createChildDirectory(this, "module4");
assertFalse(FileTypeManager.getInstance().isFileIgnored(module4));
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(module4));
assertTrue(ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(module4));
new WriteCommandAction.Simple(getProject()) {
@Override
@@ -427,9 +427,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testExcludedDirsInLibraries() {
ProjectFileIndex index = ProjectRootManager.getInstance(myProject).getFileIndex();
assertFalse(index.isInLibraryClasses(myExcludedLibClsDir));
assertTrue(index.isIgnored(myExcludedLibClsDir));
assertTrue(index.isExcluded(myExcludedLibClsDir));
assertFalse(index.isInLibrarySource(myExcludedLibSrcDir));
assertTrue(index.isIgnored(myExcludedLibSrcDir));
assertTrue(index.isExcluded(myExcludedLibSrcDir));
}
public void testExplicitExcludeOfInner() throws Exception {
@@ -662,9 +662,9 @@ public class DirectoryIndexTest extends IdeaTestCase {
public void testExcludeCompilerOutputOutsideOfContentRoot() throws Exception {
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
assertTrue(fileIndex.isIgnored(myOutputDir));
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
assertFalse(fileIndex.isIgnored(myOutputDir.getParent()));
assertTrue(fileIndex.isExcluded(myOutputDir));
assertTrue(fileIndex.isExcluded(myModule1OutputDir));
assertFalse(fileIndex.isExcluded(myOutputDir.getParent()));
assertExcludedFromProject(myOutputDir);
assertExcludedFromProject(myModule1OutputDir);
String moduleOutputUrl = myModule1OutputDir.getUrl();
@@ -677,7 +677,7 @@ public class DirectoryIndexTest extends IdeaTestCase {
assertExcludedFromProject(myOutputDir);
assertExcludedFromProject(myModule1OutputDir);
assertTrue(fileIndex.isIgnored(myModule1OutputDir));
assertTrue(fileIndex.isExcluded(myModule1OutputDir));
PsiTestUtil.setCompilerOutputPath(myModule, moduleOutputUrl, true);
PsiTestUtil.setCompilerOutputPath(myModule2, moduleOutputUrl, false);
@@ -249,7 +249,7 @@ public class AnalysisScope {
@NotNull
@Override
public Result visitFileEx(@NotNull VirtualFile file) {
boolean ignored = fileIndex.isIgnored(file);
boolean ignored = fileIndex.isExcluded(file);
if (!ignored && !file.isDirectory()) {
files.add(file);
}
@@ -42,7 +42,7 @@ public class ProjectFilesScope extends NamedScope {
if (file == null) return false;
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
return holder.getProject().isInitialized()
&& !fileIndex.isIgnored(file)
&& !fileIndex.isExcluded(file)
&& fileIndex.getContentRootForFile(file) != null;
}
});
@@ -142,7 +142,7 @@ public class ProjectViewDirectoryHelper {
VirtualFile directoryFile = subdir.getVirtualFile();
if (Registry.is("ide.hide.excluded.files")) {
if (fileIndex.isIgnored(directoryFile)) continue;
if (fileIndex.isExcluded(directoryFile)) continue;
}
else {
if (FileTypeRegistry.getInstance().isFileIgnored(directoryFile)) continue;
@@ -188,7 +188,7 @@ public class PsiDirectoryNode extends BasePsiNode<PsiDirectory> implements Navig
if (Registry.is("ide.hide.excluded.files")) {
final Project project = value.getProject();
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
return !fileIndex.isIgnored(file);
return !fileIndex.isExcluded(file);
}
else {
return !FileTypeRegistry.getInstance().isFileIgnored(file);
@@ -50,7 +50,7 @@ public class DirectoryIconProvider extends IconProvider implements DumbAware {
}
else {
if (!Registry.is("ide.hide.excluded.files")) {
boolean ignored = ProjectRootManager.getInstance(project).getFileIndex().isIgnored(vFile);
boolean ignored = ProjectRootManager.getInstance(project).getFileIndex().isExcluded(vFile);
if (ignored) {
return AllIcons.Modules.ExcludeRoot;
}
@@ -443,7 +443,7 @@ public class PsiVFSListener extends VirtualFileAdapter {
public void run() {
PsiTreeChangeEventImpl treeEvent = new PsiTreeChangeEventImpl(myManager);
boolean isExcluded = vFile.isDirectory() && myProjectRootManager.getFileIndex().isIgnored(vFile);
boolean isExcluded = vFile.isDirectory() && myProjectRootManager.getFileIndex().isExcluded(vFile);
if (oldParentDir != null && !isExcluded) {
if (newParentDir != null) {
treeEvent.setOldParent(oldParentDir);
@@ -73,7 +73,7 @@ public class IdeaGateway {
if (Comparing.equal(each.getWorkspaceFile(), f)) return false;
ProjectFileIndex index = ProjectRootManager.getInstance(each).getFileIndex();
if (index.isIgnored(f)) return false;
if (index.isExcluded(f)) return false;
isInContent |= index.isInContent(f);
}
if (shouldBeInContent && !isInContent) return false;
@@ -129,11 +129,18 @@ public interface ProjectFileIndex extends FileIndex {
boolean isInLibrarySource(@NotNull VirtualFile fileOrDir);
/**
* Checks if the specified file or directory is ignored (either excluded by exclude roots
* or ignored by {@link com.intellij.openapi.fileTypes.FileTypeManager#isFileIgnored(String)}).
* @deprecated name of this method may be confusing. If you want to check if the file is excluded or ignored use {@link #isExcluded(com.intellij.openapi.vfs.VirtualFile)}.
* If you want to check if the file is ignored use {@link com.intellij.openapi.fileTypes.FileTypeRegistry#isFileIgnored(com.intellij.openapi.vfs.VirtualFile)}.
*/
@Deprecated
boolean isIgnored(@NotNull VirtualFile file);
/**
* Checks if the specified file or directory is located under project roots but the file itself or one of its parent directories is
* either excluded from the project or ignored by {@link com.intellij.openapi.fileTypes.FileTypeRegistry#isFileIgnored(com.intellij.openapi.vfs.VirtualFile)}).
*
* @param file the file to check.
* @return true if <code>file</code> is ignored, false otherwise.
* @return true if <code>file</code> is excluded or ignored, false otherwise.
*/
boolean isIgnored(@NotNull VirtualFile file);
boolean isExcluded(@NotNull VirtualFile file);
}
@@ -66,7 +66,7 @@ public class ProjectFileIndexFacade extends FileIndexFacade {
@Override
public boolean isExcludedFile(@NotNull final VirtualFile file) {
return myFileIndex.isIgnored(file);
return myFileIndex.isExcluded(file);
}
@Nullable
@@ -79,7 +79,7 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
}
@Override
public boolean isIgnored(@NotNull VirtualFile file) {
public boolean isExcluded(@NotNull VirtualFile file) {
DirectoryInfo info = getInfoForFileOrDirectory(file);
return info.isIgnored() || info.isExcluded();
}
@@ -149,6 +149,11 @@ public class ProjectFileIndexImpl extends FileIndexBase implements ProjectFileIn
return getInfoForFileOrDirectory(fileOrDir).isInLibrarySource();
}
@Override
public boolean isIgnored(@NotNull VirtualFile file) {
return isExcluded(file);
}
@Override
public boolean isInContent(@NotNull VirtualFile fileOrDir) {
DirectoryInfo info = getInfoForFileOrDirectory(fileOrDir);
@@ -169,7 +169,7 @@ public class CvsChangeProvider implements ChangeProvider {
for (VirtualFile file : children) {
progress.checkCanceled();
if (file.isDirectory()) {
final boolean isIgnored = myFileIndex.isIgnored(file);
final boolean isIgnored = myFileIndex.isExcluded(file);
if (!isIgnored) {
processEntriesIn(file, scope, builder, true, progress);
}
@@ -151,11 +151,11 @@ public class ImportTree extends NodeRenderer {
return;
}
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
if (!fileIndex.isIgnored(selectedFile)) {
if (!fileIndex.isExcluded(selectedFile)) {
return;
}
final VirtualFile parent = selectedFile.getParent();
if (parent != null && fileIndex.isIgnored(parent)) {
if (parent != null && fileIndex.isExcluded(parent)) {
return;
}
for (final VirtualFile excludedFile : myExcludedFiles) {
@@ -183,11 +183,11 @@ public class ImportTree extends NodeRenderer {
continue;
}
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(myProject).getFileIndex();
if (!fileIndex.isIgnored(selectedFile)) {
if (!fileIndex.isExcluded(selectedFile)) {
continue;
}
final VirtualFile parent = selectedFile.getParent();
if (parent == null || fileIndex.isIgnored(parent) || myExcludedFiles.contains(parent)) {
if (parent == null || fileIndex.isExcluded(parent) || myExcludedFiles.contains(parent)) {
continue;
}
if (!myIncludedFiles.contains(selectedFile)) {
@@ -211,7 +211,7 @@ public class ImportTree extends NodeRenderer {
return true;
}
}
if (myProject == null || !ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(file)) {
if (myProject == null || !ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(file)) {
return false;
}
for (VirtualFile includedFile : myIncludedFiles) {
@@ -242,7 +242,7 @@ public class ImportTree extends NodeRenderer {
if (FileTypeManager.getInstance().isFileIgnored(abstractFileObject.getName())) return true;
if (myProject != null && !includedFiles.contains(file)) {
final VirtualFile vFile = LocalFileSystem.getInstance().findFileByIoFile(file);
if (vFile != null && ProjectRootManager.getInstance(myProject).getFileIndex().isIgnored(vFile)) {
if (vFile != null && ProjectRootManager.getInstance(myProject).getFileIndex().isExcluded(vFile)) {
return true;
}
}
@@ -149,7 +149,7 @@ public class EPathUtil {
return collapse2eclipsePathRelative2Module(file, module);
} else { //should check all modules then
final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
if (fileIndex.isIgnored(file) || fileIndex.isInLibraryClasses(file)) {
if (fileIndex.isExcluded(file) || fileIndex.isInLibraryClasses(file)) {
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
final String path = collapse2eclipsePathRelative2Module(file, aModule);
if (path != null) {
@@ -451,7 +451,7 @@ public class IdeaSpecificSettings extends AbstractIdeaSpecificSettings<Modifiabl
final Module module = ModuleUtilCore.findModuleForFile(file, project);
if (module != null) {
return appendRelatedToModule(element, classesUrl, rootName, file, module);
} else if (ProjectRootManager.getInstance(project).getFileIndex().isIgnored(file)) {
} else if (ProjectRootManager.getInstance(project).getFileIndex().isExcluded(file)) {
for (Module aModule : ModuleManager.getInstance(project).getModules()) {
if (appendRelatedToModule(element, classesUrl, rootName, file, aModule)) return true;
}
@@ -67,7 +67,7 @@ public class GroovyCompilerConfigurable implements SearchableConfigurable, Confi
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true) {
@Override
public boolean isFileVisible(VirtualFile file, boolean showHiddenFiles) {
return super.isFileVisible(file, showHiddenFiles) && !index.isIgnored(file);
return super.isFileVisible(file, showHiddenFiles) && !index.isExcluded(file);
}
};
descriptor.setRoots(ContainerUtil.concat(
@@ -169,7 +169,7 @@ public class MvcModuleStructureUtil {
@Nullable
public static Consumer<ModifiableRootModel> addJarDirectory(VirtualFile root, Module module, final String libName) {
final VirtualFile libDir = root.findFileByRelativePath("lib");
if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isIgnored(libDir)) {
if (libDir == null || !libDir.isDirectory() || ProjectRootManager.getInstance(module.getProject()).getFileIndex().isExcluded(libDir)) {
return null;
}
@@ -181,7 +181,7 @@ public class PyPackageUtil {
VfsUtilCore.visitChildrenRecursively(root, new VirtualFileVisitor() {
@Override
public boolean visitFile(@NotNull VirtualFile file) {
if (!fileIndex.isIgnored(file) && file.isDirectory() && file.findChild(PyNames.INIT_DOT_PY) != null) {
if (!fileIndex.isExcluded(file) && file.isDirectory() && file.findChild(PyNames.INIT_DOT_PY) != null) {
results.add(VfsUtilCore.getRelativePath(file, root, '.'));
}
return true;