move some more undesired PsiFileImpl dependencies into StubTreeLoader service
authorDmitry Jemerov <yole@jetbrains.com>
Fri, 2 Sep 2011 14:04:48 +0000 (16:04 +0200)
committerDmitry Jemerov <yole@jetbrains.com>
Mon, 5 Sep 2011 10:09:14 +0000 (12:09 +0200)
platform/lang-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java
platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoader.java
platform/lang-impl/src/com/intellij/psi/stubs/StubTreeLoaderImpl.java

index 80cfd6a0f7689fd66d1f102944bcd520babab148..b93c93e75508d3357ecb36553fc6089543869098 100644 (file)
@@ -611,7 +611,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
                                "; IndexStamp="+ StubTreeLoader.getInstance().getStubTreeTimestamp(vFile)  +
                                "; Type: " + contentElementType + "; " +
                                "Psi roots: " + viewProvider.getAllFiles() + "; " +
-                               " StubUpdatingIndex.canHaveStub(vFile)=" + StubUpdatingIndex.canHaveStub(vFile) + 
+                               " StubUpdatingIndex.canHaveStub(vFile)=" + StubTreeLoader.getInstance().canHaveStub(vFile) +
                                " content:<<<\n"+
                                StringUtil.first(viewProvider.getContents(),200,true)+
                                "\n>>>; stubs=" + stubHolder.getPlainList());
@@ -885,7 +885,7 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF
           builder.append("\n\t").append("getTreeElementNoLock() = ").append(getTreeElementNoLock());
           final VirtualFile vFile = getVirtualFile();
           builder.append("\n\t").append("vFile instanceof VirtualFileWithId = ").append(vFile instanceof VirtualFileWithId);
-          builder.append("\n\t").append("StubUpdatingIndex.canHaveStub(vFile) = ").append(StubUpdatingIndex.canHaveStub(vFile));
+          builder.append("\n\t").append("StubUpdatingIndex.canHaveStub(vFile) = ").append(StubTreeLoader.getInstance().canHaveStub(vFile));
           LOG.error(builder.toString());
         }
         final StubElement currentStubTree = ((IStubFileElementType)contentElementType).getBuilder().buildStubTree(this);
index 2b0c7fc7cd130f2ff26d4b3f503e8512b303a3a8..c8accbc2aa579dbe48d76c6f1992469a656d4965 100644 (file)
@@ -34,4 +34,6 @@ public abstract class StubTreeLoader {
   public abstract void rebuildStubTree(VirtualFile virtualFile);
 
   public abstract long getStubTreeTimestamp(VirtualFile vFile);
+
+  public abstract boolean canHaveStub(VirtualFile file);
 }
index 9d8f4071553887c58ad4d20592444ee540dc813d..5491db0d37249c1fc2cb633146fe759cf104118d 100644 (file)
@@ -46,7 +46,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
       return fromIndices;
     }
 
-    if (!StubUpdatingIndex.canHaveStub(vFile)) {
+    if (!canHaveStub(vFile)) {
       return null;
     }
 
@@ -109,4 +109,9 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
   public long getStubTreeTimestamp(VirtualFile vFile) {
     return IndexingStamp.getIndexStamp(vFile, StubUpdatingIndex.INDEX_ID);
   }
+
+  @Override
+  public boolean canHaveStub(VirtualFile file) {
+    return StubUpdatingIndex.canHaveStub(file);
+  }
 }