From 9ef47ff989ae105fe0edacd5677d3ef6e7942a1c Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 25 Nov 2013 20:47:11 +0100 Subject: [PATCH] RootIndex: no package name for ignored directories --- .../intellij/openapi/roots/impl/DirectoryIndexTest.java | 8 ++++++-- .../src/com/intellij/openapi/roots/impl/RootIndex.java | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java index 3641d9dc06f4..a721f29a8a88 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/roots/impl/DirectoryIndexTest.java @@ -186,7 +186,7 @@ public class DirectoryIndexTest extends IdeaTestCase { return instance; } - public void testDirInfos() { + public void testDirInfos() throws IOException { checkInfoNull(myRootVFile); // beware: files in directory index @@ -215,9 +215,13 @@ public class DirectoryIndexTest extends IdeaTestCase { assertEquals(myModule1Dir, checkInfoNotNull(myLibClsDir).getContentRoot()); checkInfo(myModule3Dir, myModule3, false, false, null, null); + + VirtualFile cvs = myPack1Dir.createChildDirectory(this, "CVS"); + checkInfoNull(cvs); + assertNull(ProjectRootManager.getInstance(myProject).getFileIndex().getPackageNameByDirectory(cvs)); } - public void testDirsByPackageName() { + public void testDirsByPackageName() throws IOException { checkPackage("", true, myFileLibSrc, myFileLibCls, mySrcDir1, myTestSrc1, myResDir, myTestResDir, myLibSrcDir, myLibClsDir, mySrcDir2); checkPackage("", false, myFileLibCls, mySrcDir1, myTestSrc1, myResDir, myTestResDir, myLibClsDir, mySrcDir2); diff --git a/platform/lang-impl/src/com/intellij/openapi/roots/impl/RootIndex.java b/platform/lang-impl/src/com/intellij/openapi/roots/impl/RootIndex.java index cc01c67973d4..df8b295ec9de 100644 --- a/platform/lang-impl/src/com/intellij/openapi/roots/impl/RootIndex.java +++ b/platform/lang-impl/src/com/intellij/openapi/roots/impl/RootIndex.java @@ -420,6 +420,10 @@ class RootIndex { @Nullable public String getPackageName(@NotNull final VirtualFile dir) { if (dir.isDirectory()) { + if (FileTypeManager.getInstance().isFileIgnored(dir)) { + return null; + } + for (final Map.Entry> entry : myPackagePrefixRoots.entrySet()) { if (entry.getValue().contains(dir)) { return entry.getKey();