use of com.intellij.psi.stubs.IStubElementType in project intellij-community by JetBrains.
the class PsiClassImpl method getScope.
@Override
public PsiElement getScope() {
final PsiClassStub stub = getStub();
if (stub != null) {
return stub.getParentStub().getPsi();
}
ASTNode treeElement = getNode();
ASTNode parent = treeElement.getTreeParent();
while (parent != null) {
if (parent.getElementType() instanceof IStubElementType) {
return parent.getPsi();
}
parent = parent.getTreeParent();
}
return getContainingFile();
}
use of com.intellij.psi.stubs.IStubElementType in project intellij-community by JetBrains.
the class PsiAnchor method createStubReference.
@Nullable
public static StubIndexReference createStubReference(@NotNull PsiElement element, @NotNull PsiFile containingFile) {
if (element instanceof StubBasedPsiElement && element.isPhysical() && (element instanceof PsiCompiledElement || canHaveStub(containingFile))) {
final StubBasedPsiElement elt = (StubBasedPsiElement) element;
final IStubElementType elementType = elt.getElementType();
if (elt.getStub() != null || elementType.shouldCreateStub(element.getNode())) {
int index = calcStubIndex((StubBasedPsiElement) element);
if (index != -1) {
return new StubIndexReference(containingFile, index, containingFile.getLanguage(), elementType);
}
}
}
return null;
}
Aggregations