use of com.perl5.lang.perl.psi.references.PerlNamespaceReference in project Perl5-IDEA by Camelcade.
the class PerlNamespaceElementImpl method getNamespaceDefinitions.
@Override
public List<PerlNamespaceDefinitionElement> getNamespaceDefinitions() {
List<PerlNamespaceDefinitionElement> namespaceDefinitions = new ArrayList<>();
PsiReference[] references = getReferences();
for (PsiReference reference : references) {
if (reference instanceof PerlNamespaceReference) {
ResolveResult[] results = ((PerlNamespaceReference) reference).multiResolve(false);
for (ResolveResult result : results) {
PsiElement targetElement = result.getElement();
assert targetElement != null;
assert targetElement instanceof PerlNamespaceDefinitionElement;
namespaceDefinitions.add((PerlNamespaceDefinitionElement) targetElement);
}
}
}
return namespaceDefinitions;
}
use of com.perl5.lang.perl.psi.references.PerlNamespaceReference in project Perl5-IDEA by Camelcade.
the class PerlStringContentElementImpl method computeReferences.
@Override
public PsiReference[] computeReferences() {
List<PsiReference> result = new ArrayList<>();
if (looksLikePackage()) {
result.add(new PerlNamespaceReference(PerlStringContentElementImpl.this));
} else {
@SuppressWarnings("unchecked") PerlReferencesProvider referencesProvider = PsiTreeUtil.getParentOfType(PerlStringContentElementImpl.this, PerlReferencesProvider.class, true, PsiPerlStatement.class);
if (referencesProvider != null) {
PsiReference[] references = referencesProvider.getReferences(PerlStringContentElementImpl.this);
if (references != null) {
result.addAll(Arrays.asList(references));
}
}
}
result.addAll(Arrays.asList(ReferenceProvidersRegistry.getReferencesFromProviders(PerlStringContentElementImpl.this)));
return result.toArray(new PsiReference[result.size()]);
}
Aggregations