RootIndex: no package name for ignored directories

This commit is contained in:
peter
2013-11-26 15:55:12 +01:00
parent 032b1f20c4
commit 9ef47ff989
2 changed files with 10 additions and 2 deletions
@@ -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);
@@ -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<String, HashSet<VirtualFile>> entry : myPackagePrefixRoots.entrySet()) {
if (entry.getValue().contains(dir)) {
return entry.getKey();