本文整理汇总了Java中com.intellij.psi.stubs.StubElement.getChildrenStubs方法的典型用法代码示例。如果您正苦于以下问题:Java StubElement.getChildrenStubs方法的具体用法?Java StubElement.getChildrenStubs怎么用?Java StubElement.getChildrenStubs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.stubs.StubElement
的用法示例。
在下文中一共展示了StubElement.getChildrenStubs方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getWrappersFromStub
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Nullable
private Modifier getWrappersFromStub() {
final StubElement parentStub = getStub().getParentStub();
final List childrenStubs = parentStub.getChildrenStubs();
int index = childrenStubs.indexOf(getStub());
if (index >= 0 && index < childrenStubs.size() - 1) {
StubElement nextStub = (StubElement)childrenStubs.get(index + 1);
if (nextStub instanceof PyTargetExpressionStub) {
final PyTargetExpressionStub targetExpressionStub = (PyTargetExpressionStub)nextStub;
if (targetExpressionStub.getInitializerType() == PyTargetExpressionStub.InitializerType.CallExpression) {
final QualifiedName qualifiedName = targetExpressionStub.getInitializer();
if (QualifiedName.fromComponents(PyNames.CLASSMETHOD).equals(qualifiedName)) {
return CLASSMETHOD;
}
if (QualifiedName.fromComponents(PyNames.STATICMETHOD).equals(qualifiedName)) {
return STATICMETHOD;
}
}
}
}
return null;
}
示例2: collectAllStubChildren
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
static List<PsiElement> collectAllStubChildren(PsiElement e, StubElement stub) {
final List<PsiElement> result = new ArrayList<PsiElement>();
if (stub != null) {
final List<StubElement> children = stub.getChildrenStubs();
for (StubElement child : children) {
//noinspection unchecked
result.add(child.getPsi());
}
}
else {
e.acceptChildren(new TopLevelVisitor() {
@Override
protected void checkAddElement(PsiElement node) {
result.add(node);
}
});
}
return result;
}
示例3: collectStubChildren
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@NotNull
static <T, U extends PsiElement> List<T> collectStubChildren(U e,
final StubElement<U> stub, final IElementType elementType,
final Class<T> itemClass) {
final List<T> result = new ArrayList<T>();
if (stub != null) {
final List<StubElement> children = stub.getChildrenStubs();
for (StubElement child : children) {
if (child.getStubType() == elementType) {
//noinspection unchecked
result.add((T)child.getPsi());
}
}
}
else {
e.acceptChildren(new TopLevelVisitor() {
@Override
protected void checkAddElement(PsiElement node) {
if (node.getNode().getElementType() == elementType) {
//noinspection unchecked
result.add((T)node);
}
}
});
}
return result;
}
示例4: getPackageDefinition
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
public GrPackageDefinition getPackageDefinition() {
final StubElement<?> stub = getStub();
if (stub != null) {
for (StubElement element : stub.getChildrenStubs()) {
if (element instanceof GrPackageDefinitionStub) return (GrPackageDefinition)element.getPsi();
}
return null;
}
ASTNode node = calcTreeElement().findChildByType(GroovyElementTypes.PACKAGE_DEFINITION);
return node != null ? (GrPackageDefinition)node.getPsi() : null;
}
示例5: getStubsTreeImpl
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
private static void getStubsTreeImpl(StubElement element, StringBuffer buffer, String offset) {
PsiElement psi = element.getPsi();
buffer.append(offset).append("[").append(psi.toString()).
append(element instanceof NamedStub ? " : " + ((NamedStub) element).getName() : "").
append("]\n");
for (StubElement stubElement : ((List<StubElement>) element.getChildrenStubs())) {
getStubsTreeImpl(stubElement, buffer, offset + " ");
}
}
示例6: indexStub
import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
public void indexStub(@NotNull final PsiMethodStub stub, @NotNull final IndexSink sink) {
final String name = stub.getName();
if (name != null) {
sink.occurrence(JavaStubIndexKeys.METHODS, name);
if (RecordUtil.isStaticNonPrivateMember(stub)) {
sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
}
}
Set<String> methodTypeParams = null;
for (StubElement stubElement : stub.getChildrenStubs()) {
if (stubElement instanceof PsiTypeParameterListStub) {
for (Object tStub : stubElement.getChildrenStubs()) {
if (tStub instanceof PsiTypeParameterStub) {
if (methodTypeParams == null) {
methodTypeParams = new HashSet<String>();
}
methodTypeParams.add(((PsiTypeParameterStub)tStub).getName());
}
}
}
else if (stubElement instanceof PsiParameterListStub) {
for (StubElement paramStub : ((PsiParameterListStub)stubElement).getChildrenStubs()) {
if (paramStub instanceof PsiParameterStub) {
TypeInfo type = ((PsiParameterStub)paramStub).getType(false);
if (type.arrayCount > 0) continue;
String typeName = type.getShortTypeText();
if (TypeConversionUtil.isPrimitive(typeName) || TypeConversionUtil.isPrimitiveWrapper(typeName)) continue;
sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, typeName);
if (methodTypeParams != null && methodTypeParams.contains(typeName)) {
sink.occurrence(JavaStubIndexKeys.METHOD_TYPES, TYPE_PARAMETER_PSEUDO_NAME);
methodTypeParams = null;
}
}
}
break;
}
}
}