本文整理汇总了Java中com.intellij.psi.impl.source.tree.LightTreeUtil.requiredChildOfType方法的典型用法代码示例。如果您正苦于以下问题:Java LightTreeUtil.requiredChildOfType方法的具体用法?Java LightTreeUtil.requiredChildOfType怎么用?Java LightTreeUtil.requiredChildOfType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.psi.impl.source.tree.LightTreeUtil
的用法示例。
在下文中一共展示了LightTreeUtil.requiredChildOfType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
String name = RecordUtil.intern(tree.getCharTable(), id);
return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
示例2: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub) {
TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, ID_TYPES);
String name = RecordUtil.intern(tree.getCharTable(), id);
return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis);
}
示例3: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiParameterStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
TypeInfo typeInfo = TypeInfo.create(tree, node, parentStub);
LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
String name = RecordUtil.intern(tree.getCharTable(), id);
return new PsiParameterStubImpl(parentStub, name, typeInfo, typeInfo.isEllipsis, false);
}
示例4: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiTypeParameterStub createStub(final LighterAST tree, final LighterASTNode node, final StubElement parentStub) {
final LighterASTNode id = LightTreeUtil.requiredChildOfType(tree, node, JavaTokenType.IDENTIFIER);
final String name = RecordUtil.intern(tree.getCharTable(), id);
return new PsiTypeParameterStubImpl(parentStub, StringRef.fromString(name));
}
示例5: packModifierList
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
public static int packModifierList(@NotNull LighterAST tree, @NotNull LighterASTNode modList, @NotNull StubElement parent) {
int packed = 0;
final LighterASTNode modListOwner = tree.getParent(modList);
if (modListOwner != null && modListOwner.getTokenType() == parent.getStubType()) {
final StubElement grandParent = parent.getParentStub();
if (parent instanceof PsiClassStub) {
if (grandParent instanceof PsiClassStub && ((PsiClassStub)grandParent).isInterface()) {
packed |= ModifierFlags.PUBLIC_MASK;
packed |= ModifierFlags.STATIC_MASK;
}
if (((PsiClassStub)parent).isInterface()) {
packed |= ModifierFlags.ABSTRACT_MASK;
if (grandParent instanceof PsiClassStub) {
packed |= ModifierFlags.STATIC_MASK;
}
}
else if (((PsiClassStub)parent).isEnum()) {
if (!(grandParent instanceof PsiFileStub)) {
packed |= ModifierFlags.STATIC_MASK;
}
boolean isFinal = true;
final List<LighterASTNode> enumConstants = LightTreeUtil.getChildrenOfType(tree, modListOwner, JavaElementType.ENUM_CONSTANT);
for (final LighterASTNode constant : enumConstants) {
if (LightTreeUtil.firstChildOfType(tree, constant, JavaElementType.ENUM_CONSTANT_INITIALIZER) != null) {
isFinal = false;
break;
}
}
if (isFinal) {
packed |= ModifierFlags.FINAL_MASK;
}
final List<LighterASTNode> methods = LightTreeUtil.getChildrenOfType(tree, modListOwner, JavaElementType.METHOD);
for (final LighterASTNode method : methods) {
final LighterASTNode mods = LightTreeUtil.requiredChildOfType(tree, method, JavaElementType.MODIFIER_LIST);
if (LightTreeUtil.firstChildOfType(tree, mods, JavaTokenType.ABSTRACT_KEYWORD) != null) {
packed |= ModifierFlags.ABSTRACT_MASK;
break;
}
}
}
}
else if (parent instanceof PsiMethodStub) {
if (grandParent instanceof PsiClassStub && ((PsiClassStub)grandParent).isInterface()) {
packed |= ModifierFlags.PUBLIC_MASK;
packed |= ModifierFlags.ABSTRACT_MASK;
}
}
else if (parent instanceof PsiFieldStub) {
if (parent.getStubType() == JavaElementType.ENUM_CONSTANT ||
grandParent instanceof PsiClassStub && ((PsiClassStub)grandParent).isInterface()) {
packed |= ModifierFlags.PUBLIC_MASK;
packed |= ModifierFlags.STATIC_MASK;
packed |= ModifierFlags.FINAL_MASK;
}
}
}
for (final LighterASTNode child : tree.getChildren(modList)) {
final int flag = ModifierFlags.KEYWORD_TO_MODIFIER_FLAG_MAP.get(child.getTokenType());
if (flag != 0) {
packed |= flag;
}
}
if ((packed & ModifierFlags.DEFENDER_MASK) != 0) {
packed &= ~ModifierFlags.ABSTRACT_MASK;
}
if ((packed & (ModifierFlags.PRIVATE_MASK | ModifierFlags.PROTECTED_MASK | ModifierFlags.PUBLIC_MASK)) == 0) {
packed |= ModifierFlags.PACKAGE_LOCAL_MASK;
}
return packed;
}
示例6: createStub
import com.intellij.psi.impl.source.tree.LightTreeUtil; //导入方法依赖的package包/类
@Override
public PsiJavaModuleStub createStub(LighterAST tree, LighterASTNode node, StubElement parentStub)
{
LighterASTNode ref = LightTreeUtil.requiredChildOfType(tree, node, JavaElementType.MODULE_REFERENCE);
return new PsiJavaModuleStubImpl(parentStub, JavaSourceUtil.getReferenceText(tree, ref));
}