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

项目:intellij-ce-playground    文件:FileReferenceContextUtil.java   
private static PsiElement bindElement(final PsiElement element, PsiFileSystemItem item) {
  if (item != null && item.isValid() && item.getVirtualFile() != null) {
    PsiReference[] refs = element.getReferences();
    for (PsiReference ref : refs) {
      if (ref instanceof FileReferenceOwner) {
        final PsiFileReference fileReference = ((FileReferenceOwner)refs[0]).getLastFileReference();
        if (fileReference != null) {
          try {
            PsiElement newElement = fileReference.bindToElement(item);
            if (newElement != null) {
              // assertion for troubles like IDEA-59540
              LOG.assertTrue(element.getClass() == newElement.getClass(), "Reference " + ref + " violated contract of bindToElement()");
            }
            return newElement;
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
          }
        }
        break;
      }
    }
  }
  return element;
}
项目:tools-idea    文件:ConvertAbsolutePathToRelativeIntentionAction.java   
@Nullable
private static FileReference findFileReference(@NotNull final PsiReference original) {
  if (original instanceof PsiMultiReference) {
    final PsiMultiReference multiReference = (PsiMultiReference)original;
    for (PsiReference reference : multiReference.getReferences()) {
      if (reference instanceof FileReference) {
        return (FileReference)reference;
      }
    }
  }
  else if (original instanceof FileReferenceOwner) {
    final PsiFileReference fileReference = ((FileReferenceOwner)original).getLastFileReference();
    if (fileReference instanceof FileReference) {
      return (FileReference)fileReference;
    }
  }

  return null;
}
项目:tools-idea    文件:FileReferenceContextUtil.java   
private static PsiElement bindElement(final PsiElement element, PsiFileSystemItem item) {
  if (item != null && item.isValid() && item.getVirtualFile() != null) {
    PsiReference[] refs = element.getReferences();
    for (PsiReference ref : refs) {
      if (ref instanceof FileReferenceOwner) {
        final PsiFileReference fileReference = ((FileReferenceOwner)refs[0]).getLastFileReference();
        if (fileReference != null) {
          try {
            PsiElement newElement = fileReference.bindToElement(item);
            if (newElement != null) {
              // assertion for troubles like IDEA-59540
              LOG.assertTrue(element.getClass() == newElement.getClass(), "Reference " + ref + " violated contract of bindToElement()");
            }
            return newElement;
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
          }
        }
        break;
      }
    }
  }
  return element;
}
项目:consulo    文件:FileReferenceContextUtil.java   
private static PsiElement bindElement(final PsiElement element, PsiFileSystemItem item) {
  if (item != null && item.isValid() && item.getVirtualFile() != null) {
    PsiReference[] refs = element.getReferences();
    for (PsiReference ref : refs) {
      if (ref instanceof FileReferenceOwner) {
        final PsiFileReference fileReference = ((FileReferenceOwner)refs[0]).getLastFileReference();
        if (fileReference != null) {
          try {
            PsiElement newElement = fileReference.bindToElement(item);
            if (newElement != null) {
              // assertion for troubles like IDEA-59540
              LOG.assertTrue(element.getClass() == newElement.getClass(), "Reference " + ref + " violated contract of bindToElement()");
            }
            return newElement;
          }
          catch (IncorrectOperationException e) {
            LOG.error(e);
          }
        }
        break;
      }
    }
  }
  return element;
}
项目:intellij-ce-playground    文件:PsiDynaReference.java   
@Override
public PsiFileReference getLastFileReference() {
  for (PsiReference reference : myReferences) {
    if (reference instanceof FileReferenceOwner) {
      return ((FileReferenceOwner)reference).getLastFileReference();
    }
  }
  return null;
}
项目:tools-idea    文件:PsiDynaReference.java   
@Override
public PsiFileReference getLastFileReference() {
  for (PsiReference reference : myReferences) {
    if (reference instanceof FileReferenceOwner) {
      return ((FileReferenceOwner)reference).getLastFileReference();
    }
  }
  return null;
}
项目:consulo    文件:PsiDynaReference.java   
@Override
public PsiFileReference getLastFileReference() {
  for (PsiReference reference : myReferences) {
    if (reference instanceof FileReferenceOwner) {
      return ((FileReferenceOwner)reference).getLastFileReference();
    }
  }
  return null;
}
项目:intellij-ce-playground    文件:XmlHighlightVisitor.java   
public static boolean isUrlReference(PsiReference reference) {
  return reference instanceof FileReferenceOwner || reference instanceof AnchorReference;
}
项目:tools-idea    文件:XmlHighlightVisitor.java   
public static boolean isUrlReference(PsiReference reference) {
  return reference instanceof FileReferenceOwner || reference instanceof AnchorReference;
}
项目:consulo-xml    文件:XmlHighlightVisitor.java   
public static boolean isUrlReference(PsiReference reference)
{
    return reference instanceof FileReferenceOwner || reference instanceof AnchorReference;
}