IDEA-123484: trait -> type_definitions token set

This commit is contained in:
Max Medvedev
2014-05-16 19:30:07 +04:00
parent c4764e6787
commit 1f6e60a707
6 changed files with 11 additions and 11 deletions
@@ -353,7 +353,7 @@ public class GroovySpacingProcessor extends GroovyElementVisitor {
else if (myType2 == GroovyElementTypes.PACKAGE_DEFINITION) {
myResult = Spacing.createSpacing(0, 0, mySettings.BLANK_LINES_BEFORE_PACKAGE + 1, mySettings.KEEP_LINE_BREAKS, keepBlankLines());
}
else if (isLeftOrRight(GroovyElementTypes.TYPE_DEFINITION_TYPES)) {
else if (isLeftOrRight(TokenSets.TYPE_DEFINITIONS)) {
if (myType1 == GROOVY_DOC_COMMENT) {
createLF(true);
}
@@ -253,7 +253,7 @@ public class GroovyWrappingProcessor {
}
private final TokenSet ANNOTATION_CONTAINERS = TokenSet.create(
GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION,
GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.INTERFACE_DEFINITION, GroovyElementTypes.ENUM_DEFINITION, GroovyElementTypes.TRAIT_DEFINITION,
GroovyElementTypes.ANNOTATION_DEFINITION,
GroovyElementTypes.METHOD_DEFINITION, GroovyElementTypes.CONSTRUCTOR_DEFINITION,
GroovyElementTypes.VARIABLE_DEFINITION,
@@ -264,7 +264,7 @@ public class GroovyWrappingProcessor {
private int getAnnotationsWrapType(ASTNode modifierList) {
final IElementType containerType = modifierList.getTreeParent().getElementType();
if (GroovyElementTypes.TYPE_DEFINITION_TYPES.contains(containerType)) {
if (TokenSets.TYPE_DEFINITIONS.contains(containerType)) {
return mySettings.CLASS_ANNOTATION_WRAP;
}
@@ -300,7 +300,9 @@ public abstract class TokenSets {
GroovyElementTypes.DISJUNCTION_TYPE_ELEMENT);
public static final TokenSet TYPE_DEFINITIONS = TokenSet.create(GroovyElementTypes.CLASS_DEFINITION, GroovyElementTypes.ENUM_DEFINITION,
public static final TokenSet TYPE_DEFINITIONS = TokenSet.create(GroovyElementTypes.CLASS_DEFINITION,
GroovyElementTypes.ENUM_DEFINITION,
GroovyElementTypes.INTERFACE_DEFINITION,
GroovyElementTypes.ANNOTATION_DEFINITION);
GroovyElementTypes.ANNOTATION_DEFINITION,
GroovyElementTypes.TRAIT_DEFINITION);
}
@@ -18,7 +18,6 @@ package org.jetbrains.plugins.groovy.lang.parser;
import com.intellij.lang.ASTNode;
import com.intellij.psi.stubs.*;
import com.intellij.psi.tree.TokenSet;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyFileType;
@@ -117,8 +116,6 @@ public interface GroovyElementTypes extends GroovyTokenTypes, GroovyDocElementTy
}
};
TokenSet TYPE_DEFINITION_TYPES = TokenSet.create(CLASS_DEFINITION, INTERFACE_DEFINITION, ENUM_DEFINITION, ANNOTATION_DEFINITION);
GrStubElementType<GrFieldStub, GrEnumConstant> ENUM_CONSTANT = new GrEnumConstantElementType();
GrStubElementType<GrFieldStub, GrField> FIELD = new GrFieldElementType();
GrMethodElementType METHOD_DEFINITION = new GrMethodElementType("method definition") {
@@ -30,6 +30,7 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
import org.jetbrains.plugins.groovy.lang.lexer.TokenSets;
import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner;
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
@@ -91,10 +92,10 @@ public abstract class GroovyFileBaseImpl extends PsiFileBase implements GroovyFi
public GrTypeDefinition[] getTypeDefinitions() {
final StubElement<?> stub = getStub();
if (stub != null) {
return stub.getChildrenByType(GroovyElementTypes.TYPE_DEFINITION_TYPES, GrTypeDefinition.ARRAY_FACTORY);
return stub.getChildrenByType(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY);
}
return calcTreeElement().getChildrenAsPsiElements(GroovyElementTypes.TYPE_DEFINITION_TYPES, GrTypeDefinition.ARRAY_FACTORY);
return calcTreeElement().getChildrenAsPsiElements(TokenSets.TYPE_DEFINITIONS, GrTypeDefinition.ARRAY_FACTORY);
}
@Override
@@ -112,7 +112,7 @@ public abstract class GrTypeDefinitionBodyBase extends GrStubElementBase<EmptySt
@Override
public PsiClass[] getInnerClasses() {
return getStubOrPsiChildren(GroovyElementTypes.TYPE_DEFINITION_TYPES, PsiClass.ARRAY_FACTORY);
return getStubOrPsiChildren(TokenSets.TYPE_DEFINITIONS, PsiClass.ARRAY_FACTORY);
}
@Override