예제 #1
0
  private static List<PsiElement> resolve(final PsiReference ref) {
    // IDEA-56727 try resolve first as in GotoDeclarationAction
    PsiElement resolvedElement = ref.resolve();

    if (resolvedElement == null && ref instanceof PsiPolyVariantReference) {
      List<PsiElement> result = new ArrayList<PsiElement>();
      final ResolveResult[] psiElements = ((PsiPolyVariantReference) ref).multiResolve(false);
      for (ResolveResult resolveResult : psiElements) {
        if (resolveResult.getElement() != null) {
          result.add(resolveResult.getElement());
        }
      }
      return result;
    }
    return resolvedElement == null
        ? Collections.<PsiElement>emptyList()
        : Collections.singletonList(resolvedElement);
  }
예제 #2
0
 public InfoSingle(final PsiReference ref, @NotNull final PsiElement targetElement) {
   super(ref.getElement(), ReferenceRange.getAbsoluteRanges(ref));
   myTargetElement = targetElement;
 }