Java Code Examples for com.intellij.psi.stubs.StubElement#getChildrenByType()

The following examples show how to use com.intellij.psi.stubs.StubElement#getChildrenByType() . 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: CSharpFileImpl.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
private CSharpUsingListChild[] getUsingStatementsInner()
{
	StubElement<?> stub = getStub();
	if(stub != null)
	{
		return stub.getChildrenByType(CSharpStubElements.USING_CHILDREN, CSharpUsingListChild.ARRAY_FACTORY);
	}
	return findChildrenByClass(CSharpUsingListChild.class);
}
 
Example 2
Source File: CSharpFileImpl.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nonnull
@Override
public DotNetQualifiedElement[] getMembers()
{
	StubElement<?> stub = getStub();
	if(stub != null)
	{
		return stub.getChildrenByType(CSharpStubElements.QUALIFIED_MEMBERS, DotNetQualifiedElement.ARRAY_FACTORY);
	}
	return findChildrenByClass(DotNetQualifiedElement.class);
}
 
Example 3
Source File: CSharpStubVariableImplUtil.java    From consulo-csharp with Apache License 2.0 5 votes vote down vote up
@Nullable
private static DotNetVariable getPrevVariable(@Nonnull CSharpStubVariableImpl<?> variable)
{
	if(isMultipleDeclaration(variable))
	{
		CSharpVariableDeclStub<?> stub = variable.getStub();
		if(stub != null)
		{
			StubElement<?> parentStub = stub.getParentStub();
			PsiElement[] stubVariables = parentStub.getChildrenByType(variable.getElementType(), PsiElement.ARRAY_FACTORY);

			int i = ArrayUtil.find(stubVariables, variable);
			if(i <= 0)
			{
				LOGGER.error("Variable dont have type but dont second");
				return null;
			}

			return (DotNetVariable) stubVariables[i - 1];
		}
		else
		{
			CSharpStubVariableImpl<?> prevVariable = PsiTreeUtil.getPrevSiblingOfType(variable, variable.getClass());
			if(prevVariable == null)
			{
				LOGGER.error("Variable dont have type but dont second");
				return null;
			}
			return prevVariable;
		}
	}
	return null;
}