Search in sources :

Example 1 with PackageNameNode

use of org.ballerinalang.plugins.idea.psi.PackageNameNode in project ballerina by ballerina-lang.

the class StructReference method resolve.

@Nullable
@Override
public PsiElement resolve() {
    IdentifierPSINode identifier = getElement();
    PsiElement parent = identifier.getParent();
    PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
    if (packageNameNode == null) {
        return resolveInCurrentPackage();
    } else {
        return resolveInPackage(packageNameNode);
    }
}
Also used : PackageNameNode(org.ballerinalang.plugins.idea.psi.PackageNameNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with PackageNameNode

use of org.ballerinalang.plugins.idea.psi.PackageNameNode in project ballerina by ballerina-lang.

the class StructReference method getVariants.

@NotNull
@Override
public Object[] getVariants() {
    List<LookupElement> results = new LinkedList<>();
    IdentifierPSINode identifier = getElement();
    PsiElement parent = identifier.getParent();
    PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
    if (packageNameNode == null) {
        results.addAll(getVariantsFromCurrentPackage());
    } else {
        results.addAll(getVariantsFromPackage(packageNameNode));
    }
    return results.toArray(new LookupElement[results.size()]);
}
Also used : PackageNameNode(org.ballerinalang.plugins.idea.psi.PackageNameNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) LookupElement(com.intellij.codeInsight.lookup.LookupElement) LinkedList(java.util.LinkedList) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Example 3 with PackageNameNode

use of org.ballerinalang.plugins.idea.psi.PackageNameNode in project ballerina by ballerina-lang.

the class AnnotationReference method resolve.

@Nullable
@Override
public PsiElement resolve() {
    IdentifierPSINode identifier = getElement();
    PsiElement parent = identifier.getParent();
    PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
    if (packageNameNode == null) {
        return resolveInCurrentPackage();
    } else {
        return resolveInPackage(packageNameNode);
    }
}
Also used : PackageNameNode(org.ballerinalang.plugins.idea.psi.PackageNameNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with PackageNameNode

use of org.ballerinalang.plugins.idea.psi.PackageNameNode in project ballerina by ballerina-lang.

the class ConnectorReference method resolve.

@Nullable
@Override
public PsiElement resolve() {
    IdentifierPSINode identifier = getElement();
    PsiElement parent = identifier.getParent();
    PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
    if (packageNameNode == null) {
        return resolveInCurrentPackage(identifier);
    } else {
        return resolveInPackage(packageNameNode, identifier);
    }
}
Also used : PackageNameNode(org.ballerinalang.plugins.idea.psi.PackageNameNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Example 5 with PackageNameNode

use of org.ballerinalang.plugins.idea.psi.PackageNameNode in project ballerina by ballerina-lang.

the class ConnectorReference method getVariants.

@NotNull
@Override
public Object[] getVariants() {
    List<LookupElement> results = new LinkedList<>();
    IdentifierPSINode identifier = getElement();
    PsiElement parent = identifier.getParent();
    PackageNameNode packageNameNode = PsiTreeUtil.getChildOfType(parent, PackageNameNode.class);
    if (packageNameNode == null) {
        results.addAll(getVariantsInCurrentPackage());
    } else {
        results.addAll(getVariantsInPackage(packageNameNode));
    }
    return results.toArray(new LookupElement[results.size()]);
}
Also used : PackageNameNode(org.ballerinalang.plugins.idea.psi.PackageNameNode) IdentifierPSINode(org.ballerinalang.plugins.idea.psi.IdentifierPSINode) LookupElement(com.intellij.codeInsight.lookup.LookupElement) LinkedList(java.util.LinkedList) PsiElement(com.intellij.psi.PsiElement) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

PackageNameNode (org.ballerinalang.plugins.idea.psi.PackageNameNode)35 PsiElement (com.intellij.psi.PsiElement)30 IdentifierPSINode (org.ballerinalang.plugins.idea.psi.IdentifierPSINode)20 LinkedList (java.util.LinkedList)17 NotNull (org.jetbrains.annotations.NotNull)14 LookupElement (com.intellij.codeInsight.lookup.LookupElement)11 Nullable (org.jetbrains.annotations.Nullable)11 PsiReference (com.intellij.psi.PsiReference)9 FullyQualifiedPackageNameNode (org.ballerinalang.plugins.idea.psi.FullyQualifiedPackageNameNode)9 PsiDirectory (com.intellij.psi.PsiDirectory)8 ArrayList (java.util.ArrayList)7 ImportDeclarationNode (org.ballerinalang.plugins.idea.psi.ImportDeclarationNode)7 AliasNode (org.ballerinalang.plugins.idea.psi.AliasNode)5 PackageDeclarationNode (org.ballerinalang.plugins.idea.psi.PackageDeclarationNode)5 ProblemDescriptor (com.intellij.codeInspection.ProblemDescriptor)4 Module (com.intellij.openapi.module.Module)4 PsiFile (com.intellij.psi.PsiFile)4 LeafPsiElement (com.intellij.psi.impl.source.tree.LeafPsiElement)4 BallerinaFile (org.ballerinalang.plugins.idea.psi.BallerinaFile)4 XmlAttribNode (org.ballerinalang.plugins.idea.psi.XmlAttribNode)4