当前位置: 首页>>代码示例>>Java>>正文


Java FileReferenceSet.getAllReferences方法代码示例

本文整理汇总了Java中com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet.getAllReferences方法的典型用法代码示例。如果您正苦于以下问题:Java FileReferenceSet.getAllReferences方法的具体用法?Java FileReferenceSet.getAllReferences怎么用?Java FileReferenceSet.getAllReferences使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet的用法示例。


在下文中一共展示了FileReferenceSet.getAllReferences方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: collectRefs

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
private static PsiReference[] collectRefs(@NotNull PsiElement element, String value, final int startInElement, final FileType... acceptedFileTypes) {
  final FileReferenceSet set = new FileReferenceSet(value, element, startInElement, null, true){
    @Override
    protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
      return new Condition<PsiFileSystemItem>() {
        @Override
        public boolean value(PsiFileSystemItem item) {
          if (item instanceof PsiDirectory) return true;
          final VirtualFile virtualFile = item.getVirtualFile();
          if (virtualFile == null) return false;
          final FileType fileType = virtualFile.getFileType();
          return ArrayUtilRt.find(acceptedFileTypes, fileType) >= 0;
        }
      };
    }
  };
  if (value.startsWith("/")) {
    set.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
  }
  return set.getAllReferences();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:JavaFxLocationReferenceProvider.java

示例2: collectRefs

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
private static PsiReference[] collectRefs(PsiElement element, String value, final int startInElement, final FileType... acceptedFileTypes) {
  final FileReferenceSet set = new FileReferenceSet(value, element, startInElement, null, true){
    @Override
    protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
      return new Condition<PsiFileSystemItem>() {
        @Override
        public boolean value(PsiFileSystemItem item) {
          if (item instanceof PsiDirectory) return true;
          final VirtualFile virtualFile = item.getVirtualFile();
          if (virtualFile == null) return false;
          final FileType fileType = virtualFile.getFileType();
          return ArrayUtilRt.find(acceptedFileTypes, fileType) >= 0;
        }
      };
    }
  };
  if (value.startsWith("/")) {
    set.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
  }
  return set.getAllReferences();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:JavaFxLocationReferenceProvider.java

示例3: getReferencesByElement

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement psiElement, @NotNull ProcessingContext processingContext)
{
	XmlAttributeValue xmlAttributeValue = (XmlAttributeValue) psiElement;
	ASTNode value = xmlAttributeValue.getNode().findChildByType(XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN);
	if(value == null)
	{
		return PsiReference.EMPTY_ARRAY;
	}
	FileReferenceSet fileReferenceSet = new FileReferenceSet(value.getPsi())
	{
		@Override
		protected Condition<PsiFileSystemItem> getReferenceCompletionFilter()
		{
			return item -> item instanceof XStyleSheetFile || item instanceof PsiDirectory;
		}
	};
	fileReferenceSet.setEmptyPathAllowed(false);

	return fileReferenceSet.getAllReferences();
}
 
开发者ID:consulo,项目名称:consulo-css,代码行数:23,代码来源:HtmlHrefToCssFileReferenceProvider.java

示例4: restrict

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] restrict(FileReferenceSet set, final Condition<PsiFile> cond, final Boolean soft) {
  final FileReference[] references = set.getAllReferences();

  return ContainerUtil.map2Array(references, PsiReference.class, new NotNullFunction<FileReference, PsiReference>() {
    @Override
    @NotNull
    public PsiReference fun(FileReference fileReference) {
      return new MyFileReference(fileReference, cond, soft);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:FileReferenceUtil.java

示例5: getReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] getReferences(@NotNull PsiElement element, String value, final String acceptedExtension) {
  final PsiDirectory directory = element.getContainingFile().getOriginalFile().getParent();
  if (directory == null) return PsiReference.EMPTY_ARRAY;
  final boolean startsWithSlash = value.startsWith("/");
  final VirtualFileSystem fs = directory.getVirtualFile().getFileSystem();
  final FileReferenceSet fileReferenceSet = new FileReferenceSet(value, element, 1, null, fs.isCaseSensitive()) {
    @NotNull
    @Override
    public Collection<PsiFileSystemItem> getDefaultContexts() {
      if (startsWithSlash || !directory.isValid()) {
        return super.getDefaultContexts();
      }
      return Collections.<PsiFileSystemItem>singletonList(directory);
    }

    @Override
    protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
      return new Condition<PsiFileSystemItem>() {
        @Override
        public boolean value(PsiFileSystemItem item) {
          if (item instanceof PsiDirectory) return true;
          final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(item);
          return virtualFile != null && acceptedExtension.equals(virtualFile.getExtension());
        }
      };
    }
  };
  if (startsWithSlash) {
    fileReferenceSet.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
  }
  return fileReferenceSet.getAllReferences();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:JavaFxFileReferenceProvider.java

示例6: getReferencesByElement

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull final PsiElement element,
                                             @NotNull ProcessingContext context) {
  final FileReferenceSet set = new FileReferenceSet(((XmlAttributeValue)element).getValue(), element, 1, null, true);
  return set.getAllReferences();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JavaFxSourceReferenceProvider.java

示例7: restrict

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] restrict(FileReferenceSet set, final Condition<PsiFile> cond, final Boolean soft) {
  final FileReference[] references = set.getAllReferences();

  return ContainerUtil.map2Array(references, PsiReference.class, new NotNullFunction<FileReference, PsiReference>() {
    @NotNull
    public PsiReference fun(FileReference fileReference) {
      return new MyFileReference(fileReference, cond, soft);
    }
  });
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:11,代码来源:FileReferenceUtil.java

示例8: getReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] getReferences(final PsiElement element, String value, final String acceptedExtension) {
  final PsiDirectory directory = element.getContainingFile().getOriginalFile().getParent();
  if (directory == null) return PsiReference.EMPTY_ARRAY;
  final boolean startsWithSlash = value.startsWith("/");
  final VirtualFileSystem fs = directory.getVirtualFile().getFileSystem();
  final FileReferenceSet fileReferenceSet = new FileReferenceSet(value, element, 1, null, fs.isCaseSensitive()) {
    @NotNull
    @Override
    public Collection<PsiFileSystemItem> getDefaultContexts() {
      if (startsWithSlash || !directory.isValid()) {
        return super.getDefaultContexts();
      }
      return Collections.<PsiFileSystemItem>singletonList(directory);
    }

    @Override
    protected Condition<PsiFileSystemItem> getReferenceCompletionFilter() {
      return new Condition<PsiFileSystemItem>() {
        @Override
        public boolean value(PsiFileSystemItem item) {
          if (item instanceof PsiDirectory) return true;
          final VirtualFile virtualFile = PsiUtilCore.getVirtualFile(item);
          return virtualFile != null && acceptedExtension.equals(virtualFile.getExtension());
        }
      };
    }
  };
  if (startsWithSlash) {
    fileReferenceSet.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, FileReferenceSet.ABSOLUTE_TOP_LEVEL);
  }
  return fileReferenceSet.getAllReferences();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:33,代码来源:JavaFxFileReferenceProvider.java

示例9: createReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@NotNull
public PsiReference[] createReferences(GenericDomValue genericDomValue, PsiElement element, ConvertContext context) {
    final String text = genericDomValue.getStringValue();
    if (text == null) {
        return PsiReference.EMPTY_ARRAY;
    }
    Project project = element.getProject();
    final int offset = ElementManipulators.getOffsetInElement(element);
    final FileReferenceSet referenceSet = createReferenceSet(project, text, element, offset);
    return referenceSet.getAllReferences();
}
 
开发者ID:code4craft,项目名称:ibatis-plugin,代码行数:12,代码来源:PsiFileConverterBase.java

示例10: getFileReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@NotNull
public static FileReference[] getFileReferences(@NotNull String text, @NotNull PsiElement element, int startOffset, final boolean considerVelocityProperties) {
    FileReferenceSet set = considerVelocityProperties
            ? new VtlFileReferenceSet(text, element, startOffset)
            : new SoftFileReferenceSet(text, element, startOffset);
    return set.getAllReferences();
}
 
开发者ID:consulo,项目名称:consulo-apache-velocity,代码行数:8,代码来源:PsiUtil.java

示例11: createReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@NotNull
public static PsiReference[] createReferences(@NotNull final PsiElement psiElement, final boolean soft) {
  FileReferenceSet set = new MyFileReferenceSet(psiElement, soft);

  return set.getAllReferences();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:7,代码来源:MavenDependencySystemPathConverter.java

示例12: restrict

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] restrict(FileReferenceSet set, final Condition<PsiFile> cond, final Boolean soft) {
  final FileReference[] references = set.getAllReferences();

  return ContainerUtil.map2Array(references, PsiReference.class, (NotNullFunction<FileReference, PsiReference>)fileReference -> new MyFileReference(fileReference, cond, soft));
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:6,代码来源:FileReferenceUtil.java

示例13: getFileRefs

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
public static PsiReference[] getFileRefs(final PsiElement elt, final int offset, String str, final LookupOptions lookupOptions)
{

	if(lookupOptions.IGNORE_TEXT_ARTER_HASH)
	{
		int hashIndex = str.indexOf('#');
		if(hashIndex != -1)
		{
			str = str.substring(0, hashIndex);
		}
	}

	final FileReferenceSet base = new FileReferenceSet(str, elt, offset, null, SystemInfo.isFileSystemCaseSensitive);

	final boolean lookForAbsolutePath = lookupOptions.ABSOLUTE && new File(str).isAbsolute();
	final boolean startsWithSlash = str.startsWith("/");

	base.addCustomization(FileReferenceSet.DEFAULT_PATH_EVALUATOR_OPTION, new Function<PsiFile, Collection<PsiFileSystemItem>>()
	{
		@Override
		public Collection<PsiFileSystemItem> fun(PsiFile psiFile)
		{
			final PsiElement context = psiFile.getContext();
			if(context instanceof PsiLanguageInjectionHost)
			{
				psiFile = context.getContainingFile();
			}
			PsiFile originalFile = psiFile.getOriginalFile();
			if(originalFile != null)
			{
				psiFile = originalFile;
			}

			final List<VirtualFile> dirs = new ArrayList<VirtualFile>();

			// paths relative to file should not start with slash
			if(lookupOptions.RELATIVE_TO_FILE && !startsWithSlash)
			{
				appendFileLocation(dirs, psiFile);
			}

			if((lookupOptions.RELATIVE_TO_SOURCE_ROOTS_START_WITH_SLASH && startsWithSlash) || (lookupOptions.RELATIVE_TO_SOURCE_ROOTS_START_WITHOUT_SLASH
					&& !startsWithSlash))
			{
				appendSourceRoots(dirs, psiFile);
			}

			if(lookForAbsolutePath)
			{
				appendFileSystemRoot(dirs, psiFile.getProject());
			}

			if(lookupOptions.RELATIVE_TO_PROJECT_BASE_DIR)
			{
				dirs.add(psiFile.getProject().getBaseDir());
			}

			if(lookupOptions.IN_SDK_AND_LIBRARY_CLASS_ROOTS)
			{
				appendSdkAndLibraryClassRoots(dirs, psiFile);
			}

			final Collection<PsiFileSystemItem> result = new ArrayList<PsiFileSystemItem>();
			final PsiManager psiManager = PsiManager.getInstance(psiFile.getProject());
			for(final VirtualFile dir : dirs)
			{
				if(dir != null)
				{
					final PsiDirectory psiDir = psiManager.findDirectory(dir);
					if(psiDir != null)
					{
						result.add(psiDir);
					}
				}
			}
			return result;
		}
	});
	return base.getAllReferences();
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:81,代码来源:ReferenceSupport.java


注:本文中的com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet.getAllReferences方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。