当前位置: 首页>>代码示例>>Java>>正文


Java StubElement.getChildrenStubs方法代码示例

本文整理汇总了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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:PyFunctionImpl.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:PyPsiUtils.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:PyPsiUtils.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:GroovyFileImpl.java

示例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 + "  ");
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:StubsTest.java

示例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;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:42,代码来源:JavaMethodElementType.java


注:本文中的com.intellij.psi.stubs.StubElement.getChildrenStubs方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。