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


Java StubElement.getChildrenByType方法代码示例

本文整理汇总了Java中com.intellij.psi.stubs.StubElement.getChildrenByType方法的典型用法代码示例。如果您正苦于以下问题:Java StubElement.getChildrenByType方法的具体用法?Java StubElement.getChildrenByType怎么用?Java StubElement.getChildrenByType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.psi.stubs.StubElement的用法示例。


在下文中一共展示了StubElement.getChildrenByType方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getClasses

import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
@NotNull
public PsiClass[] getClasses() {
  final StubElement<?> stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(JavaStubElementTypes.CLASS, PsiClass.ARRAY_FACTORY);
  }

  return calcTreeElement().getChildrenAsPsiElements(Constants.CLASS_BIT_SET, PsiClass.ARRAY_FACTORY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PsiJavaFileBaseImpl.java

示例2: getImportStatements

import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
public GrImportStatement[] getImportStatements() {
  final StubElement<?> stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY);
  }

  return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.IMPORT_STATEMENT, GrImportStatement.ARRAY_FACTORY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:GroovyFileImpl.java

示例3: getTypeDefinitions

import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
@NotNull
public GrTypeDefinition[] getTypeDefinitions() {
  final StubElement<?> stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY);
  }

  return calcTreeElement().getChildrenAsPsiElements(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GroovyFileBaseImpl.java

示例4: getCodeMethods

import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Override
@NotNull
public GrMethod[] getCodeMethods() {
  final StubElement<?> stub = getStub();
  if (stub != null) {
    return stub.getChildrenByType(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY);
  }

  return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.METHOD_DEFINITION, GrMethod.ARRAY_FACTORY);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:GroovyFileBaseImpl.java

示例5: calcBasesResolveContext

import com.intellij.psi.stubs.StubElement; //导入方法依赖的package包/类
@Nullable
private static PsiElement calcBasesResolveContext(PsiClass aClass,
                                                  String className,
                                                  boolean isInitialClass,
                                                  final PsiElement defaultResolveContext) {
  final PsiClassStub stub = ((PsiClassImpl)aClass).getStub();
  if (stub == null || stub.isAnonymousInQualifiedNew()) {
    return aClass.getParent();
  }

  boolean isAnonOrLocal = isAnonymousOrLocal(aClass);

  if (!isAnonOrLocal) {
    return isInitialClass ? defaultResolveContext : aClass;
  }

  if (!isInitialClass) {
    if (aClass.findInnerClassByName(className, true) != null) return aClass;
  }

  final StubElement parentStub = stub.getParentStub();

  final StubBasedPsiElementBase<?> context = (StubBasedPsiElementBase)parentStub.getPsi();
  @SuppressWarnings("unchecked")
  PsiClass[] classesInScope = (PsiClass[])parentStub.getChildrenByType(Constants.CLASS_BIT_SET, PsiClass.ARRAY_FACTORY);

  boolean needPreciseContext = false;
  if (classesInScope.length > 1) {
    for (PsiClass scopeClass : classesInScope) {
      if (scopeClass == aClass) continue;
      String className1 = scopeClass.getName();
      if (className.equals(className1)) {
        needPreciseContext = true;
        break;
      }
    }
  }
  else {
    if (classesInScope.length != 1) {
      LOG.assertTrue(classesInScope.length == 1, "Parent stub: "+parentStub.getStubType() +"; children: "+parentStub.getChildrenStubs()+"; \ntext:"+context.getText());
    }
    LOG.assertTrue(classesInScope[0] == aClass);
  }

  if (needPreciseContext) {
    return aClass.getParent();
  }
  else {
    if (context instanceof PsiClass) {
      return calcBasesResolveContext((PsiClass)context, className, false, defaultResolveContext);
    }
    else if (context instanceof PsiMember) {
      return calcBasesResolveContext(((PsiMember)context).getContainingClass(), className, false, defaultResolveContext);
    }
    else {
      LOG.assertTrue(false);
      return context;
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:61,代码来源:PsiClassImpl.java


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