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


Java AnnotatedElementsSearch类代码示例

本文整理汇总了Java中com.intellij.psi.search.searches.AnnotatedElementsSearch的典型用法代码示例。如果您正苦于以下问题:Java AnnotatedElementsSearch类的具体用法?Java AnnotatedElementsSearch怎么用?Java AnnotatedElementsSearch使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AnnotatedElementsSearch类属于com.intellij.psi.search.searches包,在下文中一共展示了AnnotatedElementsSearch类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: classStream

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
Stream<PsiClass> classStream() {
    if (context.isValid()) {
        Stream<PsiClass> stream = StreamSupport.stream(
                AnnotatedElementsSearch.searchPsiClasses(
                        context.getConfigAnnotationClass(),
                        GlobalSearchScope.allScope(context.getProject())).spliterator(),
                false);
        Predicate<PsiClass> filter = context.getFilter();
        if (filter != null) {
            stream = stream.filter(filter);
        }
        return stream;
    } else {
        return Stream.empty();
    }
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:17,代码来源:CoffigResolver.java

示例2: computeChildren

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
@Override
protected MultiMap<PsiFile, T> computeChildren(@Nullable PsiFile psiFile) {
    MultiMap<PsiFile, T> children = new MultiMap<>();
    Project project = getProject();
    if (project != null) {
        JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
        PsiClass serviceAnnotation = javaPsiFacade.findClass(getAnnotationQName(), GlobalSearchScope.allScope(project));
        if (serviceAnnotation != null) {
            AnnotatedElementsSearch.searchPsiClasses(serviceAnnotation, GlobalSearchScope.allScope(project)).forEach(psiClass -> {
                if (psiClass.isInterface() && isSatisfying(psiClass)) {
                    children.putValue(psiClass.getContainingFile(), createChild(psiClass));
                }
                return true;
            });
        }
    }
    return children;
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:19,代码来源:AnnotatedInterfaceNode.java

示例3: computeChildren

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
@Override
public MultiMap<PsiFile, ResourceNode> computeChildren(PsiFile psiFile) {
    Project project = getProject();
    MultiMap<PsiFile, ResourceNode> children = new MultiMap<>();
    if (project != null) {
        JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(project);
        PsiClass pathAnnotation = javaPsiFacade.findClass(PATH_ANNOTATION, GlobalSearchScope.allScope(project));
        if (pathAnnotation != null) {
            AnnotatedElementsSearch.searchPsiClasses(pathAnnotation, GlobalSearchScope.allScope(project)).forEach(psiClass -> {
                if (!psiClass.isInterface() && !NavigatorUtil.isAbstract(psiClass)) {
                    children.putValue(psiClass.getContainingFile(), new ResourceNode(ResourcesNode.this, pathAnnotation, psiClass));
                }
                return true;
            });
        }
    }
    return children;
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:19,代码来源:ResourcesNode.java

示例4: calcGppScope

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
private static GlobalSearchScope calcGppScope(Project project) {
  final GlobalSearchScope allScope = GlobalSearchScope.allScope(project);
  final GlobalSearchScope maximal = GlobalSearchScope.getScopeRestrictedByFileTypes(allScope, GroovyFileType.GROOVY_FILE_TYPE);
  GlobalSearchScope gppExtensions = new DelegatingGlobalSearchScope(maximal, "groovy.gpp") {
    @Override
    public boolean contains(VirtualFile file) {
      return super.contains(file) && GppTypeConverter.isGppExtension(file.getExtension());
    }
  };
  final PsiClass typed = JavaPsiFacade.getInstance(project).findClass(GppTypeConverter.GROOVY_LANG_TYPED, allScope);
  if (typed != null) {
    final Set<VirtualFile> files = new HashSet<VirtualFile>();
    AnnotatedElementsSearch.searchElements(typed, maximal, PsiModifierListOwner.class).forEach(new Processor<PsiModifierListOwner>() {
      @Override
      public boolean process(PsiModifierListOwner occurrence) {
        ContainerUtil.addIfNotNull(occurrence.getContainingFile().getVirtualFile(), files);
        return true;
      }
    });

    GlobalSearchScope withTypedAnno = GlobalSearchScope.filesScope(project, files);
    return withTypedAnno.union(gppExtensions);
  }

  return gppExtensions;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:GroovyConstructorUsagesSearcher.java

示例5: getChildren

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static Set<PsiClass> getChildren(@NotNull PsiClass psiClass, @NotNull GlobalSearchScope scope)
{
	if(AnnotationTargetUtil.findAnnotationTarget(psiClass, PsiAnnotation.TargetType.ANNOTATION_TYPE, PsiAnnotation.TargetType.TYPE) == null)
	{
		return Collections.emptySet();
	}

	String name = psiClass.getQualifiedName();
	if(name == null)
	{
		return Collections.emptySet();
	}

	Set<PsiClass> result = new THashSet<>(HASHING_STRATEGY);

	AnnotatedElementsSearch.searchPsiClasses(psiClass, scope).forEach(processorResult ->
	{
		if(processorResult.isAnnotationType())
		{
			result.add(processorResult);
		}
		return true;
	});

	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:MetaAnnotationUtil.java

示例6: getChildren

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static Set<PsiClass> getChildren(final PsiClass psiClass, final GlobalSearchScope scope)
{
	if(AnnotationTargetUtil.findAnnotationTarget(psiClass, PsiAnnotation.TargetType.ANNOTATION_TYPE, PsiAnnotation.TargetType.TYPE) == null)
	{
		return Collections.emptySet();
	}

	final String name = psiClass.getQualifiedName();
	if(name == null)
	{
		return Collections.emptySet();
	}

	final Set<PsiClass> result = new THashSet<>(HASHING_STRATEGY);

	AnnotatedElementsSearch.searchPsiClasses(psiClass, scope).forEach(processorResult ->
	{
		if(processorResult.isAnnotationType())
		{
			result.add(processorResult);
		}
		return true;
	});

	return result;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:MetaAnnotationUtil.java

示例7: processQuery

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
@Override
public void processQuery(@NotNull ClassesWithAnnotatedMembersSearch.Parameters queryParameters,
                         @NotNull final Processor<PsiClass> consumer) {
  SearchScope scope = queryParameters.getScope();
  for (QueryExecutor executor : Extensions.getExtensions(ClassesWithAnnotatedMembersSearch.EP_NAME)) {
    if (executor instanceof ScopedQueryExecutor) {
      scope = scope.intersectWith(GlobalSearchScope.notScope(((ScopedQueryExecutor) executor).getScope(queryParameters)));
    }
  }

  final Set<PsiClass> processed = new HashSet<PsiClass>();
  AnnotatedElementsSearch.searchPsiMembers(queryParameters.getAnnotationClass(), scope).forEach(new Processor<PsiMember>() {
    @Override
    public boolean process(PsiMember member) {
      PsiClass psiClass;
      AccessToken token = ReadAction.start();
      try {
        psiClass = member instanceof PsiClass ? (PsiClass)member : member.getContainingClass();
      }
      finally {
        token.finish();
      }

      if (psiClass != null && processed.add(psiClass)) {
        consumer.process(psiClass);
      }

      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:ClassesWithAnnotatedMembersSearcher.java

示例8: collectVariableNamesFromBindables

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
private Set<String> collectVariableNamesFromBindables() {
  JavaPsiFacade facade = JavaPsiFacade.getInstance(myFacet.getModule().getProject());
  PsiClass aClass = facade.findClass(BINDABLE_QUALIFIED_NAME, myFacet.getModule().getModuleWithDependenciesAndLibrariesScope(false));
  if (aClass == null) {
    return null;
  }
  //noinspection unchecked
  final Collection<? extends PsiModifierListOwner> psiElements =
    AnnotatedElementsSearch.searchElements(aClass, myFacet.getModule().getModuleScope(), PsiMethod.class, PsiField.class).findAll();
  return BrUtil.collectIds(psiElements);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:DataBindingUtil.java

示例9: findAllJavaRobotKeywords

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static void findAllJavaRobotKeywords(Project project, List<PsiElement> results, boolean wrapPsiMethods) {
    // Search for all methods annotated with @RobotKeyword
    GlobalSearchScope allScope = ProjectScope.getAllScope(project);
    PsiClass robotKeywordAnnotation = getRobotKeywordPsiClass(project);
    if (robotKeywordAnnotation == null) {
        return; // If @RobotKeyword isn't on the classpath, just return.
    }
    Query<PsiMethod> query = AnnotatedElementsSearch.searchPsiMethods(robotKeywordAnnotation, allScope);
    Processor<PsiMethod> methodProcessor = new RobotJavaMethodProcessor(results, SearchType.FIND_ALL, Optional.<String>absent(), wrapPsiMethods);
    query.forEach(methodProcessor);
}
 
开发者ID:charlescapps,项目名称:robot-intellij-plugin,代码行数:12,代码来源:RobotJavaPsiUtil.java

示例10: findAllJavaRobotKeywordsStartingWith

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static void findAllJavaRobotKeywordsStartingWith(Project project, List<PsiElement> results, String startsWith, boolean wrapPsiMethods) {
    // Search for all methods annotated with @RobotKeyword that start with the given text
    GlobalSearchScope allScope = ProjectScope.getAllScope(project);
    PsiClass robotKeywordAnnotation = getRobotKeywordPsiClass(project);
    if (robotKeywordAnnotation == null) {
        // If @RobotKeyword isn't on the classpath, fall back to using word index.
        findAllJavaKeywordsStartingWithUsingWordIndex(project, results, startsWith, wrapPsiMethods);
        return;
    }
    Query<PsiMethod> query = AnnotatedElementsSearch.searchPsiMethods(robotKeywordAnnotation, allScope);
    Processor<PsiMethod> methodProcessor = new RobotJavaMethodProcessor(results, SearchType.STARTS_WITH, Optional.of(startsWith), wrapPsiMethods);
    query.forEach(methodProcessor);
}
 
开发者ID:charlescapps,项目名称:robot-intellij-plugin,代码行数:14,代码来源:RobotJavaPsiUtil.java

示例11: getStepMethods

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static Collection<PsiMethod> getStepMethods(Module module) {
    final PsiClass step = JavaPsiFacade.getInstance(module.getProject()).findClass(STEP_ANNOTATION_QUALIFIER, GlobalSearchScope.allScope(module.getProject()));
    if (step != null) {
        Collection<PsiMethod> methods = new ArrayList<>();
        for (Module m : Gauge.getSubModules(module))
            methods.addAll(AnnotatedElementsSearch.searchPsiMethods(step, GlobalSearchScope.moduleWithDependenciesAndLibrariesScope(m, true)).findAll());
        return methods;
    }
    return new ArrayList<>();
}
 
开发者ID:getgauge,项目名称:Intellij-Plugin,代码行数:11,代码来源:StepUtil.java

示例12: findSeamClasses

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
private Collection<PsiClass> findSeamClasses(PsiClass seamAnnotationClass,
        Module module) {
    GlobalSearchScope moduleContentRootSearchScope = ModuleContentRootSearchScope.moduleScope(module);
    Query<PsiClass> query = AnnotatedElementsSearch.searchPsiClasses(
            seamAnnotationClass, moduleContentRootSearchScope);
    return query.findAll();
}
 
开发者ID:troger,项目名称:nuxeo-intellij,代码行数:8,代码来源:NuxeoHotReloader.java

示例13: findAnnotatedElements

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
public static <T extends PsiModifierListOwner> void findAnnotatedElements(Class<T> elementClass, String annotationClass, PsiManager psiManager, GlobalSearchScope scope, Processor<T> processor)
{
	final PsiClass aClass = JavaPsiFacade.getInstance(psiManager.getProject()).findClass(annotationClass, GlobalSearchScope.allScope(psiManager.getProject()));
	if(aClass != null)
	{
		AnnotatedElementsSearch.searchElements(aClass, scope, elementClass).forEach(processor);
	}
}
 
开发者ID:consulo,项目名称:consulo-javaee,代码行数:9,代码来源:JamCommonUtil.java

示例14: processQuery

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
@Override
public void processQuery(@NotNull ClassesWithAnnotatedMembersSearch.Parameters queryParameters, @NotNull final Processor<PsiClass> consumer)
{
	SearchScope scope = queryParameters.getScope();
	for(QueryExecutor executor : Extensions.getExtensions(ClassesWithAnnotatedMembersSearch.EP_NAME))
	{
		if(executor instanceof ScopedQueryExecutor)
		{
			scope = scope.intersectWith(GlobalSearchScope.notScope(((ScopedQueryExecutor) executor).getScope(queryParameters)));
		}
	}

	final Set<PsiClass> processed = new HashSet<>();
	AnnotatedElementsSearch.searchPsiMembers(queryParameters.getAnnotationClass(), scope).forEach(member ->
	{
		PsiClass psiClass;
		AccessToken token = ReadAction.start();
		try
		{
			psiClass = member instanceof PsiClass ? (PsiClass) member : member.getContainingClass();
		}
		finally
		{
			token.finish();
		}

		if(psiClass != null && processed.add(psiClass))
		{
			consumer.process(psiClass);
		}

		return true;
	});
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:35,代码来源:ClassesWithAnnotatedMembersSearcher.java

示例15: findPsiFields

import com.intellij.psi.search.searches.AnnotatedElementsSearch; //导入依赖的package包/类
private void findPsiFields(Project project, GlobalSearchScope scope, Processor<PsiField> processor) {
    getScenarioStateClasses(project)
            .forEach(a -> AnnotatedElementsSearch.searchPsiFields(a, scope).forEach(processor));
}
 
开发者ID:TNG,项目名称:jgiven-intellij-plugin,代码行数:5,代码来源:ScenarioStateReferenceProvider.java


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