com.intellij.util.EmptyQuery Java Examples
The following examples show how to use
com.intellij.util.EmptyQuery.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractPropertiesProvider.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
/** * Create a search pattern for the given <code>annotationName</code> annotation * name. * * @param annotationName the annotation name to search. * @return a search pattern for the given <code>annotationName</code> annotation * name. */ protected static Query<PsiModifierListOwner> createAnnotationTypeReferenceSearchPattern(SearchContext context, String annotationName) { PsiClass annotationClass = context.getUtils().findClass(context.getModule(), annotationName); if (annotationClass != null) { return AnnotatedElementsSearch.searchElements(annotationClass, context.getScope(), PsiModifierListOwner.class); } else { return new EmptyQuery<>(); } }
Example #2
Source File: AbstractPropertiesProvider.java From intellij-quarkus with Eclipse Public License 2.0 | 5 votes |
/** * Create a search pattern for the given <code>className</code> class name. * * @param annotationName the class name to search. * @return a search pattern for the given <code>className</code> class name. */ protected static Query<PsiModifierListOwner> createAnnotationTypeDeclarationSearchPattern(SearchContext context, String annotationName) { JavaPsiFacade javaPsiFacade = JavaPsiFacade.getInstance(context.getModule().getProject()); PsiClass annotationClass = javaPsiFacade.findClass(annotationName, GlobalSearchScope.allScope(context.getModule().getProject())); if (annotationClass != null) { return new ArrayQuery<>(annotationClass); } else { return new EmptyQuery<>(); } }
Example #3
Source File: HaxeMethodsSearch.java From intellij-haxe with Apache License 2.0 | 5 votes |
public static Query<PsiMethod> search(final PsiMethod method, SearchScope scope, final boolean checkDeep, HaxeHierarchyTimeoutHandler timeoutHandler) { if (ApplicationManager.getApplication().runReadAction(new Computable<Boolean>() { @Override public Boolean compute() { return cannotBeOverriden(method); } })) return EmptyQuery.getEmptyQuery(); // Optimization return INSTANCE.createUniqueResultsQuery(new SearchParameters(method, scope, checkDeep)); }
Example #4
Source File: RootIndex.java From consulo with Apache License 2.0 | 4 votes |
@Nonnull public Query<VirtualFile> getDirectoriesByPackageName(@Nonnull final String packageName, final boolean includeLibrarySources) { List<VirtualFile> result = myDirectoriesByPackageNameCache.get(packageName); if (result == null) { if (myNonExistentPackages.contains(packageName)) return EmptyQuery.getEmptyQuery(); result = ContainerUtil.newSmartList(); if (StringUtil.isNotEmpty(packageName) && !StringUtil.startsWithChar(packageName, '.')) { int i = packageName.lastIndexOf('.'); while (true) { String shortName = packageName.substring(i + 1); String parentPackage = i > 0 ? packageName.substring(0, i) : ""; for (VirtualFile parentDir : getDirectoriesByPackageName(parentPackage, true)) { VirtualFile child = !parentDir.isValid() ? null : parentDir.findChild(shortName); if (child != null && child.isDirectory() && getInfoForFile(child).isInProject() && packageName.equals(getPackageName(child))) { result.add(child); } } if (i < 0) break; i = packageName.lastIndexOf('.', i - 1); } } for (VirtualFile file : myPackagePrefixRoots.get(packageName)) { if (file.isDirectory()) { result.add(file); } } if (!result.isEmpty()) { myDirectoriesByPackageNameCache.put(packageName, result); } else { myNonExistentPackages.add(packageName); } } if (!includeLibrarySources) { result = ContainerUtil.filter(result, file -> { DirectoryInfo info = getInfoForFile(file); return info.isInProject() && (!info.isInLibrarySource() || info.isInModuleSource() || info.hasLibraryClassRoot()); }); } return new CollectionQuery<>(result); }