use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method getQualifiedName.
@Override
public String getQualifiedName() {
final PsiClassStub stub = getGreenStub();
if (stub != null) {
return stub.getQualifiedName();
}
PsiElement parent = getParent();
if (parent instanceof PsiJavaFile) {
return StringUtil.getQualifiedName(((PsiJavaFile) parent).getPackageName(), getName());
}
if (parent instanceof PsiClass) {
String parentQName = ((PsiClass) parent).getQualifiedName();
if (parentQName == null)
return null;
return StringUtil.getQualifiedName(parentQName, getName());
}
return null;
}
use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method getName.
@Override
public String getName() {
String name = myCachedName;
if (name != null)
return name;
final PsiClassStub stub = getGreenStub();
if (stub == null) {
PsiIdentifier identifier = getNameIdentifier();
name = identifier == null ? null : identifier.getText();
} else {
name = stub.getName();
}
myCachedName = name;
return name;
}
use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method getContextStub.
@Nullable
private StubElement getContextStub() {
PsiClassStub<?> stub = getStub();
if (stub == null)
return null;
// if AST is not loaded, then we only can need context to resolve supertype references
// this can be done by stubs unless there are local/anonymous classes referencing other local classes
StubElement parent = stub.getParentStub();
if (parent instanceof PsiClassInitializerStub || parent instanceof PsiMethodStub) {
if (parent.getChildrenByType(JavaStubElementTypes.CLASS, PsiElement.ARRAY_FACTORY).length <= 1) {
parent = parent.getParentStub();
}
}
return parent instanceof PsiClassStub ? parent : null;
}
use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method isInterface.
@Override
public boolean isInterface() {
final PsiClassStub stub = getGreenStub();
if (stub != null) {
return stub.isInterface();
}
ASTNode keyword = getNode().findChildByRole(ChildRole.CLASS_OR_INTERFACE_KEYWORD);
return keyword != null && keyword.getElementType() == JavaTokenType.INTERFACE_KEYWORD;
}
use of com.intellij.psi.impl.java.stubs.PsiClassStub in project intellij-community by JetBrains.
the class PsiClassImpl method isEnum.
@Override
public boolean isEnum() {
final PsiClassStub stub = getGreenStub();
if (stub != null) {
return stub.isEnum();
}
final ASTNode keyword = getNode().findChildByRole(ChildRole.CLASS_OR_INTERFACE_KEYWORD);
return keyword != null && keyword.getElementType() == JavaTokenType.ENUM_KEYWORD;
}
Aggregations