use of org.jetbrains.plugins.groovy.lang.psi.stubs.GrImportStatementStub in project intellij-community by JetBrains.
the class GrImportStatementImpl method getImportedName.
@Override
@Nullable
public String getImportedName() {
if (isOnDemand())
return null;
GrImportStatementStub stub = getStub();
if (stub != null) {
String name = stub.getAliasName();
if (name != null) {
return name;
}
String referenceText = stub.getReferenceText();
if (referenceText == null)
return null;
return StringUtil.getShortName(referenceText);
}
PsiElement aliasNameElement = getAliasNameElement();
if (aliasNameElement != null) {
return aliasNameElement.getText();
}
GrCodeReferenceElement ref = getImportReference();
return ref == null ? null : ref.getReferenceName();
}
use of org.jetbrains.plugins.groovy.lang.psi.stubs.GrImportStatementStub in project intellij-community by JetBrains.
the class GrImportStatementImpl method getAliasNameElement.
@Nullable
@Override
public PsiElement getAliasNameElement() {
GrImportStatementStub stub = getStub();
if (stub != null) {
String alias = stub.getAliasName();
if (alias == null)
return null;
GrImportStatement imp = GroovyPsiElementFactory.getInstance(getProject()).createImportStatementFromText("import A as " + alias);
return imp.getAliasNameElement();
}
return findChildByType(GroovyTokenTypes.mIDENT);
}
Aggregations