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

项目:intellij-ce-playground    文件:AndroidPackageConverter.java   
@NotNull
@Override
protected PsiPackageReference createReference(TextRange range, int index) {
  // If the Gradle model specifies an application id, which does not rely on
  // the package in any way, then the package attribute in the manifest should
  // be taken to be a normal package reference, and should participate in normal
  // package rename refactoring
  AndroidFacet facet = AndroidFacet.getInstance(getElement());
  if (facet != null) {
    IdeaAndroidProject project = facet.getIdeaAndroidProject();
    if (project != null && project.overridesManifestPackage()) {
      return new PsiPackageReference(this, range, index);
    }
  }

  return new MyPsiPackageReference(this, range, index);
}
项目:consulo-java    文件:ImportPackageParser.java   
public PsiReference[] getReferences(@NotNull HeaderValuePart headerValuePart) {
  if (headerValuePart.getParent() instanceof Clause) {
    PackageReferenceSet referenceSet = new PackageReferenceSet(headerValuePart.getUnwrappedText(), headerValuePart, 0);
    return referenceSet.getReferences().toArray(new PsiPackageReference[referenceSet.getReferences().size()]);
  }
  return PsiReference.EMPTY_ARRAY;
}