Java 类com.intellij.psi.impl.source.resolve.reference.impl.providers.DependentNSReference 实例源码

项目:intellij-ce-playground    文件:BaseExtResourceAction.java   
@Nullable
public static String findUri(PsiFile file, int offset) {
  PsiElement element = file.findElementAt(offset);
  if (element == null ||
      element instanceof PsiWhiteSpace ) {
    return null;
  }

  PsiReference currentRef = file.getViewProvider().findReferenceAt(offset, file.getLanguage());
  if (currentRef == null) currentRef = file.getViewProvider().findReferenceAt(offset);
  if (currentRef instanceof URLReference ||
      currentRef instanceof DependentNSReference) {
    return currentRef.getCanonicalText();
  }
  return null;
}
项目:intellij-ce-playground    文件:MicrodataUtil.java   
public static PsiReference[] getUrlReferencesForAttributeValue(final XmlAttributeValue element) {
  return getReferencesForAttributeValue(element, new PairFunction<String, Integer, PsiReference>() {
    @Nullable
    @Override
    public PsiReference fun(String token, Integer offset) {
      if (HtmlUtil.hasHtmlPrefix(token)) {
        final TextRange range = TextRange.from(offset, token.length());
        final URLReference urlReference = new URLReference(element, range, true);
        return new DependentNSReference(element, range, urlReference, true);
      }
      return null;
    }
  });
}
项目:tools-idea    文件:BaseExtResourceAction.java   
@Nullable
public static String findUri(PsiFile file, int offset) {
  PsiReference currentRef = file.getViewProvider().findReferenceAt(offset, file.getLanguage());
  if (currentRef == null) currentRef = file.getViewProvider().findReferenceAt(offset);
  if (currentRef instanceof URLReference ||
      currentRef instanceof DependentNSReference) {
    return currentRef.getCanonicalText();
  }
  return null;
}
项目:tools-idea    文件:MicrodataUtil.java   
public static PsiReference[] getUrlReferencesForAttributeValue(final XmlAttributeValue element) {
  return getReferencesForAttributeValue(element, new PairFunction<String, Integer, PsiReference>() {
    @Nullable
    @Override
    public PsiReference fun(String token, Integer offset) {
      if (HtmlUtil.hasHtmlPrefix(token)) {
        final TextRange range = TextRange.from(offset, token.length());
        final URLReference urlReference = new URLReference(element, range, true);
        return new DependentNSReference(element, range, urlReference, true);
      }
      return null;
    }
  });
}
项目:consulo-xml    文件:BaseExtResourceAction.java   
@Nullable
public static String findUri(PsiFile file, int offset) {
  PsiReference currentRef = file.getViewProvider().findReferenceAt(offset, file.getLanguage());
  if (currentRef == null) currentRef = file.getViewProvider().findReferenceAt(offset);
  if (currentRef instanceof URLReference ||
      currentRef instanceof DependentNSReference) {
    return currentRef.getCanonicalText();
  }
  return null;
}
项目:consulo-xml    文件:MicrodataUtil.java   
public static PsiReference[] getUrlReferencesForAttributeValue(final XmlAttributeValue element)
{
    return getReferencesForAttributeValue(element, (token, offset) ->
    {
        if(HtmlUtil.hasHtmlPrefix(token))
        {
            final TextRange range = TextRange.from(offset, token.length());
            final URLReference urlReference = new URLReference(element, range, true);
            return new DependentNSReference(element, range, urlReference, true);
        }
        return null;
    });
}