@NotNull @Override public Set<AliasDesc> getClassAliasDescriptions(@Nullable PsiElement element) { Optional<PsiClass> clazz = Annotation.ALIAS.toPsiClass(project); if (clazz.isPresent()) { Collection<PsiClass> res = AnnotatedElementsSearch.searchPsiClasses(clazz.get(), GlobalSearchScope.allScope(project)).findAll(); return Sets.newHashSet(Collections2.transform(res, FUN)); } return Collections.emptySet(); }
public static ImpexProcessorModifierValue[] values() { final Project project = currentProject(); final PsiClass clazz; if (project != null) { clazz = JavaPsiFacade.getInstance(project) .findClass( "de.hybris.platform.impex.jalo.imp.ImportProcessor", allScope(project) ); if (clazz != null) { final Query<PsiClass> psiClasses = ClassInheritorsSearch.search(clazz, allScope(project), true); return psiClasses.findAll() .stream() .map(ImpexProcessorModifierValue::new) .toArray(ImpexProcessorModifierValue[]::new); } } return new ImpexProcessorModifierValue[]{}; }
/** * Returns references to the given element. If it is a BashPsiElement a special search scope is used to locate the elements referencing the file. * * @param element References to the given element * @return */ @NotNull @Override public Collection<PsiReference> findReferences(PsiElement element) { //fixme fix the custom scope SearchScope scope = (element instanceof BashPsiElement) ? BashElementSharedImpl.getElementUseScope((BashPsiElement) element, element.getProject()) : GlobalSearchScope.projectScope(element.getProject()); Query<PsiReference> search = ReferencesSearch.search(element, scope); return search.findAll(); }
boolean globScanned = element instanceof PerlGlobVariable; for (PsiReference reference : ReferencesSearch.search(element, element.getUseScope()).findAll()) { if (reference instanceof PsiPolyVariantReference) { for (ResolveResult resolveResult : ((PsiPolyVariantReference)reference).multiResolve(false)) {
final Collection<PsiReference> all1 = all.findAll(); return all1;
@NotNull @Override public Collection<PsiReference> findReferences(PsiElement element) { final Collection<PsiReference> references = super.findReferences(element); final Collection<PsiReference> all = ReferencesSearch.search(element).findAll(); PsiReference elementRef = element.getReference(); PsiElement definitionElement; if (elementRef != null) { definitionElement = elementRef.resolve(); if (definitionElement instanceof Symbol) { SymbolCollector collector = new SymbolCollector((Symbol) definitionElement); element.getContainingFile().accept(collector); references.addAll(collector.myReferences); } } return references; }
public PackageScope(@NotNull PsiPackage aPackage, boolean includeSubpackages, final boolean includeLibraries) { super(aPackage.getProject()); myPackage = aPackage; myIncludeSubpackages = includeSubpackages; Project project = myPackage.getProject(); myPackageQualifiedName = myPackage.getQualifiedName(); myDirs = PackageIndex.getInstance(project).getDirsByPackageName(myPackageQualifiedName, true).findAll(); myIncludeLibraries = includeLibraries; myPartOfPackagePrefix = JavaPsiFacade.getInstance(getProject()).isPartOfPackagePrefix(myPackageQualifiedName); myPackageQNamePrefix = myPackageQualifiedName + "."; }
totalVisited.add((BnfRule)parent)) { BnfRule rule = (BnfRule)parent; for (PsiReference reference : ReferencesSearch.search(rule, rule.getUseScope()).findAll()) { PsiElement element = reference.getElement(); if (element instanceof BnfExpression && PsiTreeUtil.getParentOfType(element, BnfPredicate.class) == null) {
usages.add(element); final Collection<PsiReference> refs = ReferencesSearch.search(element).findAll(); for (PsiReference ref : refs) { usages.add(ref.getElement());
Collection<PsiReference> refs = findUsagesHandler != null ? findUsagesHandler.findReferencesToHighlight(target, scope) : ReferencesSearch.search(target, scope).findAll(); for (PsiReference psiReference : refs) { if (psiReference == null) {
@Override public void run() { for (PsiReference reference : ReferencesSearch.search(file, file.getUseScope()).findAll()) { PerlPsiUtil.renameElement(reference.getElement(), newName);
@Override public void prepareMovedFile(PsiFile file, PsiDirectory moveDestination, Map<PsiElement, PsiElement> oldToNewMap) { file.putUserData(ORIGINAL_PACKAGE_NAME, ((PerlFileImpl)file).getFilePackageName()); String newFilePath = moveDestination.getVirtualFile().getPath() + '/' + file.getName(); VirtualFile newClassRoot = PerlUtil.getFileClassRoot(moveDestination.getProject(), newFilePath); if (newClassRoot != null) { String newRelativePath = newFilePath.substring(newClassRoot.getPath().length()); String newPackageName = PerlPackageUtil.getPackageNameByPath(newRelativePath); if (newPackageName != null) { for (PsiReference reference : ReferencesSearch.search(file, file.getUseScope()).findAll()) { PerlPsiUtil.renameElement(reference.getElement(), newPackageName); } } } }
@Override public void computeUsages(List<PsiElement> targets) { if (targets == null) { return; } for (PsiElement target : targets) { if (myFile.equals(target.getContainingFile()) && target instanceof PsiNameIdentifierOwner) { PsiElement nameIdentifier = ((PsiNameIdentifierOwner)target).getNameIdentifier(); if (nameIdentifier != null) { TextRange rangeInIdentifier = target instanceof PerlIdentifierRangeProvider ? ((PerlIdentifierRangeProvider)target).getRangeInIdentifier() : ElementManipulators.getValueTextRange(nameIdentifier); myWriteUsages.add(rangeInIdentifier.shiftRight(nameIdentifier.getNode().getStartOffset())); } } for (PsiReference reference : ReferencesSearch.search(target, new LocalSearchScope(myFile)).findAll()) { myReadUsages.add(reference.getRangeInElement().shiftRight(reference.getElement().getNode().getStartOffset())); } } } }
Collection<PsiReference> allReferences = ReferencesSearch.search(psiElement).findAll(); if (allReferences.isEmpty()) { CommonRefactoringUtil.showErrorHint(project, editor, "Rule is never used", "Inline Rule", null);