summaryrefslogtreecommitdiff
path: root/platform/indexing-api/src/com/intellij/psi
diff options
context:
space:
mode:
Diffstat (limited to 'platform/indexing-api/src/com/intellij/psi')
-rw-r--r--platform/indexing-api/src/com/intellij/psi/RefResolveService.java50
-rw-r--r--platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java6
-rw-r--r--platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java4
3 files changed, 55 insertions, 5 deletions
diff --git a/platform/indexing-api/src/com/intellij/psi/RefResolveService.java b/platform/indexing-api/src/com/intellij/psi/RefResolveService.java
new file mode 100644
index 000000000000..f53316506e78
--- /dev/null
+++ b/platform/indexing-api/src/com/intellij/psi/RefResolveService.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.psi;
+
+import com.intellij.openapi.components.AbstractProjectComponent;
+import com.intellij.openapi.project.Project;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileWithId;
+import com.intellij.psi.search.GlobalSearchScope;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.Collection;
+
+public abstract class RefResolveService extends AbstractProjectComponent {
+ public RefResolveService(Project project) {
+ super(project);
+ }
+
+ public static RefResolveService getInstance(Project project) {
+ return project.getComponent(RefResolveService.class);
+ }
+
+ @Nullable("null means the service has not resolved all files and is not ready yet")
+ public abstract int[] getBackwardIds(@NotNull VirtualFileWithId file);
+
+ /**
+ * @return subset of scope containing only files which reference the virtualFile
+ */
+ @NotNull
+ public abstract GlobalSearchScope restrictByBackwardIds(@NotNull VirtualFile virtualFile, @NotNull GlobalSearchScope scope);
+
+ /**
+ * @return add files to the resolve queue. until all files from there are resolved, the service is in incomplete state and returns null from getBackwardIds()
+ */
+ public abstract boolean queue(@NotNull Collection<VirtualFile> files, Object reason);
+}
diff --git a/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java b/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
index cc283d0bb2b7..bef3d0350563 100644
--- a/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
+++ b/platform/indexing-api/src/com/intellij/psi/search/PsiSearchHelper.java
@@ -86,7 +86,7 @@ public interface PsiSearchHelper {
@NotNull GlobalSearchScope searchScope);
/**
- * Passes all occurrences of the specified full-qualified class name in plain text context in the
+ * Passes all occurrences of the specified fully qualified class name in plain text context in the
* use scope of the specified element to the specified processor.
*
* @param originalElement the element whose use scope is used to restrict the search scope,
@@ -126,7 +126,7 @@ public interface PsiSearchHelper {
final boolean caseSensitively);
/**
- * Passes all files containing the specified word in {@link UsageSearchContext#IN_PLAIN_TEXT code}
+ * Passes all files containing the specified word in {@link UsageSearchContext#IN_PLAIN_TEXT plain text}
* context to the specified processor.
*
* @param word the word to search.
@@ -189,7 +189,7 @@ public interface PsiSearchHelper {
@NotNull
SearchCostResult isCheapEnoughToSearch(@NotNull String name,
@NotNull GlobalSearchScope scope,
- @Nullable PsiFile fileToIgnoreOccurencesIn,
+ @Nullable PsiFile fileToIgnoreOccurrencesIn,
@Nullable ProgressIndicator progress);
enum SearchCostResult {
diff --git a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
index 11074f83781f..d9bbf9ee58a9 100644
--- a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
+++ b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -162,5 +162,5 @@ public abstract class StubIndex {
protected <Psi extends PsiElement> void reportStubPsiMismatch(Psi psi, VirtualFile file, Class<Psi> requiredClass) {
LOG.error("Invalid stub element type in index: " + file + ". found: " + psi + ". expected: " + requiredClass);
}
-
+ public abstract void forceRebuild(@NotNull Throwable e);
}