类com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet源码实例Demo

下面列出了怎么用com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: idea-latex   文件: LatexReferenceContributor.java
/**
 * Returns references for given @{link PsiElement}.
 *
 * @param psiElement        current element
 * @param processingContext context
 * @return {@link PsiReference} list
 */
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext) {
    if (psiElement instanceof LatexInstruction) {
        LatexInstructionExtImpl instruction = (LatexInstructionExtImpl) psiElement;
        String identifier = instruction.getIdentifier().getText();
        if (Arrays.asList(IDENTIFIERS).contains(identifier)) {
            LatexArgument arg = instruction.getArgument();
            if (arg != null && arg.getValue() != null) {
                return new FileReferenceSet(arg.getValue(), instruction, arg.getStartOffsetInParent() + 1, this, true).getAllReferences();
            }
        }
    }
    return PsiReference.EMPTY_ARRAY;
}
 
源代码2 项目: consulo   文件: StaticPathReferenceProvider.java
@Override
public boolean createReferences(@Nonnull final PsiElement psiElement,
                                final int offset,
                                final String text,
                                final @Nonnull List<PsiReference> references,
                                final boolean soft) {

  FileReferenceSet set = new FileReferenceSet(text, psiElement, offset, null, true, myEndingSlashNotAllowed, mySuitableFileTypes) {
    @Override
    protected boolean isUrlEncoded() {
      return true;
    }

    @Override
    protected boolean isSoft() {
      return soft;
    }
  };
  if (!myRelativePathsAllowed) {
    set.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
  }
  Collections.addAll(references, set.getAllReferences());
  return true;
}
 
源代码3 项目: consulo   文件: FileIncludeManagerImpl.java
@Nullable
private PsiFileSystemItem doResolve(@Nonnull final FileIncludeInfo info, @Nonnull final PsiFile context) {
  if (info instanceof FileIncludeInfoImpl) {
    String id = ((FileIncludeInfoImpl)info).providerId;
    FileIncludeProvider provider = id == null ? null : myProviderMap.get(id);
    final PsiFileSystemItem resolvedByProvider = provider == null ? null : provider.resolveIncludedFile(info, context);
    if (resolvedByProvider != null) {
      return resolvedByProvider;
    }
  }

  PsiFileImpl psiFile = (PsiFileImpl)myPsiFileFactory.createFileFromText("dummy.txt", PlainTextFileType.INSTANCE, info.path);
  psiFile.setOriginalFile(context);
  return new FileReferenceSet(psiFile) {
    @Override
    protected boolean useIncludingFileAsContext() {
      return false;
    }
  }.resolve();
}
 
源代码4 项目: intellij-thrift   文件: ThriftPsiUtil.java
@NotNull
private static FileReferenceSet getReferenceSet(@NotNull ThriftInclude include) {
  final PsiElement element = include.getLastChild();
  final String path = getPath(include);
  return new FileReferenceSet(
    path, include, element.getStartOffsetInParent() + 1, null, true, true, new FileType[]{ThriftFileType.INSTANCE}
  );
}
 
@NotNull
public PsiReference[] getReferencesByElement(@NotNull PsiElement element,
                                             String text,
                                             int offset) {
    return new FileReferenceSet(text, element, offset, this, true, myEndingSlashNotAllowed).getAllReferences();
}
 
源代码6 项目: idea-gitignore   文件: IgnoreReferenceSet.java
/**
 * Builds an instance of {@link IgnoreReferenceSet.IgnoreReference}.
 */
public IgnoreReference(@NotNull FileReferenceSet fileReferenceSet, TextRange range, int index, String text) {
    super(fileReferenceSet, range, index, text);
    cacheMap = ContainerUtil.newConcurrentMap();
}
 
 类所在包
 同包方法