Test fixes

1. Removed static processing for FormatterUtilHelper;
2. Merged FormatterUtilHelper with WhiteSpaceFormattingStrategy;
This commit is contained in:
Denis.Zhdanov
2011-12-07 16:06:26 +03:00
parent e042d2e041
commit b6072cde41
20 changed files with 207 additions and 108 deletions
@@ -1,35 +0,0 @@
/*
* Copyright 2000-2009 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.lang.ASTNode;
import com.intellij.psi.impl.source.tree.ElementType;
import com.intellij.psi.impl.source.tree.LeafElement;
/**
* @author max
*/
public class JavadocFormatterUtilHelper implements FormatterUtilHelper {
@Override
public boolean addWhitespace(final ASTNode treePrev, final LeafElement whiteSpaceElement) {
return false;
}
@Override
public boolean containsWhitespacesOnly(final ASTNode node) {
return node.getElementType() == ElementType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().length() == 0;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -13,16 +13,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.psi.formatter;
import com.intellij.lang.ASTNode;
import com.intellij.psi.impl.source.tree.LeafElement;
import com.intellij.psi.JavaDocTokenType;
import org.jetbrains.annotations.NotNull;
public interface FormatterUtilHelper {
boolean containsWhitespacesOnly(ASTNode node);
boolean addWhitespace(final ASTNode treePrev, final LeafElement whiteSpaceElement);
}
/**
* @author max
*/
public class JavadocWhiteSpaceFormattingStrategy extends WhiteSpaceFormattingStrategyAdapter {
@Override
public boolean containsWhitespacesOnly(@NotNull final ASTNode node) {
return node.getElementType() == JavaDocTokenType.DOC_COMMENT_DATA && node.textContains('\n') && node.getText().trim().length() == 0;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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,8 +22,6 @@ import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiField;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.formatter.FormatterUtil;
import com.intellij.psi.formatter.JavadocFormatterUtilHelper;
import com.intellij.psi.javadoc.JavadocManager;
import com.intellij.psi.javadoc.JavadocTagInfo;
import org.jetbrains.annotations.NotNull;
@@ -39,10 +37,6 @@ import java.util.List;
public class JavadocManagerImpl implements JavadocManager {
private final List<JavadocTagInfo> myInfos;
static {
FormatterUtil.addHelper(new JavadocFormatterUtilHelper());
}
public JavadocManagerImpl(Project project) {
myInfos = new ArrayList<JavadocTagInfo>();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -42,6 +42,7 @@ public class LanguageLineWrapPositionStrategy extends LanguageExtension<LineWrap
* @param editor editor that manages document which text should be processed by wrap position strategy
* @return line wrap position strategy to use for the lines from the document managed by the given editor
*/
@NotNull
public LineWrapPositionStrategy forEditor(@NotNull Editor editor) {
LineWrapPositionStrategy result = getDefaultImplementation();
Project project = editor.getProject();
@@ -17,7 +17,7 @@ package com.intellij.codeInsight.editorActions;
import com.intellij.codeInsight.template.TemplateManager;
import com.intellij.formatting.FormatConstants;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import com.intellij.psi.formatter.WhiteSpaceFormattingStrategy;
import com.intellij.ide.DataManager;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.IdeActions;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,10 +15,11 @@
*/
package com.intellij.psi.formatter;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafElement;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -96,4 +97,14 @@ public abstract class AbstractWhiteSpaceFormattingStrategy implements WhiteSpace
}
return null;
}
@Override
public boolean containsWhitespacesOnly(@NotNull ASTNode node) {
return false;
}
@Override
public boolean addWhitespace(@NotNull ASTNode treePrev, @NotNull LeafElement whiteSpaceElement) {
return false;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.psi.formatter;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import org.jetbrains.annotations.NonNls;
/**
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,8 +15,9 @@
*/
package com.intellij.psi.formatter;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafElement;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
@@ -100,4 +101,14 @@ public class CompositeWhiteSpaceFormattingStrategy implements WhiteSpaceFormatti
}
return result;
}
@Override
public boolean containsWhitespacesOnly(@NotNull ASTNode node) {
return false;
}
@Override
public boolean addWhitespace(@NotNull ASTNode treePrev, @NotNull LeafElement whiteSpaceElement) {
return false;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -34,12 +34,9 @@ import org.jetbrains.annotations.Nullable;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
public class FormatterUtil {
private static final List<FormatterUtilHelper> ourHelpers = ContainerUtil.createEmptyCOWList();
public static final Collection<String> FORMATTER_ACTION_NAMES = Collections.unmodifiableCollection(ContainerUtil.addAll(
new HashSet<String>(), ReformatAndOptimizeImportsProcessor.COMMAND_NAME, ReformatCodeProcessor.COMMAND_NAME
));
@@ -47,10 +44,6 @@ public class FormatterUtil {
private FormatterUtil() {
}
public static void addHelper(FormatterUtilHelper helper) {
ourHelpers.add(helper);
}
public static boolean isWhitespaceOrEmpty(@Nullable ASTNode node) {
if (node == null) return false;
IElementType type = node.getElementType();
@@ -209,10 +202,11 @@ public class FormatterUtil {
if (node == null) return false;
if (isWhitespaceOrEmpty(node)) return true;
for (FormatterUtilHelper helper : ourHelpers) {
if (helper.containsWhitespacesOnly(node)) return true;
for (WhiteSpaceFormattingStrategy strategy : WhiteSpaceFormattingStrategyFactory.getAllStrategies()) {
if (strategy.containsWhitespacesOnly(node)) {
return true;
}
}
return false;
}
@@ -350,8 +344,10 @@ public class FormatterUtil {
}
private static void addWhiteSpace(final ASTNode treePrev, final LeafElement whiteSpaceElement) {
for (FormatterUtilHelper helper : ourHelpers) {
if (helper.addWhitespace(treePrev, whiteSpaceElement)) return;
for (WhiteSpaceFormattingStrategy strategy : WhiteSpaceFormattingStrategyFactory.getAllStrategies()) {
if (strategy.addWhitespace(treePrev, whiteSpaceElement)) {
return;
}
}
final ASTNode treeParent = treePrev.getTreeParent();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -17,7 +17,6 @@
package com.intellij.psi.formatter;
import com.intellij.formatting.FormattingDocumentModel;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import com.intellij.lang.Language;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -13,12 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.formatting;
package com.intellij.psi.formatter;
import com.intellij.lang.LanguageExtension;
import java.util.Collection;
/**
* Exposes pre-configured {@link WhiteSpaceFormattingStrategy} objects to use in a per-language manner.
*
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.psi.formatter;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NotNull;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -13,9 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.formatting;
package com.intellij.psi.formatter;
import com.intellij.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafElement;
import org.jetbrains.annotations.NotNull;
/**
@@ -43,6 +45,14 @@ public interface WhiteSpaceFormattingStrategy {
*/
int check(@NotNull CharSequence text, int start, int end);
/**
* Allows to answer if given node should be treated as white space node.
*
* @param node node to check
* @return <code>true</code> if given node should be treated as white space; <code>false</code> otherwise
*/
boolean containsWhitespacesOnly(@NotNull ASTNode node);
/**
* @return <code>true</code> if default white space strategy used by formatter should be replaced by the current one;
* <code>false</code> to indicate that current strategy should be used in composition with default strategy
@@ -52,7 +62,7 @@ public interface WhiteSpaceFormattingStrategy {
boolean replaceDefaultStrategy();
/**
* Main formatter duty is to tweak white space symbols (add/remove/modify them). However, it may be necessary
* Main formatter's duty is to tweak white space symbols (add/remove/modify them). However, it may be necessary
* to pay special attention to that. For example it may be necessary to ensure that <code>'\'</code> symbol is
* used inside multiline expression in case of Python etc.
* <p/>
@@ -86,4 +96,16 @@ public interface WhiteSpaceFormattingStrategy {
*/
CharSequence adjustWhiteSpaceIfNecessary(@NotNull CharSequence whiteSpaceText, @NotNull PsiElement startElement, int startOffset,
int endOffset);
/**
* Allows to customize addition of the given white space element to the AST referenced by the given node.
*
* @param treePrev target node to use as an anchor for inserting given white space element
* @param whiteSpaceElement target white space element to insert
* @return <code>true</code> if given white space element was added in a custom way during the current method call
* processing;
* <code>false</code> as an indicator that given white space element has not been inserted during the
* current method call
*/
boolean addWhitespace(@NotNull ASTNode treePrev, @NotNull LeafElement whiteSpaceElement);
}
@@ -0,0 +1,67 @@
/*
* Copyright 2000-2011 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.lang.ASTNode;
import com.intellij.psi.PsiElement;
import com.intellij.psi.impl.source.tree.LeafElement;
import org.jetbrains.annotations.NotNull;
/**
* @author Denis Zhdanov
* @since 12/6/11 3:58 PM
*/
public class WhiteSpaceFormattingStrategyAdapter implements WhiteSpaceFormattingStrategy {
private final WhiteSpaceFormattingStrategy DELEGATE = new StaticSymbolWhiteSpaceDefinitionStrategy(' ', '\t', '\n');
@Override
public int check(@NotNull CharSequence text, int start, int end) {
return DELEGATE.check(text, start, end);
}
@Override
public boolean containsWhitespacesOnly(@NotNull ASTNode node) {
return false;
}
@Override
public boolean replaceDefaultStrategy() {
return false;
}
@NotNull
@Override
public CharSequence adjustWhiteSpaceIfNecessary(@NotNull CharSequence whiteSpaceText,
@NotNull CharSequence text,
int startOffset,
int endOffset) {
return whiteSpaceText;
}
@Override
public CharSequence adjustWhiteSpaceIfNecessary(@NotNull CharSequence whiteSpaceText,
@NotNull PsiElement startElement,
int startOffset,
int endOffset) {
return whiteSpaceText;
}
@Override
public boolean addWhitespace(@NotNull ASTNode treePrev, @NotNull LeafElement whiteSpaceElement) {
return false;
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -15,17 +15,17 @@
*/
package com.intellij.psi.formatter;
import com.intellij.formatting.LanguageWhiteSpaceFormattingStrategy;
import com.intellij.formatting.WhiteSpaceFormattingStrategy;
import com.intellij.lang.Language;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import com.intellij.util.PatchedWeakReference;
import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
import java.util.List;
import java.lang.ref.WeakReference;
import java.util.*;
import java.util.concurrent.atomic.AtomicReference;
/**
* Contains utility methods for working with {@link WhiteSpaceFormattingStrategy}.
@@ -39,6 +39,9 @@ public class WhiteSpaceFormattingStrategyFactory {
new StaticSymbolWhiteSpaceDefinitionStrategy(' ', '\t', '\n'), new CdataWhiteSpaceDefinitionStrategy()
);
private static final AtomicReference<PatchedWeakReference<Collection<WhiteSpaceFormattingStrategy>>> myCachedStrategies
= new AtomicReference<PatchedWeakReference<Collection<WhiteSpaceFormattingStrategy>>>();
private WhiteSpaceFormattingStrategyFactory() {
}
@@ -65,6 +68,37 @@ public class WhiteSpaceFormattingStrategyFactory {
return result;
}
/**
* @return collection of all registered white space strategies
*/
@NotNull
public static Collection<WhiteSpaceFormattingStrategy> getAllStrategies() {
final WeakReference<Collection<WhiteSpaceFormattingStrategy>> reference = myCachedStrategies.get();
if (reference != null) {
final Collection<WhiteSpaceFormattingStrategy> strategies = reference.get();
if (strategies != null) {
return strategies;
}
}
final Collection<Language> languages = Language.getRegisteredLanguages();
if (languages == null) {
final List<WhiteSpaceFormattingStrategy> result = Collections.emptyList();
myCachedStrategies.set(new PatchedWeakReference<Collection<WhiteSpaceFormattingStrategy>>(result));
return result;
}
Set<WhiteSpaceFormattingStrategy> result = new HashSet<WhiteSpaceFormattingStrategy>(SHARED_STRATEGIES);
final LanguageWhiteSpaceFormattingStrategy languageStrategy = LanguageWhiteSpaceFormattingStrategy.INSTANCE;
for (Language language : languages) {
final WhiteSpaceFormattingStrategy strategy = languageStrategy.forLanguage(language);
if (strategy != null) {
result.add(strategy);
}
}
myCachedStrategies.set(new PatchedWeakReference<Collection<WhiteSpaceFormattingStrategy>>(result));
return result;
}
/**
* Returns white space strategy to use for the document managed by the given editor.
*
@@ -152,6 +152,8 @@
<lang.parserDefinition language="XHTML" implementationClass="com.intellij.lang.xhtml.XHTMLParserDefinition"/>
<lang.formatter language="XML" implementationClass="com.intellij.lang.xml.XmlFormattingModelBuilder"/>
<lang.whiteSpaceFormattingStrategy language="XML"
implementationClass="com.intellij.lang.xml.XmlWhiteSpaceFormattingStrategy"/>
<lang.formatter language="HTML" implementationClass="com.intellij.lang.html.HtmlFormattingModelBuilder"/>
<lang.formatter language="XHTML" implementationClass="com.intellij.lang.xhtml.XhtmlFormattingModelBuilder"/>
<lang.lineWrapStrategy language="XML" implementationClass="com.intellij.psi.formatter.MarkupLineWrapPositionStrategy"/>
+2
View File
@@ -690,6 +690,8 @@
<lang.refactoringSupport.classMembersRefactoringSupport language="JAVA" implementationClass="com.intellij.lang.java.JavaClassMembersRefactoringSupport"/>
<lang.formatter language="JAVA" implementationClass="com.intellij.lang.java.JavaFormattingModelBuilder"/>
<lang.whiteSpaceFormattingStrategy language="JAVA"
implementationClass="com.intellij.psi.formatter.JavadocWhiteSpaceFormattingStrategy"/>
<lang.documentationProvider language="JAVA" implementationClass="com.intellij.lang.java.JavaDocumentationProvider"/>
<documentationProvider implementation="com.intellij.lang.java.FileDocumentationProvider" order="last"/>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -26,21 +26,15 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.codeStyle.CodeStyleSettings;
import com.intellij.psi.formatter.FormatterUtil;
import com.intellij.psi.formatter.FormattingDocumentModelImpl;
import com.intellij.psi.formatter.XmlFormatterUtilHelper;
import com.intellij.psi.formatter.xml.XmlBlock;
import com.intellij.psi.formatter.xml.XmlPolicy;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
import com.intellij.lang.xml.XmlFormattingModel;
import com.intellij.psi.impl.source.tree.TreeElement;
import com.intellij.psi.impl.source.tree.TreeUtil;
import org.jetbrains.annotations.NotNull;
public class XmlFormattingModelBuilder implements FormattingModelBuilder {
static {
FormatterUtil.addHelper(new XmlFormatterUtilHelper());
}
@NotNull
public FormattingModel createModel(final PsiElement element, final CodeStyleSettings settings) {
@@ -54,4 +48,4 @@ public class XmlFormattingModelBuilder implements FormattingModelBuilder {
public TextRange getRangeAffectingIndent(PsiFile file, int offset, ASTNode elementAtOffset) {
return null;
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2011 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.
@@ -13,14 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* @author max
*/
package com.intellij.psi.formatter;
package com.intellij.lang.xml;
import com.intellij.lang.ASTFactory;
import com.intellij.lang.ASTNode;
import com.intellij.psi.formatter.WhiteSpaceFormattingStrategyAdapter;
import com.intellij.psi.impl.source.codeStyle.CodeEditUtil;
import com.intellij.psi.impl.source.tree.Factory;
import com.intellij.psi.impl.source.tree.LeafElement;
@@ -30,8 +27,14 @@ import com.intellij.psi.xml.XmlElementType;
import com.intellij.psi.xml.XmlText;
import com.intellij.psi.xml.XmlTokenType;
import com.intellij.util.CharTable;
import org.jetbrains.annotations.NotNull;
/**
* @author Denis Zhdanov
* @since 12/6/11 4:51 PM
*/
public class XmlWhiteSpaceFormattingStrategy extends WhiteSpaceFormattingStrategyAdapter {
public class XmlFormatterUtilHelper implements FormatterUtilHelper {
private static void addWhitespaceToTagBody(final ASTNode treePrev, final LeafElement whiteSpaceElement) {
final CharTable charTable = SharedImplUtil.findCharTableByTree(treePrev);
final ASTNode treeParent = treePrev.getTreeParent();
@@ -64,7 +67,7 @@ public class XmlFormatterUtilHelper implements FormatterUtilHelper {
}
}
protected boolean isInsideTagBody(ASTNode place) {
protected boolean isInsideTagBody(@NotNull ASTNode place) {
final ASTNode treeParent = place.getTreeParent();
if(treeParent.getElementType() != XmlElementType.XML_TAG
&& treeParent.getElementType() != XmlElementType.HTML_TAG) return false;
@@ -75,7 +78,7 @@ public class XmlFormatterUtilHelper implements FormatterUtilHelper {
return false;
}
public boolean addWhitespace(final ASTNode treePrev, final LeafElement whiteSpaceElement) {
public boolean addWhitespace(@NotNull final ASTNode treePrev, @NotNull final LeafElement whiteSpaceElement) {
if (isInsideTagBody(treePrev)) {
addWhitespaceToTagBody(treePrev, whiteSpaceElement);
return true;
@@ -84,7 +87,7 @@ public class XmlFormatterUtilHelper implements FormatterUtilHelper {
return false;
}
public boolean containsWhitespacesOnly(final ASTNode node) {
public boolean containsWhitespacesOnly(@NotNull final ASTNode node) {
return (node.getElementType() == XmlTokenType.XML_DATA_CHARACTERS) &&
node.getText().trim().length() == 0;
}