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


Java CommonProcessors.FindFirstProcessor方法代码示例

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


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

示例1: hasStubElementsOfType

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement,
                                     final Class<? extends DomElement> clazz) {
  final VirtualFile file = domFileElement.getFile().getVirtualFile();
  if (!(file instanceof VirtualFileWithId)) return false;

  final String clazzName = clazz.getName();
  final int virtualFileId = ((VirtualFileWithId)file).getId();

  CommonProcessors.FindFirstProcessor<? super PsiFile> processor =
    new CommonProcessors.FindFirstProcessor<PsiFile>();
  StubIndex.getInstance().processElements(KEY, clazzName,
                                          domFileElement.getFile().getProject(),
                                          GlobalSearchScope.fileScope(domFileElement.getFile()),
                                          new IdFilter() {
                                            @Override
                                            public boolean containsFileId(int id) {
                                              return id == virtualFileId;
                                            }
                                          },
                                          PsiFile.class, 
                                          processor
  );

  return processor.isFound();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DomElementClassIndex.java

示例2: hasStubElementsWithNamespaceKey

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey) {
  final VirtualFile file = domFileElement.getFile().getVirtualFile();
  if (!(file instanceof VirtualFileWithId)) return false;

  final int virtualFileId = ((VirtualFileWithId)file).getId();
  CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
  StubIndex.getInstance().processElements(
    KEY,
    namespaceKey,
    domFileElement.getFile().getProject(),
    GlobalSearchScope.fileScope(domFileElement.getFile()),
    new IdFilter() {
      @Override
      public boolean containsFileId(int id) {
        return id == virtualFileId;
      }
    },
    PsiFile.class, 
    processor
  );
  return processor.isFound();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DomNamespaceKeyIndex.java

示例3: hasStubElementsOfType

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsOfType(final DomFileElement domFileElement, final Class<? extends DomElement> clazz)
{
	final VirtualFile file = domFileElement.getFile().getVirtualFile();
	if(!(file instanceof VirtualFileWithId))
	{
		return false;
	}

	final String clazzName = clazz.getName();
	final int virtualFileId = ((VirtualFileWithId) file).getId();

	CommonProcessors.FindFirstProcessor<? super PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
	StubIndex.getInstance().process(KEY, clazzName, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile())
			, new IdFilter()
	{
		@Override
		public boolean containsFileId(int id)
		{
			return id == virtualFileId;
		}
	}, processor);

	return processor.isFound();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:25,代码来源:DomElementClassIndex.java

示例4: hasStubElementsWithNamespaceKey

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
public boolean hasStubElementsWithNamespaceKey(final DomFileElement domFileElement, final String namespaceKey)
{
	final VirtualFile file = domFileElement.getFile().getVirtualFile();
	if(!(file instanceof VirtualFileWithId))
	{
		return false;
	}

	final int virtualFileId = ((VirtualFileWithId) file).getId();
	CommonProcessors.FindFirstProcessor<PsiFile> processor = new CommonProcessors.FindFirstProcessor<PsiFile>();
	StubIndex.getInstance().process(KEY, namespaceKey, domFileElement.getFile().getProject(), GlobalSearchScope.fileScope(domFileElement.getFile
			()), new IdFilter()
	{
		@Override
		public boolean containsFileId(int id)
		{
			return id == virtualFileId;
		}
	}, processor);
	return processor.isFound();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:22,代码来源:DomNamespaceKeyIndex.java

示例5: findDeepestSuper

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static PsiMethod findDeepestSuper(@NotNull final PsiMethod method) {
  CommonProcessors.FindFirstProcessor<PsiMethod> processor = new CommonProcessors.FindFirstProcessor<PsiMethod>();
  MethodDeepestSuperSearcher.processDeepestSuperMethods(method, processor);
  final PsiMethod first = processor.getFoundValue();
  return first == null ? method : first;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:RecursionWeigher.java

示例6: findAnnotatedMethod

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public final <T extends Annotation> Method findAnnotatedMethod(final Class<T> annotationClass, final Class startFrom) {
  CommonProcessors.FindFirstProcessor<Method> processor = new CommonProcessors.FindFirstProcessor<Method>() {
    @Override
    protected boolean accept(Method method) {
      final T annotation = method.getAnnotation(annotationClass);
      return annotation != null && ReflectionUtil.isAssignable(method.getDeclaringClass(), startFrom);
    }
  };
  processMethods(startFrom, processor);
  return processor.getFoundValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:JavaMethodSignature.java

示例7: findAnnotation

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public final <T extends Annotation> T findAnnotation(final Class<T> annotationClass, final Class startFrom) {
  CommonProcessors.FindFirstProcessor<Method> processor = new CommonProcessors.FindFirstProcessor<Method>() {
    @Override
    protected boolean accept(Method method) {
      final T annotation = method.getAnnotation(annotationClass);
      return annotation != null;
    }
  };
  processMethods(startFrom, processor);
  final Method foundMethod = processor.getFoundValue();
  return foundMethod == null ? null : foundMethod.getAnnotation(annotationClass);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:JavaMethodSignature.java

示例8: getImplementation

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
  if (element == null) return null;
  CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
    @Override
    public boolean process(final T t) {
      return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
    }
  };
  new ImplementationProcessor<T>(processor, true).process(element);
  return (V)processor.getFoundValue();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ModelMergerUtil.java

示例9: getImplementation

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
  if (element == null) return null;
  CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
    public boolean process(final T t) {
      return !ReflectionCache.isAssignable(clazz, t.getClass()) || super.process(t);
    }
  };
  new ImplementationProcessor<T>(processor, true).process(element);
  return (V)processor.getFoundValue();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:ModelMergerUtil.java

示例10: getImplementation

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static <T, V> V getImplementation(final T element, final Class<V> clazz) {
  if (element == null) return null;
  CommonProcessors.FindFirstProcessor<T> processor = new CommonProcessors.FindFirstProcessor<T>() {
    public boolean process(final T t) {
      return !ReflectionUtil.isAssignable(clazz, t.getClass()) || super.process(t);
    }
  };
  new ImplementationProcessor<T>(processor, true).process(element);
  return (V)processor.getFoundValue();
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:12,代码来源:ModelMergerUtil.java

示例11: findPackage

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public PsiJavaPackage findPackage(@NotNull String qualifiedName)
{
	final CommonProcessors.FindFirstProcessor<VirtualFile> processor = new CommonProcessors.FindFirstProcessor<>();
	processDirectories(qualifiedName, ALL_SCOPE, processor);
	return processor.getFoundValue() != null ? createPackage(qualifiedName) : null;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:8,代码来源:NonClasspathClassFinder.java

示例12: findDeepestSuper

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static PsiMethod findDeepestSuper(@NotNull final PsiMethod method)
{
	CommonProcessors.FindFirstProcessor<PsiMethod> processor = new CommonProcessors.FindFirstProcessor<>();
	MethodDeepestSuperSearcher.processDeepestSuperMethods(method, processor);
	final PsiMethod first = processor.getFoundValue();
	return first == null ? method : first;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:9,代码来源:RecursionWeigher.java

示例13: findPackage

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
  final CommonProcessors.FindFirstProcessor<VirtualFile> processor = new CommonProcessors.FindFirstProcessor<VirtualFile>();
  processDirectories(qualifiedName, ALL_SCOPE, processor);
  return processor.getFoundValue() != null ? createPackage(qualifiedName) : null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:NonClasspathClassFinder.java


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