diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java index 2a5098803d01..37e49def2526 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/ExtendsListBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import com.intellij.lang.ASTNode; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.formatter.FormatterUtil; import com.intellij.psi.impl.source.tree.ElementType; +import com.intellij.psi.impl.source.tree.JavaElementType; import java.util.ArrayList; import java.util.List; @@ -78,9 +79,9 @@ public class ExtendsListBlock extends AbstractJavaBlock{ } private boolean alignList() { - if (myNode.getElementType() == ElementType.EXTENDS_LIST || myNode.getElementType() == ElementType.IMPLEMENTS_LIST) { + if (myNode.getElementType() == JavaElementType.EXTENDS_LIST || myNode.getElementType() == JavaElementType.IMPLEMENTS_LIST) { return mySettings.ALIGN_MULTILINE_EXTENDS_LIST; - } else if (myNode.getElementType() == ElementType.THROWS_LIST) { + } else if (myNode.getElementType() == JavaElementType.THROWS_LIST) { return mySettings.ALIGN_MULTILINE_THROWS_LIST; } return false; diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/LabeledJavaBlock.java b/java/java-impl/src/com/intellij/psi/formatter/java/LabeledJavaBlock.java index c354bcc3de86..c3f0af11b33e 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/LabeledJavaBlock.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/LabeledJavaBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.formatting.*; import com.intellij.formatting.alignment.AlignmentStrategy; import com.intellij.lang.ASTNode; import com.intellij.openapi.fileTypes.StdFileTypes; +import com.intellij.psi.JavaTokenType; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.formatter.FormatterUtil; import com.intellij.psi.impl.source.tree.ElementType; @@ -45,7 +46,7 @@ public class LabeledJavaBlock extends AbstractJavaBlock{ while (child != null) { if (!FormatterUtil.containsWhiteSpacesOnly(child) && child.getTextLength() > 0){ result.add(createJavaBlock(child, mySettings, currentIndent, currentWrap, AlignmentStrategy.getNullStrategy())); - if (child.getElementType() == ElementType.COLON) { + if (child.getElementType() == JavaTokenType.COLON) { currentIndent = Indent.getNoneIndent(); currentWrap =Wrap.createWrap(WrapType.ALWAYS, true); } diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/WrappingStrategy.java b/java/java-impl/src/com/intellij/psi/formatter/java/WrappingStrategy.java index 2429bc0212cc..e4d283edccb0 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/WrappingStrategy.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/WrappingStrategy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.psi.formatter.java; import com.intellij.formatting.Wrap; +import com.intellij.psi.JavaTokenType; import com.intellij.psi.tree.IElementType; import com.intellij.psi.impl.source.tree.ElementType; @@ -32,7 +33,7 @@ public abstract class WrappingStrategy { return new WrappingStrategy(wrap) { @Override protected boolean shouldWrap(final IElementType type) { - return type != ElementType.COMMA && type != ElementType.SEMICOLON; + return type != JavaTokenType.COMMA && type != JavaTokenType.SEMICOLON; } }; } diff --git a/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java b/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java index 6f5fb24af9a8..52ea316861c6 100644 --- a/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java +++ b/java/java-impl/src/com/intellij/psi/formatter/java/wrap/impl/JavaChildWrapArranger.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -136,7 +136,7 @@ public class JavaChildWrapArranger { } if (role == ChildRole.LOOP_BODY) { final boolean dontWrap = (childType == JavaElementType.CODE_BLOCK || childType == JavaElementType.BLOCK_STATEMENT) && - settings.BRACE_STYLE == CodeStyleSettings.END_OF_LINE; + settings.BRACE_STYLE == CommonCodeStyleSettings.END_OF_LINE; return Wrap.createWrap(dontWrap ? WrapType.NONE : WrapType.NORMAL, true); } else { diff --git a/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java b/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java index c1b65eccdccf..8e52d775a846 100644 --- a/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java +++ b/java/java-impl/src/com/intellij/psi/impl/search/AnnotatedPackagesSearcher.java @@ -86,7 +86,7 @@ public class AnnotatedPackagesSearcher implements QueryExecutor() { @Override public boolean process(final PsiFile psiFile) { diff --git a/java/java-impl/src/com/intellij/psi/impl/search/JavaIndexPatternBuilder.java b/java/java-impl/src/com/intellij/psi/impl/search/JavaIndexPatternBuilder.java index f404c401ae6f..50005842b25e 100644 --- a/java/java-impl/src/com/intellij/psi/impl/search/JavaIndexPatternBuilder.java +++ b/java/java-impl/src/com/intellij/psi/impl/search/JavaIndexPatternBuilder.java @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; */ public class JavaIndexPatternBuilder implements IndexPatternBuilder { public static final TokenSet XML_DATA_CHARS = TokenSet.create(XmlTokenType.XML_DATA_CHARACTERS); - public static final TokenSet XML_COMMENT_BIT_SET = TokenSet.create(XmlElementType.XML_COMMENT_CHARACTERS); + public static final TokenSet XML_COMMENT_BIT_SET = TokenSet.create(XmlTokenType.XML_COMMENT_CHARACTERS); @Override @Nullable diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/ImportsFormatter.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/ImportsFormatter.java index 4e2f61db2624..4e81caef937b 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/ImportsFormatter.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/ImportsFormatter.java @@ -134,7 +134,7 @@ public class ImportsFormatter extends XmlRecursiveElementVisitor { private static ASTNode findValueToken(final ASTNode node) { ASTNode child = node.getFirstChildNode(); while (child != null){ - if (child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN) return child; + if (child.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) return child; child = child.getTreeNext(); } return null; diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/PsiBasedFormatterModelWithShiftIndentInside.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/PsiBasedFormatterModelWithShiftIndentInside.java index a819cbe3ca14..9782b5630500 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/PsiBasedFormatterModelWithShiftIndentInside.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/PsiBasedFormatterModelWithShiftIndentInside.java @@ -35,6 +35,7 @@ import com.intellij.psi.formatter.PsiBasedFormattingModel; import com.intellij.psi.impl.source.tree.TreeUtil; import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlElementType; +import com.intellij.psi.xml.XmlTokenType; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -96,7 +97,7 @@ public class PsiBasedFormatterModelWithShiftIndentInside extends PsiBasedFormatt } @NonNls final String cdataEndMarker = "]]>"; - if(type == XmlElementType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) { + if(type == XmlTokenType.XML_CDATA_END && whiteSpace.indexOf(cdataEndMarker) == -1) { final ASTNode at = findElementAt(prevNode.getStartOffset()); if (at != null && at.getPsi() instanceof PsiWhiteSpace) { diff --git a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java index c4024838e8af..5e4e42e66410 100644 --- a/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java +++ b/java/java-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/JavaClassReference.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -518,7 +518,6 @@ public class JavaClassReference extends GenericReference implements PsiJavaRefer return list; } - @NotNull public void processSubclassVariants(@NotNull PsiPackage context, @NotNull String[] extendClasses, Consumer result) { GlobalSearchScope packageScope = PackageScope.packageScope(context, true); GlobalSearchScope scope = myJavaClassReferenceSet.getProvider().getScope(getElement().getProject()); diff --git a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java index 0651e81a150b..484460760a56 100644 --- a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java +++ b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java @@ -362,7 +362,7 @@ public class LambdaUtil { } final PsiParameter[] lambdaParams = lambdaExpression.getParameterList().getParameters(); if (lambdaParams.length != methodParameters.length) return false; - final boolean[] independent = new boolean[]{true}; + final boolean[] independent = {true}; final PsiMethod interfaceMethod = getFunctionalInterfaceMethod(functionalInterfaceType); if (interfaceMethod == null) return false; final TypeParamsChecker paramsChecker = new TypeParamsChecker(lambdaExpression); diff --git a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java index 4884cb3c7206..c6f57a53ddd8 100644 --- a/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/controlFlow/ControlFlowUtil.java @@ -369,7 +369,8 @@ public class ControlFlowUtil { return offset; } - public static final Class[] DEFAULT_EXIT_STATEMENTS_CLASSES = new Class[]{PsiReturnStatement.class, PsiBreakStatement.class, PsiContinueStatement.class}; + public static final Class[] DEFAULT_EXIT_STATEMENTS_CLASSES = + {PsiReturnStatement.class, PsiBreakStatement.class, PsiContinueStatement.class}; private static PsiStatement findStatement(ControlFlow flow, int offset) { PsiElement element = flow.getElement(offset); @@ -675,7 +676,7 @@ public class ControlFlowUtil { } public static Object[] getAllWorldProblemsAtOnce(final ControlFlow flow) { - InstructionClientVisitor[] visitors = new InstructionClientVisitor[]{ + InstructionClientVisitor[] visitors = { new ReturnPresentClientVisitor(flow), new UnreachableStatementClientVisitor(flow), new ReadBeforeWriteClientVisitor(flow, true), diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java index 43549c7dc40c..4c3ad50c2259 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/PsiDocMethodOrFieldRef.java @@ -189,7 +189,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo @Nullable private PsiClass getScope(){ - if (getFirstChildNode().getElementType() == ElementType.DOC_REFERENCE_HOLDER) { + if (getFirstChildNode().getElementType() == JavaDocElementType.DOC_REFERENCE_HOLDER) { final PsiElement firstChildPsi = SourceTreeToPsiMap.treeElementToPsi(getFirstChildNode().getFirstChildNode()); if (firstChildPsi instanceof PsiJavaCodeReferenceElement) { PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement)firstChildPsi; @@ -312,7 +312,7 @@ public class PsiDocMethodOrFieldRef extends CompositePsiElement implements PsiDo } final PsiElement child = getFirstChild(); - if (containingClass != null && child != null && child.getNode().getElementType() == ElementType.DOC_REFERENCE_HOLDER) { + if (containingClass != null && child != null && child.getNode().getElementType() == JavaDocElementType.DOC_REFERENCE_HOLDER) { final PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement) child.getFirstChild(); assert referenceElement != null; referenceElement.bindToElement(containingClass); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/SeeDocTagInfo.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/SeeDocTagInfo.java index 45e8ddbd7edf..287afdc18f6d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/SeeDocTagInfo.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/javadoc/SeeDocTagInfo.java @@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.javadoc; import com.intellij.pom.java.LanguageLevel; import com.intellij.psi.*; +import com.intellij.psi.impl.source.tree.JavaElementType; import com.intellij.psi.util.PsiUtil; import com.intellij.psi.impl.source.SourceTreeToPsiMap; import com.intellij.psi.impl.source.tree.ElementType; @@ -106,7 +107,7 @@ class SeeDocTagInfo implements JavadocTagInfo { PsiDocMethodOrFieldRef methodRef = (PsiDocMethodOrFieldRef) place.getParent(); final IElementType firstChildType = methodRef.getFirstChildNode().getElementType(); - if (firstChildType == ElementType.JAVA_CODE_REFERENCE || firstChildType == ElementType.REFERENCE_EXPRESSION) { + if (firstChildType == JavaElementType.JAVA_CODE_REFERENCE || firstChildType == JavaElementType.REFERENCE_EXPRESSION) { PsiJavaCodeReferenceElement referenceElement = (PsiJavaCodeReferenceElement) SourceTreeToPsiMap.treeElementToPsi(methodRef.getFirstChildNode()); final PsiElement element = referenceElement.resolve(); if (element instanceof PsiClass) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java index a9135d7102e0..b0eb406f2aef 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/ClassResolverProcessor.java @@ -32,7 +32,7 @@ import java.util.List; public class ClassResolverProcessor extends BaseScopeProcessor implements NameHint, ElementClassHint { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.resolve.ClassResolverProcessor"); - private static final String[] DEFAULT_PACKAGES = new String[]{CommonClassNames.DEFAULT_PACKAGE}; + private static final String[] DEFAULT_PACKAGES = {CommonClassNames.DEFAULT_PACKAGE}; private final String myClassName; private final PsiElement myPlace; diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/FieldElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/FieldElement.java index db0d189b72f8..bba320dee8b0 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/FieldElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/FieldElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ import org.jetbrains.annotations.NotNull; public class FieldElement extends CompositeElement{ public FieldElement() { - super(Constants.FIELD); + super(JavaElementType.FIELD); } protected FieldElement(@NotNull IElementType type) { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java index 048ae975beb1..31fb4bca8833 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,7 +46,7 @@ public class MethodElement extends CompositeElement implements Constants { @Override public TreeElement addInternal(TreeElement first, ASTNode last, ASTNode anchor, Boolean before) { - if (first == last && first.getElementType() == ElementType.CODE_BLOCK){ + if (first == last && first.getElementType() == JavaElementType.CODE_BLOCK){ ASTNode semicolon = findChildByRole(ChildRole.CLOSING_SEMICOLON); if (semicolon != null){ deleteChildInternal(semicolon); diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiBlockStatementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiBlockStatementImpl.java index b1dae5402eef..dbea6fd60fd8 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiBlockStatementImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiBlockStatementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.psi.JavaElementVisitor; import com.intellij.psi.PsiBlockStatement; import com.intellij.psi.PsiCodeBlock; import com.intellij.psi.PsiElementVisitor; +import com.intellij.psi.impl.source.tree.JavaElementType; import com.intellij.psi.tree.ChildRoleBase; import com.intellij.psi.impl.source.Constants; import com.intellij.psi.impl.source.tree.ChildRole; @@ -31,7 +32,7 @@ public class PsiBlockStatementImpl extends CompositePsiElement implements PsiBlo private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiBlockStatementImpl"); public PsiBlockStatementImpl() { - super(Constants.BLOCK_STATEMENT); + super(JavaElementType.BLOCK_STATEMENT); } @Override @@ -48,14 +49,14 @@ public class PsiBlockStatementImpl extends CompositePsiElement implements PsiBlo return null; case ChildRole.BLOCK: - return findChildByType(Constants.CODE_BLOCK); + return findChildByType(JavaElementType.CODE_BLOCK); } } @Override public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); - if (child.getElementType() == Constants.CODE_BLOCK) { + if (child.getElementType() == JavaElementType.CODE_BLOCK) { return ChildRole.BLOCK; } else { diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyExpressionImpl.java index 1cbe8457fbe4..93f802863217 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyExpressionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,12 @@ import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiExpression; import com.intellij.psi.PsiType; import com.intellij.psi.impl.source.Constants; +import com.intellij.psi.impl.source.tree.JavaElementType; import org.jetbrains.annotations.NotNull; public class PsiEmptyExpressionImpl extends ExpressionPsiElement implements PsiExpression{ public PsiEmptyExpressionImpl() { - super(Constants.EMPTY_EXPRESSION); + super(JavaElementType.EMPTY_EXPRESSION); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyStatementImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyStatementImpl.java index 40566a32ae9c..eb9661930cd0 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyStatementImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiEmptyStatementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,11 +20,12 @@ import com.intellij.psi.PsiElementVisitor; import com.intellij.psi.PsiEmptyStatement; import com.intellij.psi.impl.source.Constants; import com.intellij.psi.impl.source.tree.CompositePsiElement; +import com.intellij.psi.impl.source.tree.JavaElementType; import org.jetbrains.annotations.NotNull; public class PsiEmptyStatementImpl extends CompositePsiElement implements PsiEmptyStatement { public PsiEmptyStatementImpl() { - super(Constants.EMPTY_STATEMENT); + super(JavaElementType.EMPTY_STATEMENT); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiIdentifierImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiIdentifierImpl.java index e6d5d03fba5f..4627c70ef330 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiIdentifierImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiIdentifierImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import org.jetbrains.annotations.NotNull; public class PsiIdentifierImpl extends LeafPsiElement implements PsiIdentifier, PsiJavaToken { public PsiIdentifierImpl(CharSequence text) { - super(Constants.IDENTIFIER, text); + super(JavaTokenType.IDENTIFIER, text); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPostfixExpressionImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPostfixExpressionImpl.java index e2aeb4c13e09..059d8bc57acd 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPostfixExpressionImpl.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/PsiPostfixExpressionImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.*; import com.intellij.psi.impl.source.Constants; import com.intellij.psi.impl.source.tree.ChildRole; +import com.intellij.psi.impl.source.tree.JavaElementType; import com.intellij.psi.tree.IElementType; import com.intellij.psi.tree.ChildRoleBase; import org.jetbrains.annotations.NotNull; @@ -28,7 +29,7 @@ public class PsiPostfixExpressionImpl extends ExpressionPsiElement implements Ps private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.PsiPostfixExpressionImpl"); public PsiPostfixExpressionImpl() { - super(Constants.POSTFIX_EXPRESSION); + super(JavaElementType.POSTFIX_EXPRESSION); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterElement.java index f1f89583f9d0..4eb53de83de6 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -29,7 +29,7 @@ public class TypeParameterElement extends CompositeElement { private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.tree.java.TypeParameterElement"); public TypeParameterElement() { - super(ElementType.TYPE_PARAMETER); + super(JavaElementType.TYPE_PARAMETER); } @Override diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterExtendsBoundsListElement.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterExtendsBoundsListElement.java index b79c45be9bf0..bdc51157690c 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterExtendsBoundsListElement.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/TypeParameterExtendsBoundsListElement.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -103,7 +103,7 @@ public class TypeParameterExtendsBoundsListElement extends CompositeElement impl if (elType == AND) { return ChildRole.AMPERSAND_IN_BOUNDS_LIST; } - else if (elType == ElementType.JAVA_CODE_REFERENCE) { + else if (elType == JavaElementType.JAVA_CODE_REFERENCE) { return ChildRole.BASE_CLASS_REFERENCE; } else if (elType == JavaTokenType.EXTENDS_KEYWORD) { diff --git a/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaPresentationUtil.java b/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaPresentationUtil.java index 862cd97d5d70..69dcc967a298 100644 --- a/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaPresentationUtil.java +++ b/java/java-psi-impl/src/com/intellij/psi/presentation/java/JavaPresentationUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey; import com.intellij.openapi.util.Iconable; import com.intellij.psi.*; import com.intellij.psi.util.PsiFormatUtil; +import com.intellij.psi.util.PsiFormatUtilBase; import com.intellij.psi.util.PsiTreeUtil; import org.jetbrains.annotations.Nullable; @@ -37,8 +38,8 @@ public class JavaPresentationUtil { public String getPresentableText() { return PsiFormatUtil.formatMethod( psiMethod, - PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS, - PsiFormatUtil.SHOW_TYPE + PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS, + PsiFormatUtilBase.SHOW_TYPE ); } diff --git a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java index 22a3b81138e1..ea6614e41d0f 100644 --- a/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/ClsRepositoryUseTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ import com.intellij.ide.highlighter.JavaFileType; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ex.PathManagerEx; import com.intellij.openapi.diagnostic.Logger; -import com.intellij.openapi.projectRoots.impl.JavaSdkImpl; import com.intellij.openapi.roots.ModuleRootModificationUtil; import com.intellij.openapi.roots.OrderRootType; import com.intellij.openapi.util.io.FileUtil; @@ -555,7 +554,7 @@ public class ClsRepositoryUseTest extends PsiTestCase { assertEquals("java.util.Map.Entry", setTypeResolveResultElement.getQualifiedName()); final PsiTypeParameter[] typeParameters = setTypeResolveResultElement.getTypeParameters(); assertEquals(2, typeParameters.length); - PsiType[] mapParams = new PsiType[]{ + PsiType[] mapParams = { setTypeResolveResult.getSubstitutor().substitute(typeParameters[0]), setTypeResolveResult.getSubstitutor().substitute(typeParameters[1]) }; diff --git a/java/java-tests/testSrc/com/intellij/psi/GenericsTestCase.java b/java/java-tests/testSrc/com/intellij/psi/GenericsTestCase.java index 11c14e49e443..a9ca3405cb4b 100644 --- a/java/java-tests/testSrc/com/intellij/psi/GenericsTestCase.java +++ b/java/java-tests/testSrc/com/intellij/psi/GenericsTestCase.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi; import com.intellij.openapi.application.ApplicationManager; @@ -23,7 +38,7 @@ public abstract class GenericsTestCase extends PsiTestCase { protected void setupGenericSampleClasses() { final String commonPath = PathManagerEx.getTestDataPath().replace(File.separatorChar, '/') + "/psi/types/src"; - final VirtualFile[] commonRoot = new VirtualFile[] { null }; + final VirtualFile[] commonRoot = { null }; ApplicationManager.getApplication().runWriteAction(new Runnable() { @Override public void run() { diff --git a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java index 2a89e218cded..6e58fee905ed 100644 --- a/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/MiscPsiTest.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi; import com.intellij.openapi.application.ApplicationManager; @@ -44,7 +59,7 @@ public class MiscPsiTest extends LightCodeInsightFixtureTestCase { public void testCopyBinaryFile() throws Exception{ VirtualFile vFile = myFixture.addFileToProject("Test.xxx", "").getVirtualFile(); - final byte[] bytes = new byte[]{12,34,56,78,90,45,83,0x22,(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xee}; + final byte[] bytes = {12,34,56,78,90,45,83,0x22,(byte)0xff, (byte)0xff, (byte)0xff, (byte)0xee}; vFile.setBinaryContent(bytes); VirtualFile vDir = myFixture.getTempDirFixture().findOrCreateDir("dir"); diff --git a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/InvalidateClassFileTest.java b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/InvalidateClassFileTest.java index 94b1648bf5ae..85558dcf6ac4 100644 --- a/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/InvalidateClassFileTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/impl/file/impl/InvalidateClassFileTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -60,7 +60,7 @@ public class InvalidateClassFileTest extends PsiTestCase { PsiClass clazz = getJavaFacade().findClass("Clazz", GlobalSearchScope.allScope(myProject)); assertNotNull(clazz); - final boolean[] notified = new boolean[] {false}; + final boolean[] notified = {false}; final PsiTreeChangeAdapter listener = new PsiTreeChangeAdapter() { @Override public void childRemoved(@NotNull PsiTreeChangeEvent event) { diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java index 56fafd0ad4fa..9fdfc4925ca9 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/CodeStyleSettingsCustomizable.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -232,49 +232,49 @@ public interface CodeStyleSettingsCustomizable { String WRAPPING_MODIFIER_LIST = ApplicationBundle.message("wrapping.modifier.list"); String WRAPPING_ASSERT_STATEMENT = ApplicationBundle.message("wrapping.assert.statement"); - String[] WRAP_OPTIONS = new String[]{ + String[] WRAP_OPTIONS = { ApplicationBundle.message("wrapping.do.not.wrap"), ApplicationBundle.message("wrapping.wrap.if.long"), ApplicationBundle.message("wrapping.chop.down.if.long"), ApplicationBundle.message("wrapping.wrap.always") }; - String[] WRAP_OPTIONS_FOR_SINGLETON = new String[]{ + String[] WRAP_OPTIONS_FOR_SINGLETON = { ApplicationBundle.message("wrapping.do.not.wrap"), ApplicationBundle.message("wrapping.wrap.if.long"), ApplicationBundle.message("wrapping.wrap.always") }; - int[] WRAP_VALUES = new int[]{CodeStyleSettings.DO_NOT_WRAP, - CodeStyleSettings.WRAP_AS_NEEDED, - CodeStyleSettings.WRAP_AS_NEEDED | - CodeStyleSettings.WRAP_ON_EVERY_ITEM, - CodeStyleSettings.WRAP_ALWAYS}; + int[] WRAP_VALUES = {CommonCodeStyleSettings.DO_NOT_WRAP, + CommonCodeStyleSettings.WRAP_AS_NEEDED, + CommonCodeStyleSettings.WRAP_AS_NEEDED | + CommonCodeStyleSettings.WRAP_ON_EVERY_ITEM, + CommonCodeStyleSettings.WRAP_ALWAYS}; - int[] WRAP_VALUES_FOR_SINGLETON = new int[]{CodeStyleSettings.DO_NOT_WRAP, - CodeStyleSettings.WRAP_AS_NEEDED, - CodeStyleSettings.WRAP_ALWAYS}; - String[] BRACE_OPTIONS = new String[]{ + int[] WRAP_VALUES_FOR_SINGLETON = {CommonCodeStyleSettings.DO_NOT_WRAP, + CommonCodeStyleSettings.WRAP_AS_NEEDED, + CommonCodeStyleSettings.WRAP_ALWAYS}; + String[] BRACE_OPTIONS = { ApplicationBundle.message("wrapping.force.braces.do.not.force"), ApplicationBundle.message("wrapping.force.braces.when.multiline"), ApplicationBundle.message("wrapping.force.braces.always") }; - int[] BRACE_VALUES = new int[]{ - CodeStyleSettings.DO_NOT_FORCE, - CodeStyleSettings.FORCE_BRACES_IF_MULTILINE, - CodeStyleSettings.FORCE_BRACES_ALWAYS + int[] BRACE_VALUES = { + CommonCodeStyleSettings.DO_NOT_FORCE, + CommonCodeStyleSettings.FORCE_BRACES_IF_MULTILINE, + CommonCodeStyleSettings.FORCE_BRACES_ALWAYS }; - String[] BRACE_PLACEMENT_OPTIONS = new String[]{ + String[] BRACE_PLACEMENT_OPTIONS = { ApplicationBundle.message("wrapping.brace.placement.end.of.line"), ApplicationBundle.message("wrapping.brace.placement.next.line.if.wrapped"), ApplicationBundle.message("wrapping.brace.placement.next.line"), ApplicationBundle.message("wrapping.brace.placement.next.line.shifted"), ApplicationBundle.message("wrapping.brace.placement.next.line.each.shifted") }; - int[] BRACE_PLACEMENT_VALUES = new int[]{ - CodeStyleSettings.END_OF_LINE, - CodeStyleSettings.NEXT_LINE_IF_WRAPPED, - CodeStyleSettings.NEXT_LINE, - CodeStyleSettings.NEXT_LINE_SHIFTED, - CodeStyleSettings.NEXT_LINE_SHIFTED2 + int[] BRACE_PLACEMENT_VALUES = { + CommonCodeStyleSettings.END_OF_LINE, + CommonCodeStyleSettings.NEXT_LINE_IF_WRAPPED, + CommonCodeStyleSettings.NEXT_LINE, + CommonCodeStyleSettings.NEXT_LINE_SHIFTED, + CommonCodeStyleSettings.NEXT_LINE_SHIFTED2 }; void showAllStandardOptions(); diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/PredefinedCodeStyle.java b/platform/lang-api/src/com/intellij/psi/codeStyle/PredefinedCodeStyle.java index 9c1cc19fb606..6295ad511835 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/PredefinedCodeStyle.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/PredefinedCodeStyle.java @@ -27,7 +27,7 @@ public abstract class PredefinedCodeStyle { public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.predefinedCodeStyle"); - public static final PredefinedCodeStyle[] EMPTY_ARRAY = new PredefinedCodeStyle[]{}; + public static final PredefinedCodeStyle[] EMPTY_ARRAY = {}; private final String myName; private final Language myLanguage; diff --git a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/ArrangementSettingsToken.java b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/ArrangementSettingsToken.java index 7bad62d0d4fa..f51a91315829 100644 --- a/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/ArrangementSettingsToken.java +++ b/platform/lang-api/src/com/intellij/psi/codeStyle/arrangement/std/ArrangementSettingsToken.java @@ -47,7 +47,7 @@ public class ArrangementSettingsToken implements Comparable(reference.getFileReferenceSet().getReferenceCompletionFilter(), collector).process( - reference.getOriginalFile(fileSystemItem)); + FileReference.getOriginalFile(fileSystemItem)); } }; for (PsiFileSystemItem context : reference.getContexts()) { diff --git a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/FilePackageSetParserExtension.java b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/FilePackageSetParserExtension.java index 93ef8dea99b3..94dfa7efe22f 100644 --- a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/FilePackageSetParserExtension.java +++ b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/FilePackageSetParserExtension.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ package com.intellij.psi.search.scope.packageSet; import com.intellij.analysis.AnalysisScopeBundle; import com.intellij.lexer.Lexer; +import com.intellij.psi.TokenType; import com.intellij.psi.search.scope.packageSet.lexer.ScopeTokenTypes; import org.jetbrains.annotations.Nullable; @@ -77,7 +78,7 @@ public class FilePackageSetParserExtension implements PackageSetParserExtension wasIdentifier = false; pattern.append("."); } - else if (lexer.getTokenType() == ScopeTokenTypes.WHITE_SPACE) { + else if (lexer.getTokenType() == TokenType.WHITE_SPACE) { wasIdentifier = false; pattern.append(" "); } diff --git a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java index c8ee5e9ec780..1a3e45d72df7 100644 --- a/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/search/scope/packageSet/PackageSetFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.analysis.AnalysisScopeBundle; import com.intellij.lexer.Lexer; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.extensions.Extensions; +import com.intellij.psi.TokenType; import com.intellij.psi.search.scope.packageSet.lexer.ScopeTokenTypes; import com.intellij.psi.search.scope.packageSet.lexer.ScopesLexer; import org.jetbrains.annotations.Nullable; @@ -121,7 +122,7 @@ public class PackageSetFactoryImpl extends PackageSetFactory { } else if (myLexer.getTokenType() == ScopeTokenTypes.ASTERISK) { pattern.append("*"); } else if (myLexer.getTokenType() == ScopeTokenTypes.IDENTIFIER || - myLexer.getTokenType() == ScopeTokenTypes.WHITE_SPACE || + myLexer.getTokenType() == TokenType.WHITE_SPACE || myLexer.getTokenType() == ScopeTokenTypes.INTEGER_LITERAL ) { pattern.append(getTokenText()); } else if (myLexer.getTokenType() == ScopeTokenTypes.DOT) { diff --git a/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java b/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java index ea35cfd1f3fd..9217168562b6 100644 --- a/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java +++ b/platform/platform-tests/testSrc/com/intellij/psi/impl/meta/MetaRegistryTest.java @@ -1,5 +1,17 @@ /* - * Copyright (c) 2000-2006 JetBrains s.r.o. All Rights Reserved. + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package com.intellij.psi.impl.meta; @@ -21,7 +33,7 @@ import org.jetbrains.annotations.NonNls; public class MetaRegistryTest extends LightPlatformTestCase { public void testChangingMetaData() throws Throwable { - final boolean[] flag = new boolean[]{false}; + final boolean[] flag = {false}; MetaRegistry.addMetadataBinding(new ElementFilter() { @Override public boolean isAcceptable(Object element, PsiElement context) { diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java index 0eb42a2f0fc0..b95867f2e232 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractSyntheticBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import com.intellij.psi.templateLanguages.OuterLanguageElement; import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlElementType; import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlTokenType; import java.util.List; @@ -77,7 +78,7 @@ public abstract class AbstractSyntheticBlock implements Block { } private boolean isEndOfTag() { - return myEndTreeNode.getElementType() == XmlElementType.XML_TAG_END; + return myEndTreeNode.getElementType() == XmlTokenType.XML_TAG_END; } public Wrap getWrap() { @@ -93,15 +94,15 @@ public abstract class AbstractSyntheticBlock implements Block { } protected static boolean isXmlTagName(final IElementType type1, final IElementType type2) { - if (type1 == XmlElementType.XML_NAME && type2 == XmlElementType.XML_TAG_END) return true; - if (type1 == XmlElementType.XML_NAME && type2 == XmlElementType.XML_EMPTY_ELEMENT_END) return true; - if (type1 == XmlElementType.XML_ATTRIBUTE && type2 == XmlElementType.XML_EMPTY_ELEMENT_END) return true; - return type1 == XmlElementType.XML_ATTRIBUTE && type2 == XmlElementType.XML_TAG_END; + if (type1 == XmlTokenType.XML_NAME && type2 == XmlTokenType.XML_TAG_END) return true; + if (type1 == XmlTokenType.XML_NAME && type2 == XmlTokenType.XML_EMPTY_ELEMENT_END) return true; + if (type1 == XmlElementType.XML_ATTRIBUTE && type2 == XmlTokenType.XML_EMPTY_ELEMENT_END) return true; + return type1 == XmlElementType.XML_ATTRIBUTE && type2 == XmlTokenType.XML_TAG_END; } public boolean endsWithText() { return myEndTreeNode.getElementType() == XmlElementType.XML_TEXT || - myEndTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS; + myEndTreeNode.getElementType() == XmlTokenType.XML_DATA_CHARACTERS; } public boolean isTagDescription() { @@ -110,13 +111,13 @@ public abstract class AbstractSyntheticBlock implements Block { } private static boolean isTagDescription(final ASTNode startTreeNode) { - return startTreeNode.getElementType() == XmlElementType.XML_START_TAG_START || - startTreeNode.getElementType() == XmlElementType.XML_END_TAG_START; + return startTreeNode.getElementType() == XmlTokenType.XML_START_TAG_START || + startTreeNode.getElementType() == XmlTokenType.XML_END_TAG_START; } public boolean startsWithText() { return myStartTreeNode.getElementType() == XmlElementType.XML_TEXT || - myStartTreeNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS; + myStartTreeNode.getElementType() == XmlTokenType.XML_DATA_CHARACTERS; } public boolean endsWithTextElement() { @@ -199,8 +200,8 @@ public abstract class AbstractSyntheticBlock implements Block { } public boolean containsCDATA() { - return myStartTreeNode.getElementType() == XmlElementType.XML_CDATA_START && - myEndTreeNode.getElementType() == XmlElementType.XML_CDATA_END; + return myStartTreeNode.getElementType() == XmlTokenType.XML_CDATA_START && + myEndTreeNode.getElementType() == XmlTokenType.XML_CDATA_END; } public boolean endsWithCDATA() { diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java index 778af86c53f9..1f8e2ef380ae 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/AbstractXmlBlock.java @@ -161,8 +161,8 @@ public abstract class AbstractXmlBlock extends AbstractBlock { return Wrap.createWrap(myXmlFormattingPolicy.getWrappingTypeForTagBegin(tag), true); } - protected @Nullable + protected ASTNode processChild(List result, final ASTNode child, final Wrap wrap, @@ -264,7 +264,7 @@ public abstract class AbstractXmlBlock extends AbstractBlock { } private ASTNode processAllChildrenFrom(final List result, - final @NotNull ASTNode child, + @NotNull final ASTNode child, final Wrap wrap, final Alignment alignment, final Indent indent) { diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java b/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java index ee25b3f67752..d8a865ef44e6 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/HtmlPolicy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ import com.intellij.psi.impl.source.tree.LeafElement; import com.intellij.psi.xml.XmlAttribute; import com.intellij.psi.xml.XmlElementType; import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlTokenType; import java.util.HashMap; import java.util.Map; @@ -50,7 +51,7 @@ public class HtmlPolicy extends XmlFormattingPolicy { return false; } - if (firstChild.getNode().getElementType() != XmlElementType.XML_START_TAG_START) { + if (firstChild.getNode().getElementType() != XmlTokenType.XML_START_TAG_START) { return false; } diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java index 10a20674bb89..3a5ba30d9c78 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/SyntheticBlock.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -69,15 +69,15 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea return Spacing.getReadOnlySpacing(); } - if (type1 == XmlElementType.XML_CDATA_START || type2 == XmlElementType.XML_CDATA_END) { + if (type1 == XmlTokenType.XML_CDATA_START || type2 == XmlTokenType.XML_CDATA_END) { if (myXmlFormattingPolicy.getKeepWhiteSpacesInsideCDATA()) { return Spacing.getReadOnlySpacing(); } - if (type1 == XmlElementType.XML_CDATA_START && type2 == XmlElementType.XML_CDATA_END) { + if (type1 == XmlTokenType.XML_CDATA_START && type2 == XmlTokenType.XML_CDATA_END) { return Spacing.createSpacing(0, 0, 0, myXmlFormattingPolicy.getShouldKeepLineBreaks(), myXmlFormattingPolicy.getKeepBlankLines()); } - if (type1 == XmlElementType.XML_CDATA_START && child2 instanceof AnotherLanguageBlockWrapper || - type2 == XmlElementType.XML_CDATA_END && child1 instanceof AnotherLanguageBlockWrapper) { + if (type1 == XmlTokenType.XML_CDATA_START && child2 instanceof AnotherLanguageBlockWrapper || + type2 == XmlTokenType.XML_CDATA_END && child1 instanceof AnotherLanguageBlockWrapper) { return Spacing.createSpacing(0, 0, 1, myXmlFormattingPolicy.getShouldKeepLineBreaks(), 0); } } @@ -106,7 +106,7 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea } } - if (type2 == XmlElementType.XML_EMPTY_ELEMENT_END && myXmlFormattingPolicy.addSpaceIntoEmptyTag()) { + if (type2 == XmlTokenType.XML_EMPTY_ELEMENT_END && myXmlFormattingPolicy.addSpaceIntoEmptyTag()) { return Spacing.createSpacing(1, 1, 0, myXmlFormattingPolicy.getShouldKeepLineBreaks(), myXmlFormattingPolicy.getKeepBlankLines()); @@ -185,8 +185,8 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea } private boolean shouldAddSpaceAroundTagName(final ASTNode node1, final ASTNode node2) { - if (node1.getElementType() == XmlElementType.XML_START_TAG_START && node1.textContains('%')) return true; - if (node2.getElementType() == XmlElementType.XML_EMPTY_ELEMENT_END && node2.textContains('%')) return true; + if (node1.getElementType() == XmlTokenType.XML_START_TAG_START && node1.textContains('%')) return true; + if (node2.getElementType() == XmlTokenType.XML_EMPTY_ELEMENT_END && node2.textContains('%')) return true; return myXmlFormattingPolicy.getShouldAddSpaceAroundTagName(); } @@ -208,7 +208,7 @@ public class SyntheticBlock extends AbstractSyntheticBlock implements Block, Rea protected boolean isTextFragment(final ASTNode node) { final ASTNode parent = node.getTreeParent(); return parent != null && parent.getElementType() == XmlElementType.XML_TEXT - || node.getElementType() == XmlElementType.XML_DATA_CHARACTERS + || node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS ; } diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java index c4d8889e9e50..d588d9c8d712 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/XmlBlock.java @@ -30,6 +30,7 @@ import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlDocument; import com.intellij.psi.xml.XmlElementType; import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlTokenType; import com.intellij.util.SmartList; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -143,8 +144,8 @@ public class XmlBlock extends AbstractXmlBlock { final ArrayList result = new ArrayList(3); ASTNode child = node.getFirstChildNode(); while (child != null) { - if (child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_START_DELIMITER || - child.getElementType() == XmlElementType.XML_ATTRIBUTE_VALUE_END_DELIMITER) { + if (child.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_START_DELIMITER || + child.getElementType() == XmlTokenType.XML_ATTRIBUTE_VALUE_END_DELIMITER) { result.add(new XmlBlock(child, null, null, formattingPolicy, null, null, isPreserveSpace())); } else if (!child.getPsi().getLanguage().isKindOf(XMLLanguage.INSTANCE) && containsOuterLanguageElement(child)) { @@ -247,7 +248,7 @@ public class XmlBlock extends AbstractXmlBlock { final ASTNode node2 = ((AbstractBlock)child2).getNode(); final IElementType type2 = node2.getElementType(); - if ((isXmlTag(node2) || type2 == XmlElementType.XML_END_TAG_START || type2 == XmlElementType.XML_TEXT) && myXmlFormattingPolicy + if ((isXmlTag(node2) || type2 == XmlTokenType.XML_END_TAG_START || type2 == XmlElementType.XML_TEXT) && myXmlFormattingPolicy .getShouldKeepWhiteSpaces()) { return Spacing.getReadOnlySpacing(); } @@ -272,7 +273,7 @@ public class XmlBlock extends AbstractXmlBlock { } private Spacing getSpacesInsideAttribute(final IElementType type1, final IElementType type2) { - if (type1 == XmlElementType.XML_EQ || type2 == XmlElementType.XML_EQ) { + if (type1 == XmlTokenType.XML_EQ || type2 == XmlTokenType.XML_EQ) { int spaces = myXmlFormattingPolicy.getShouldAddSpaceAroundEqualityInAttribute() ? 1 : 0; return Spacing .createSpacing(spaces, spaces, 0, myXmlFormattingPolicy.getShouldKeepLineBreaks(), myXmlFormattingPolicy.getKeepBlankLines()); @@ -283,7 +284,7 @@ public class XmlBlock extends AbstractXmlBlock { } private Spacing getSpacesInsideText(final IElementType type1, final IElementType type2) { - if (type1 == XmlElementType.XML_DATA_CHARACTERS && type2 == XmlElementType.XML_DATA_CHARACTERS) { + if (type1 == XmlTokenType.XML_DATA_CHARACTERS && type2 == XmlTokenType.XML_DATA_CHARACTERS) { return Spacing .createSpacing(1, 1, 0, myXmlFormattingPolicy.getShouldKeepLineBreaksInText(), myXmlFormattingPolicy.getKeepBlankLines()); } @@ -309,8 +310,8 @@ public class XmlBlock extends AbstractXmlBlock { } public boolean isTextElement() { - return myNode.getElementType() == XmlElementType.XML_TEXT || myNode.getElementType() == XmlElementType.XML_DATA_CHARACTERS || - myNode.getElementType() == XmlElementType.XML_CHAR_ENTITY_REF; + return myNode.getElementType() == XmlElementType.XML_TEXT || myNode.getElementType() == XmlTokenType.XML_DATA_CHARACTERS || + myNode.getElementType() == XmlTokenType.XML_CHAR_ENTITY_REF; } @Override diff --git a/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java b/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java index 248adb2ea33a..5fcb7fb9dcb3 100644 --- a/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java +++ b/xml/impl/src/com/intellij/psi/formatter/xml/XmlTagBlock.java @@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlElementType; import com.intellij.psi.xml.XmlTag; +import com.intellij.psi.xml.XmlTokenType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -67,13 +68,13 @@ public class XmlTagBlock extends AbstractXmlBlock{ Wrap wrap = chooseWrap(child, tagBeginWrap, attrWrap, textWrap); Alignment alignment = chooseAlignment(child, attrAlignment, textAlignment); - if (child.getElementType() == XmlElementType.XML_TAG_END) { + if (child.getElementType() == XmlTokenType.XML_TAG_END) { child = processChild(localResult,child, wrap, alignment, null); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList(1); insideTag = true; } - else if (child.getElementType() == XmlElementType.XML_START_TAG_START) { + else if (child.getElementType() == XmlTokenType.XML_START_TAG_START) { insideTag = false; if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); @@ -81,14 +82,14 @@ public class XmlTagBlock extends AbstractXmlBlock{ localResult = new ArrayList(1); child = processChild(localResult,child, wrap, alignment, null); } - else if (child.getElementType() == XmlElementType.XML_END_TAG_START) { + else if (child.getElementType() == XmlTokenType.XML_END_TAG_START) { insideTag = false; if (!localResult.isEmpty()) { result.add(createTagContentNode(localResult)); localResult = new ArrayList(1); } child = processChild(localResult,child, wrap, alignment, null); - } else if (child.getElementType() == XmlElementType.XML_EMPTY_ELEMENT_END) { + } else if (child.getElementType() == XmlTokenType.XML_EMPTY_ELEMENT_END) { child = processChild(localResult,child, wrap, alignment, null); result.add(createTagDescriptionNode(localResult)); localResult = new ArrayList(1); diff --git a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java index f0d3a014665d..0fe0ed599b7b 100644 --- a/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java +++ b/xml/impl/src/com/intellij/psi/impl/cache/impl/idCache/XHtmlFilterLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import com.intellij.psi.impl.cache.impl.OccurrenceConsumer; import com.intellij.psi.search.UsageSearchContext; import com.intellij.psi.tree.IElementType; import com.intellij.psi.xml.XmlElementType; +import com.intellij.psi.xml.XmlTokenType; public class XHtmlFilterLexer extends BaseFilterLexer { @@ -34,14 +35,15 @@ public class XHtmlFilterLexer extends BaseFilterLexer { public void advance() { final IElementType tokenType = myDelegate.getTokenType(); - if (tokenType == XmlElementType.XML_COMMENT_CHARACTERS) { + if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false); advanceTodoItemCountsInToken(); - } else if (tokenType == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN || - tokenType == XmlElementType.XML_NAME || - tokenType == XmlElementType.XML_TAG_NAME + } else if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN || + tokenType == XmlTokenType.XML_NAME || + tokenType == XmlTokenType.XML_TAG_NAME ) { - scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN, + scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, tokenType == + XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN, false); } else if (tokenType.getLanguage() != XMLLanguage.INSTANCE && tokenType.getLanguage() != Language.ANY diff --git a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java index 70cd87904c4d..d0600b52b34f 100644 --- a/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java +++ b/xml/tests/src/com/intellij/psi/formatter/XmlFormatterTestCase.java @@ -1,6 +1,22 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.formatter; import com.intellij.psi.codeStyle.CodeStyleSettings; +import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.formatter.xml.XmlCodeStyleSettings; /** @@ -17,8 +33,8 @@ public abstract class XmlFormatterTestCase extends FormatterTestCase{ xmlSettings.XML_KEEP_LINE_BREAKS_IN_TEXT = false; doTextTest("aaa\nbbb\nccc\nddd\n", "aaa bbb\n ccc ddd\n"); - settings.HTML_TEXT_WRAP = CodeStyleSettings.DO_NOT_WRAP; - xmlSettings.XML_TEXT_WRAP = CodeStyleSettings.DO_NOT_WRAP; + settings.HTML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; + xmlSettings.XML_TEXT_WRAP = CommonCodeStyleSettings.DO_NOT_WRAP; doTextTest("aaa\nbbb\nccc\nddd\n", "aaa bbb ccc ddd\n"); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java index 96985f406098..0b4d5c20b7e2 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/cache/impl/idCache/XmlFilterLexer.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -52,18 +52,18 @@ public class XmlFilterLexer extends BaseFilterLexer { public void advance() { final IElementType tokenType = myDelegate.getTokenType(); - if (tokenType == XmlElementType.XML_COMMENT_CHARACTERS) { + if (tokenType == XmlTokenType.XML_COMMENT_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_COMMENTS, false, false); advanceTodoItemCountsInToken(); } - if (tokenType == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN) { + if (tokenType == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, true, false); } - else if (tokenType == XmlElementType.XML_NAME || tokenType == XmlElementType.XML_DATA_CHARACTERS) { + else if (tokenType == XmlTokenType.XML_NAME || tokenType == XmlTokenType.XML_DATA_CHARACTERS) { scanWordsInToken(UsageSearchContext.IN_PLAIN_TEXT | UsageSearchContext.IN_FOREIGN_LANGUAGES, false, false); } - else if (tokenType == XmlElementType.XML_ENTITY_REF_TOKEN || tokenType == XmlElementType.XML_CHAR_ENTITY_REF) { + else if (tokenType == XmlTokenType.XML_ENTITY_REF_TOKEN || tokenType == XmlTokenType.XML_CHAR_ENTITY_REF) { scanWordsInToken(UsageSearchContext.IN_CODE, false, false); } else if (tokenType == XmlElementType.XML_TEXT) { diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlBuilderDriver.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlBuilderDriver.java index 0518f9d80929..e52d363717a0 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlBuilderDriver.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/parsing/xml/XmlBuilderDriver.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -111,14 +111,14 @@ public class XmlBuilderDriver { boolean afterSystem = false; for (int i = 0; i < tokenCount; i++) { LighterASTNode token = tokens.get()[i]; - if (token.getTokenType() == XmlElementType.XML_DOCTYPE_PUBLIC) { + if (token.getTokenType() == XmlTokenType.XML_DOCTYPE_PUBLIC) { afterPublic = true; } - else if (token.getTokenType() == XmlElementType.XML_DOCTYPE_SYSTEM) { + else if (token.getTokenType() == XmlTokenType.XML_DOCTYPE_SYSTEM) { afterSystem = true; } else if (token.getTokenType() != TokenType.WHITE_SPACE && token.getTokenType() != XmlElementType.XML_COMMENT) { - if (token.getTokenType() == XmlElementType.XML_ATTRIBUTE_VALUE_TOKEN) { + if (token.getTokenType() == XmlTokenType.XML_ATTRIBUTE_VALUE_TOKEN) { if (afterPublic) publicId = getTokenText(token); else if (afterSystem) systemId = getTokenText(token); } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java index 828e801d98a7..d65ea69662f7 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlAttlistDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,7 +41,7 @@ public class XmlAttlistDeclImpl extends XmlElementImpl implements XmlAttlistDecl public int getChildRole(ASTNode child) { LOG.assertTrue(child.getTreeParent() == this); - if (child.getElementType() == XmlElementType.XML_NAME) { + if (child.getElementType() == XmlTokenType.XML_NAME) { return XmlChildRole.XML_NAME; } else { @@ -78,6 +78,6 @@ public class XmlAttlistDeclImpl extends XmlElementImpl implements XmlAttlistDecl XmlElement xmlElement = getNameElement(); if (xmlElement != null) return xmlElement.getText(); - return getNameFromEntityRef(this, XmlElementType.XML_ATTLIST_DECL_START); + return getNameFromEntityRef(this, XmlTokenType.XML_ATTLIST_DECL_START); } } diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java index 2685a8bb6569..c45e6492f6c5 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlElementDeclImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,7 +120,7 @@ public class XmlElementDeclImpl extends XmlElementImpl implements XmlElementDecl XmlElement xmlElement = getNameElement(); if (xmlElement != null) return xmlElement.getText(); - return getNameFromEntityRef(this, XmlElementType.XML_ELEMENT_DECL_START); + return getNameFromEntityRef(this, XmlTokenType.XML_ELEMENT_DECL_START); } @Override diff --git a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java index 6d32e94f03aa..310f5a219adc 100644 --- a/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java +++ b/xml/xml-psi-impl/src/com/intellij/psi/impl/source/xml/XmlEntityRefImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -98,7 +98,7 @@ public class XmlEntityRefImpl extends XmlElementImpl implements XmlEntityRef { try { targetElement.putUserData(EVALUATION_IN_PROCESS, ""); final List deps = new ArrayList(); - final XmlEntityDecl[] result = new XmlEntityDecl[]{null}; + final XmlEntityDecl[] result = {null}; PsiElementProcessor processor = new PsiElementProcessor() { public boolean execute(@NotNull PsiElement element) {