com.intellij.util.Processor Java Examples

The following examples show how to use com.intellij.util.Processor. 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: CSharpCompositeElementGroupImpl.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
public void navigate(final boolean requestFocus)
{
	process(new Processor<T>()
	{
		@Override
		public boolean process(T t)
		{
			if(t instanceof Navigatable)
			{
				((Navigatable) t).navigate(requestFocus);
				return false;
			}
			return true;
		}
	});
}
 
Example #2
Source File: ProjectHelper.java    From r2m-plugin-android with Apache License 2.0 6 votes vote down vote up
private static List<String> getLibrariesName(Project project) {
    Module[] modules = ModuleManager.getInstance(project).getModules();
    final List<String> libraryNames = new ArrayList<String>();


    for (Module module : modules) {
        ModuleRootManager.getInstance(module).orderEntries().forEachLibrary(new Processor<Library>() {
            @Override
            public boolean process(Library library) {
                libraryNames.add(library.getName());
                return true;
            }
        });
    }
    return libraryNames;
}
 
Example #3
Source File: BuildFile.java    From intellij with Apache License 2.0 6 votes vote down vote up
public BuildElement findSymbolInScope(String name) {
  BuildElement[] resultHolder = new BuildElement[1];
  Processor<BuildElement> processor =
      buildElement -> {
        if (buildElement instanceof LoadedSymbol) {
          buildElement =
              BuildElement.asBuildElement(((LoadedSymbol) buildElement).getVisibleElement());
        }
        if (buildElement instanceof PsiNamedElement && name.equals(buildElement.getName())) {
          resultHolder[0] = buildElement;
          return false;
        }
        return true;
      };
  searchSymbolsInScope(processor, null);
  return resultHolder[0];
}
 
Example #4
Source File: CSharpSymbolNameContributor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
public void processElementsWithName(
		@Nonnull String name, @Nonnull Processor<NavigationItem> navigationItemProcessor, @Nonnull FindSymbolParameters findSymbolParameters)
{
	Project project = findSymbolParameters.getProject();
	IdFilter idFilter = findSymbolParameters.getIdFilter();
	GlobalSearchScope searchScope = findSymbolParameters.getSearchScope();

	StubIndex.getInstance().processElements(CSharpIndexKeys.METHOD_INDEX, name, project, searchScope, idFilter,
			DotNetLikeMethodDeclaration.class, (Processor) navigationItemProcessor);
	StubIndex.getInstance().processElements(CSharpIndexKeys.EVENT_INDEX, name, project, searchScope, idFilter,
			DotNetEventDeclaration.class,  (Processor) navigationItemProcessor);
	StubIndex.getInstance().processElements(CSharpIndexKeys.PROPERTY_INDEX, name, project, searchScope, idFilter,
			DotNetPropertyDeclaration.class, (Processor) navigationItemProcessor);
	StubIndex.getInstance().processElements(CSharpIndexKeys.FIELD_INDEX, name, project, searchScope, idFilter,
			DotNetFieldDeclaration.class, (Processor) navigationItemProcessor);
}
 
Example #5
Source File: GlobReferenceSearcher.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Override
public void processQuery(
    SearchParameters queryParameters, Processor<? super PsiReference> consumer) {
  PsiFileSystemItem file =
      ResolveUtil.asFileSystemItemSearch(queryParameters.getElementToSearch());
  if (file == null) {
    return;
  }
  BlazePackage containingPackage = BlazePackage.getContainingPackage(file);
  if (containingPackage == null || !inScope(queryParameters, containingPackage.buildFile)) {
    return;
  }
  String relativePath = containingPackage.getRelativePathToChild(file.getVirtualFile());
  if (relativePath == null) {
    return;
  }

  List<GlobExpression> globs =
      PsiUtils.findAllChildrenOfClassRecursive(containingPackage.buildFile, GlobExpression.class);
  for (GlobExpression glob : globs) {
    if (glob.matches(relativePath, file.isDirectory())) {
      consumer.process(globReference(glob, file));
    }
  }
}
 
Example #6
Source File: FileMoveHandler.java    From netbeans-mmd-plugin with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public List<UsageInfo> findUsages(final PsiFile psiFile, final PsiDirectory newParent, final boolean searchInComments, final boolean searchInNonJavaFiles) {
  Query<PsiReference> search = ReferencesSearch.search(psiFile);
  final List<PsiExtraFileReference> extraFileRefs = new ArrayList<PsiExtraFileReference>();
  search.forEach(new Processor<PsiReference>() {
    @Override
    public boolean process(PsiReference psiReference) {
      if (psiReference instanceof PsiExtraFileReference) {
        extraFileRefs.add((PsiExtraFileReference) psiReference);
      }
      return true;
    }
  });

  if (extraFileRefs.isEmpty()) {
    return null;
  } else {
    final List<UsageInfo> result = new ArrayList<UsageInfo>(extraFileRefs.size());
    for (final PsiExtraFileReference e : extraFileRefs) {
      result.add(new FileUsageInfo(e));
    }
    return result;
  }
}
 
Example #7
Source File: CSharpTypeImplementationSearcher.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@Override
public boolean execute(@Nonnull DefinitionsScopedSearch.SearchParameters queryParameters, @Nonnull final Processor<? super PsiElement> consumer)
{
	final PsiElement element = queryParameters.getElement();
	if(element instanceof DotNetTypeDeclaration)
	{
		return TypeInheritorsSearch.search((DotNetTypeDeclaration) element, queryParameters.getScope(), queryParameters.isCheckDeep(), true,
				CSharpTransform.INSTANCE).forEach(new Processor<DotNetTypeDeclaration>()

		{
			@Override
			public boolean process(DotNetTypeDeclaration typeDeclaration)
			{
				return consumer.process(typeDeclaration);
			}
		});
	}
	return true;
}
 
Example #8
Source File: PsiUtils.java    From intellij with Apache License 2.0 6 votes vote down vote up
/**
 * Walk through entire PSI tree rooted at 'element', processing all children of the given type.
 *
 * @return true if processing was stopped by the processor
 */
private static <T extends PsiElement> boolean processChildrenOfType(
    PsiElement element, Processor<T> processor, Class<T> psiClass, boolean reverseOrder) {
  PsiElement child = reverseOrder ? element.getLastChild() : element.getFirstChild();
  while (child != null) {
    if (psiClass.isInstance(child)) {
      if (!processor.process((T) child)) {
        return true;
      }
    }
    if (processChildrenOfType(child, processor, psiClass, reverseOrder)) {
      return true;
    }
    child = reverseOrder ? child.getPrevSibling() : child.getNextSibling();
  }
  return false;
}
 
Example #9
Source File: SearchStringItemProvider.java    From android-strings-search-plugin with Apache License 2.0 6 votes vote down vote up
@Override
public boolean filterElements(@NotNull ChooseByNameBase base,
                              @NotNull String pattern,
                              boolean everywhere,
                              @NotNull ProgressIndicator indicator,
                              @NotNull Processor<Object> consumer) {
    Collection<StringElement> elements = ((SearchStringModel) base.getModel()).getFilterItems();

    if (elements != null) {
        for (StringElement element : elements) {
            String value = element.getValue();

            if (value == null) {
                return false;
            }

            if (value.toLowerCase().contains(pattern.toLowerCase()) && !consumer.process(element)) {
                return false;
            }
        }
    }

    return false;
}
 
Example #10
Source File: CSharpNamespaceResolveContext.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@Override
public boolean processElements(@Nonnull Processor<PsiElement> processor, boolean deep)
{
	DotNetNamespaceAsElement.ChildrenFilter filter = DotNetNamespaceAsElement.ChildrenFilter.ONLY_ELEMENTS;
	if(StringUtil.isEmpty(myNamespaceAsElement.getPresentableQName()))
	{
		filter = DotNetNamespaceAsElement.ChildrenFilter.NONE;
	}
	Collection<PsiElement> children = myNamespaceAsElement.getChildren(myResolveScope, CSharpTransformer.INSTANCE, filter);
	children = CSharpCompositeTypeDeclaration.wrapPartialTypes(myResolveScope, myNamespaceAsElement.getProject(), children);

	for(PsiElement element : children)
	{
		ProgressManager.checkCanceled();
		if(!processor.process(element))
		{
			return false;
		}
	}
	return true;
}
 
Example #11
Source File: FindUsagesImpl171.java    From Android-Resource-Usage-Count with MIT License 6 votes vote down vote up
int findUsage(XmlTag element) {
    final FindUsagesHandler handler = FindUsagesImpl171.getFindUsagesHandler(element, element.getProject());
    if (handler != null) {
        final FindUsagesOptions findUsagesOptions = handler.getFindUsagesOptions();
        final PsiElement[] primaryElements = handler.getPrimaryElements();
        final PsiElement[] secondaryElements = handler.getSecondaryElements();
        Factory factory = new Factory() {
            public UsageSearcher create() {
                return FindUsagesImpl171.createUsageSearcher(primaryElements, secondaryElements, handler, findUsagesOptions, (PsiFile) null);
            }
        };
        UsageSearcher usageSearcher = (UsageSearcher)factory.create();
        final AtomicInteger mCount = new AtomicInteger(0);
        usageSearcher.generate(new Processor<Usage>() {
            @Override
            public boolean process(Usage usage) {
                if (ResourceUsageCountUtils.isUsefulUsageToCount(usage)) {
                    mCount.incrementAndGet();
                }
                return true;
            }
        });
        return mCount.get();
    }
    return 0;
}
 
Example #12
Source File: EnvironmentVariablesApi.java    From idea-php-dotenv-plugin with MIT License 6 votes vote down vote up
/**
 * @param project project
 * @param key     environment variable key
 * @return All key usages, like getenv('KEY')
 */
@NotNull
public static PsiElement[] getKeyUsages(Project project, String key) {
    List<PsiElement> targets = new ArrayList<>();

    PsiSearchHelper searchHelper = PsiSearchHelper.getInstance(project);

    Processor<PsiFile> psiFileProcessor = psiFile -> {
        for (EnvironmentVariablesUsagesProvider provider : EnvironmentVariablesProviderUtil.USAGES_PROVIDERS) {
            targets.addAll(EnvironmentVariablesUtil.getUsagesElementsByKey(key, provider.getUsages(psiFile)));
        }

        return true;
    };

    searchHelper.processAllFilesWithWord(key, GlobalSearchScope.allScope(project), psiFileProcessor, true);
    searchHelper.processAllFilesWithWordInLiterals(key, GlobalSearchScope.allScope(project), psiFileProcessor);

    return targets.toArray(PsiElement.EMPTY_ARRAY);
}
 
Example #13
Source File: PantsUtil.java    From intellij-pants-plugin with Apache License 2.0 6 votes vote down vote up
/**
 * {@code processor} should return false if we don't want to step into the directory.
 */
public static void traverseDirectoriesRecursively(@NotNull File root, @NotNull Processor<File> processor) {
  final LinkedList<File> queue = new LinkedList<>();
  queue.add(root);
  while (!queue.isEmpty()) {
    final File file = queue.removeFirst();
    if (file.isFile()) {
      continue;
    }
    if (!processor.process(file)) {
      continue;
    }

    final File[] children = file.listFiles();
    if (children != null) {
      ContainerUtil.addAll(queue, children);
    }
  }
}
 
Example #14
Source File: ThisKindProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@Override
public void process(@Nonnull CSharpResolveOptions options,
		@Nonnull DotNetGenericExtractor defaultExtractor,
		@Nullable PsiElement forceQualifierElement,
		@Nonnull Processor<ResolveResult> processor)
{
	DotNetTypeDeclaration thisTypeDeclaration = PsiTreeUtil.getContextOfType(options.getElement(), DotNetTypeDeclaration.class);
	if(thisTypeDeclaration != null)
	{
		thisTypeDeclaration = CSharpCompositeTypeDeclaration.selectCompositeOrSelfType(thisTypeDeclaration);

		DotNetGenericExtractor genericExtractor = DotNetGenericExtractor.EMPTY;
		int genericParametersCount = thisTypeDeclaration.getGenericParametersCount();
		if(genericParametersCount > 0)
		{
			Map<DotNetGenericParameter, DotNetTypeRef> map = new THashMap<>(genericParametersCount);
			for(DotNetGenericParameter genericParameter : thisTypeDeclaration.getGenericParameters())
			{
				map.put(genericParameter, new CSharpTypeRefFromGenericParameter(genericParameter));
			}
			genericExtractor = CSharpGenericExtractor.create(map);
		}
		processor.process(new CSharpResolveResultWithExtractor(thisTypeDeclaration, genericExtractor));
	}
}
 
Example #15
Source File: HaxeComponentFileNameIndex.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
@NotNull
public static List<VirtualFile> getFilesNameByQName(@NotNull String qName, @NotNull final GlobalSearchScope filter) {

  Project project = filter.getProject();
  if (project != null) {
    if (DumbService.isDumb(project)) {
      return DUMB_MODE_LIST;
    }
  }

  final List<VirtualFile> result = new ArrayList<VirtualFile>();
  getFileNames(qName, new Processor<VirtualFile>() {
    @Override
    public boolean process(VirtualFile file) {
      result.add(file);
      return true;
    }
  }, filter);
  return result;
}
 
Example #16
Source File: RootNamespaceKindProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@Override
public void process(@Nonnull CSharpResolveOptions options,
		@Nonnull DotNetGenericExtractor defaultExtractor,
		@Nullable PsiElement forceQualifierElement,
		@Nonnull Processor<ResolveResult> processor)
{
	PsiElement element = options.getElement();

	DotNetNamespaceAsElement temp = DotNetPsiSearcher.getInstance(element.getProject()).findNamespace("", element.getResolveScope());
	if(temp == null)
	{
		return;
	}
	processor.process(new CSharpResolveResult(temp));
}
 
Example #17
Source File: ParameterFromParentKindProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@Override
public void process(@Nonnull CSharpResolveOptions options,
		@Nonnull DotNetGenericExtractor defaultExtractor,
		@Nullable PsiElement forceQualifierElement,
		@Nonnull Processor<ResolveResult> processor)
{
	PsiElement element = options.getElement();

	DotNetParameterListOwner parameterListOwner = CSharpReferenceExpressionImplUtil.findParentOrNextIfDoc(element, DotNetParameterListOwner
			.class);
	if(parameterListOwner == null)
	{
		return;
	}

	SimpleNamedScopeProcessor scopeProcessor = new SimpleNamedScopeProcessor(processor, options.isCompletion(),
			ExecuteTarget.LOCAL_VARIABLE_OR_PARAMETER_OR_LOCAL_METHOD);
	ResolveState state = ResolveState.initial();
	state = state.put(CSharpResolveUtil.SELECTOR, options.getSelector());

	parameterListOwner.processDeclarations(scopeProcessor, state, null, element);
}
 
Example #18
Source File: WeightUtil.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
public static void sortAndProcess(@Nonnull List<MethodResolveResult> list, @Nonnull Processor<ResolveResult> processor, @Nonnull PsiElement place)
{
	if(list.isEmpty())
	{
		return;
	}

	ContainerUtil.sort(list, ourComparator);

	for(MethodResolveResult methodResolveResult : list)
	{
		ProgressManager.checkCanceled();

		methodResolveResult.setAssignable(place);

		if(!processor.process(methodResolveResult))
		{
			return;
		}
	}
}
 
Example #19
Source File: LabelKindProcessor.java    From consulo-csharp with Apache License 2.0 6 votes vote down vote up
@RequiredReadAction
@Override
public void process(@Nonnull CSharpResolveOptions options,
		@Nonnull DotNetGenericExtractor defaultExtractor,
		@Nullable PsiElement forceQualifierElement,
		@Nonnull Processor<ResolveResult> processor)
{
	PsiElement element = options.getElement();

	SimpleNamedScopeProcessor scopeProcessor = new SimpleNamedScopeProcessor(processor, options.isCompletion(), ExecuteTarget.LABEL);

	DotNetQualifiedElement parentOfType = PsiTreeUtil.getParentOfType(element, DotNetQualifiedElement.class);
	assert parentOfType != null;

	ResolveState state = ResolveState.initial();
	state = state.put(CSharpResolveUtil.SELECTOR, options.getSelector());
	CSharpResolveUtil.walkForLabel(scopeProcessor, parentOfType, state);
}
 
Example #20
Source File: LSPSymbolContributor.java    From lsp4intellij with Apache License 2.0 5 votes vote down vote up
@Override
public void processNames(@NotNull Processor<? super String> processor, @NotNull GlobalSearchScope globalSearchScope, @Nullable IdFilter idFilter) {
    String queryString = Optional.ofNullable(globalSearchScope.getProject())
        .map(p -> p.getUserData(ChooseByNamePopup.CURRENT_SEARCH_PATTERN)).orElse("");

    workspaceSymbolProvider.workspaceSymbols(queryString, globalSearchScope.getProject()).stream()
        .filter(ni -> globalSearchScope.accept(ni.getFile()))
        .map(NavigationItem::getName)
        .forEach(processor::process);
}
 
Example #21
Source File: HaxeComponentIndex.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static void processAll(Project project, Processor<Pair<String, HaxeClassInfo>> processor, GlobalSearchScope scope) {
  HaxeIndexUtil.warnIfDumbMode(project);
  final Collection<String> keys = getNames(project);
  for (String key : keys) {
    final List<HaxeClassInfo> values = FileBasedIndex.getInstance().getValues(HAXE_COMPONENT_INDEX, key, scope);
    for (HaxeClassInfo value : values) {
      final Pair<String, HaxeClassInfo> pair = Pair.create(key, value);
      if (!processor.process(pair)) {
        return;
      }
    }
  }
}
 
Example #22
Source File: CSharpReferenceExpressionImplUtil.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
public static void collectResults(@Nonnull CSharpResolveOptions options,
								  @Nonnull DotNetGenericExtractor defaultExtractor,
								  @Nullable PsiElement forceQualifierElement,
								  @Nonnull final Processor<ResolveResult> processor)
{
	final ResolveToKind kind = options.getKind();

	KindProcessor kindProcessor = ourProcessors[kind.ordinal()];

	kindProcessor.process(options, defaultExtractor, forceQualifierElement, processor);
}
 
Example #23
Source File: ReferenceSearch.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
@Override
public void processQuery(@NotNull ReferencesSearch.SearchParameters searchParameters, @NotNull Processor<? super PsiReference> processor) {
    ApplicationManager.getApplication().runReadAction(() -> {
        if (!helper.shouldFindReferences(searchParameters, searchParameters.getElementToSearch())) return;
        if (EventQueue.isDispatchThread())
            ProgressManager.getInstance().runProcessWithProgressSynchronously(() -> processElements(searchParameters, processor), "Find Usages", true, searchParameters.getElementToSearch().getProject());
        else
            processElements(searchParameters, processor);
    });
}
 
Example #24
Source File: HaxeFindUsagesHandler.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
@NotNull
private static ReadActionProcessor<PsiReference> getSimpleSearchProcessor(@NotNull Processor<UsageInfo> processor) {
  return new ReadActionProcessor<PsiReference>() {
    @Override
    public boolean processInReadAction(final PsiReference ref) {
      TextRange rangeInElement = ref.getRangeInElement();
      return processor
        .process(new UsageInfo(ref.getElement(), rangeInElement.getStartOffset(), rangeInElement.getEndOffset(), false));
    }
  };
}
 
Example #25
Source File: StepFindUsagesHandler.java    From Intellij-Plugin with Apache License 2.0 5 votes vote down vote up
private void runFindUsageReadAction(final PsiElement psiElement, final Processor<? super UsageInfo> processor, final FindUsagesOptions findUsagesOptions) {
    ApplicationManager.getApplication().runReadAction(() -> {
        if (psiElement instanceof PsiMethod) {
            PsiMethod[] psiMethods = SuperMethodWarningUtil.checkSuperMethods((PsiMethod) psiElement, CustomFUH.getActionString());
            if (psiMethods.length < 1) return;
            for (PsiElement method : psiMethods)
                StepFindUsagesHandler.this.processUsages(method, processor, findUsagesOptions);
        }
        StepFindUsagesHandler.this.processUsages(psiElement, processor, findUsagesOptions);
    });
}
 
Example #26
Source File: GraphQLPsiSearchHelper.java    From js-graphql-intellij-plugin with MIT License 5 votes vote down vote up
/**
 * Processes all named elements that match the specified word, e.g. the declaration of a type name
 */
public void processElementsWithWord(PsiElement scopedElement, String word, Processor<PsiNamedElement> processor) {
    try {
        final GlobalSearchScope schemaScope = getSchemaScope(scopedElement);

        processElementsWithWordUsingIdentifierIndex(schemaScope, word, processor);

        // also include the built-in schemas
        final PsiRecursiveElementVisitor builtInFileVisitor = new PsiRecursiveElementVisitor() {
            @Override
            public void visitElement(PsiElement element) {
                if (element instanceof PsiNamedElement && word.equals(element.getText())) {
                    if (!processor.process((PsiNamedElement) element)) {
                        return; // done processing
                    }
                }
                super.visitElement(element);
            }
        };

        // spec schema
        getBuiltInSchema().accept(builtInFileVisitor);

        // relay schema if enabled
        final PsiFile relayModernDirectivesSchema = getRelayModernDirectivesSchema();
        if (schemaScope.contains(relayModernDirectivesSchema.getVirtualFile())) {
            relayModernDirectivesSchema.accept(builtInFileVisitor);
        }

        // finally, look in the current scratch file
        if (GraphQLFileType.isGraphQLScratchFile(myProject, getVirtualFile(scopedElement.getContainingFile()))) {
            scopedElement.getContainingFile().accept(builtInFileVisitor);
        }

    } catch (IndexNotReadyException e) {
        // can't search yet (e.g. during project startup)
    }
}
 
Example #27
Source File: CSharpNamespaceResolveContext.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
@Override
public boolean processExtensionMethodGroups(@Nonnull final Processor<CSharpElementGroup<CSharpMethodDeclaration>> processor)
{
	for(CSharpResolveContext context : myExtensionContexts.getValue())
	{
		if(!context.processExtensionMethodGroups(processor))
		{
			return false;
		}
	}
	return true;
}
 
Example #28
Source File: AddConcernOnType.java    From attic-polygene-java with Apache License 2.0 5 votes vote down vote up
private static List<PsiClass> findConcernsCandidates( final @NotNull PsiClass classToCheck )
{
    GlobalSearchScope searchScope = determineSearchScope( classToCheck );
    PsiClass concernOfClass = getConcernOfClass( classToCheck.getProject(), searchScope );
    if( concernOfClass == null )
    {
        return emptyList();
    }

    Query<PsiClass> psiClassQuery = search( concernOfClass, searchScope, true, false );
    final List<PsiClass> concernCandidates = new ArrayList<PsiClass>();
    psiClassQuery.forEach( new Processor<PsiClass>()
    {
        public boolean process( PsiClass psiClass )
        {
            // TODO: Ideally search for all "extends" as well
            boolean isInheritor = psiClass.isInheritor( classToCheck, true );
            if( isInheritor )
            {
                concernCandidates.add( psiClass );
            }

            return true;
        }
    } );

    return concernCandidates;
}
 
Example #29
Source File: CSharpImplementedReferenceSearch.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Override
public void processQuery(@Nonnull ReferencesSearch.SearchParameters queryParameters, @Nonnull Processor<? super PsiReference> consumer)
{
	final PsiElement elementToSearch = queryParameters.getElementToSearch();
	if(elementToSearch instanceof CSharpMethodDeclaration)
	{
		Collection<DotNetVirtualImplementOwner> targets = ApplicationManager.getApplication().runReadAction(new Computable<Collection<DotNetVirtualImplementOwner>>()
		{
			@Override
			public Collection<DotNetVirtualImplementOwner> compute()
			{
				if(((CSharpMethodDeclaration) elementToSearch).hasModifier(DotNetModifier.ABSTRACT))
				{
					return OverrideUtil.collectOverridenMembers((DotNetVirtualImplementOwner) elementToSearch);
				}
				return Collections.emptyList();
			}
		});

		for(DotNetVirtualImplementOwner target : targets)
		{
			if(!ReferencesSearch.search(target, queryParameters.getEffectiveSearchScope()).forEach(consumer))
			{
				return;
			}
		}
	}
}
 
Example #30
Source File: CSharpCompositeResolveContext.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@RequiredReadAction
@Override
public boolean processExtensionMethodGroups(@Nonnull Processor<CSharpElementGroup<CSharpMethodDeclaration>> processor)
{
	for(CSharpResolveContext context : myContexts)
	{
		if(!context.processExtensionMethodGroups(processor))
		{
			return false;
		}
	}
	return true;
}