introduce JavaStubIndexKeys class

This commit is contained in:
Dmitry Jemerov
2011-09-22 19:31:29 +02:00
parent 711a34a4eb
commit 43db563479
3 changed files with 32 additions and 4 deletions
@@ -22,7 +22,7 @@ import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.impl.compiled.ClsAnnotationImpl;
import com.intellij.psi.impl.java.stubs.impl.PsiAnnotationStubImpl;
import com.intellij.psi.impl.java.stubs.index.JavaAnnotationIndex;
import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
import com.intellij.psi.impl.source.tree.LightTreeUtil;
import com.intellij.psi.impl.source.tree.java.AnnotationElement;
import com.intellij.psi.impl.source.tree.java.PsiAnnotationImpl;
@@ -77,7 +77,7 @@ public class JavaAnnotationElementType extends JavaStubElementType<PsiAnnotation
public void indexStub(final PsiAnnotationStub stub, final IndexSink sink) {
final String refText = getReferenceShortName(stub.getText());
sink.occurrence(JavaAnnotationIndex.KEY, refText);
sink.occurrence(JavaStubIndexKeys.ANNOTATIONS, refText);
}
private static String getReferenceShortName(String annotationText) {
@@ -29,7 +29,6 @@ import com.intellij.psi.stubs.StubIndexKey;
import java.util.Collection;
public class JavaAnnotationIndex extends StringStubIndexExtension<PsiAnnotation> {
public static final StubIndexKey<String,PsiAnnotation> KEY = StubIndexKey.createIndexKey("java.annotations");
private static final JavaAnnotationIndex ourInstance = new JavaAnnotationIndex();
public static JavaAnnotationIndex getInstance() {
@@ -37,7 +36,7 @@ public class JavaAnnotationIndex extends StringStubIndexExtension<PsiAnnotation>
}
public StubIndexKey<String, PsiAnnotation> getKey() {
return KEY;
return JavaStubIndexKeys.ANNOTATIONS;
}
public Collection<PsiAnnotation> get(final String s, final Project project, final GlobalSearchScope scope) {
@@ -0,0 +1,29 @@
/*
* Copyright 2000-2011 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.impl.java.stubs.index;
import com.intellij.psi.PsiAnnotation;
import com.intellij.psi.stubs.StubIndexKey;
/**
* @author yole
*/
public class JavaStubIndexKeys {
public static final StubIndexKey<String,PsiAnnotation> ANNOTATIONS = StubIndexKey.createIndexKey("java.annotations");
private JavaStubIndexKeys() {
}
}