Java Code Examples for com.intellij.util.CommonProcessors#alwaysTrue()

The following examples show how to use com.intellij.util.CommonProcessors#alwaysTrue() . 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: SortedMemberResolveScopeProcessor.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
public SortedMemberResolveScopeProcessor(@Nonnull CSharpResolveOptions options,
		@Nonnull Processor<ResolveResult> resultProcessor,
		@Nonnull Comparator<ResolveResult> comparator,
		ExecuteTarget[] targets)
{
	super(options, CommonProcessors.<ResolveResult>alwaysTrue(), targets);
	myOriginalProcessor = resultProcessor;
	myComparator = comparator;
	initThisProcessor();
}
 
Example 2
Source File: OverrideUtil.java    From consulo-csharp with Apache License 2.0 4 votes vote down vote up
@Nonnull
@RequiredReadAction
public static Collection<DotNetVirtualImplementOwner> collectOverridingMembers(final DotNetVirtualImplementOwner target)
{
	PsiElement parent = target.getParent();
	if(parent == null)
	{
		return Collections.emptyList();
	}
	OverrideProcessor.Collector overrideProcessor = new OverrideProcessor.Collector();

	MemberResolveScopeProcessor processor = new MemberResolveScopeProcessor(parent, CommonProcessors.<ResolveResult>alwaysTrue(), new ExecuteTarget[]{
			ExecuteTarget.MEMBER,
			ExecuteTarget.ELEMENT_GROUP
	}, overrideProcessor);

	ResolveState state = ResolveState.initial();
	if(target instanceof CSharpIndexMethodDeclaration)
	{
		state = state.put(CSharpResolveUtil.SELECTOR, StaticResolveSelectors.INDEX_METHOD_GROUP);
	}
	else
	{
		String name = ((PsiNamedElement) target).getName();
		if(name == null)
		{
			return Collections.emptyList();
		}
		state = state.put(CSharpResolveUtil.SELECTOR, new MemberByNameSelector(name));
	}

	CSharpResolveUtil.walkChildren(processor, parent, false, true, state);

	List<DotNetVirtualImplementOwner> results = overrideProcessor.getResults();

	// need filter result due it ill return all elements with target selector
	ListIterator<DotNetVirtualImplementOwner> listIterator = results.listIterator();
	while(listIterator.hasNext())
	{
		ProgressManager.checkCanceled();

		DotNetVirtualImplementOwner next = listIterator.next();
		if(!CSharpElementCompareUtil.isEqual(next, target, CSharpElementCompareUtil.CHECK_RETURN_TYPE, target))
		{
			listIterator.remove();
		}
	}
	return results;
}