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


Java FileReferenceSet.addCustomization方法代码示例

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


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

示例1: createReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@Override
public boolean createReferences(@NotNull final PsiElement psiElement,
                                final int offset,
                                final String text,
                                final @NotNull 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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:StaticPathReferenceProvider.java

示例2: 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

示例3: 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

示例4: createReferences

import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; //导入方法依赖的package包/类
@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;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:25,代码来源:StaticPathReferenceProvider.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: 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

示例7: 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.addCustomization方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。