move fileScope and filesScope back from GlobalSearchScopes to GlobalSearchScope
[idea/community.git] / platform / lang-impl / src / com / intellij / psi / stubs / StubTreeLoaderImpl.java
index 634bc4411c4c68efb9c7b1591f79acfae69a0898..f68557a0a9b618e36a560321f1b3ee5f21cf826e 100644 (file)
@@ -23,10 +23,11 @@ import com.intellij.openapi.fileEditor.FileDocumentManager;
 import com.intellij.openapi.project.DumbService;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.psi.search.GlobalSearchScopes;
+import com.intellij.psi.search.GlobalSearchScope;
 import com.intellij.util.indexing.FileBasedIndex;
 import com.intellij.util.indexing.FileContent;
 import com.intellij.util.indexing.FileContentImpl;
+import com.intellij.util.indexing.IndexingStamp;
 import org.jetbrains.annotations.Nullable;
 
 import java.io.IOException;
@@ -45,7 +46,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
       return fromIndices;
     }
 
-    if (!StubUpdatingIndex.canHaveStub(vFile)) {
+    if (!canHaveStub(vFile)) {
       return null;
     }
 
@@ -72,7 +73,7 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
 
     final int id = Math.abs(FileBasedIndex.getFileId(vFile));
     if (id > 0) {
-      final List<SerializedStubTree> datas = FileBasedIndex.getInstance().getValues(StubUpdatingIndex.INDEX_ID, id, GlobalSearchScopes
+      final List<SerializedStubTree> datas = FileBasedIndex.getInstance().getValues(StubUpdatingIndex.INDEX_ID, id, GlobalSearchScope
           .fileScope(project, vFile));
       final int size = datas.size();
 
@@ -98,4 +99,19 @@ public class StubTreeLoaderImpl extends StubTreeLoader {
 
     return null;
   }
+
+  @Override
+  public void rebuildStubTree(VirtualFile virtualFile) {
+    FileBasedIndex.getInstance().requestReindex(virtualFile);
+  }
+
+  @Override
+  public long getStubTreeTimestamp(VirtualFile vFile) {
+    return IndexingStamp.getIndexStamp(vFile, StubUpdatingIndex.INDEX_ID);
+  }
+
+  @Override
+  public boolean canHaveStub(VirtualFile file) {
+    return StubUpdatingIndex.canHaveStub(file);
+  }
 }