From 72315d0bfa514340e19168378395d422949c00a3 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 3 Aug 2010 18:57:03 +0400 Subject: [PATCH] cleanup --- .../impl/source/codeStyle/CodeEditUtil.java | 28 +++++++++++++------ 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java index 7c062d1eb52e..5379241f800f 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/codeStyle/CodeEditUtil.java @@ -40,9 +40,9 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class CodeEditUtil { - private static final Key GENERATED_FLAG = new Key("CREATED BY IDEA"); - private static final Key INDENT_INFO = new Key("INDENTATION"); - private static final Key REFORMAT_KEY = new Key("REFORMAT BEFORE THIS ELEMENT"); + private static final Key GENERATED_FLAG = new Key("GENERATED_FLAG"); + private static final Key INDENT_INFO = new Key("INDENT_INFO"); + private static final Key REFORMAT_KEY = new Key("REFORMAT_KEY"); public static final Key OUTER_OK = new Key("OUTER_OK"); @@ -247,9 +247,15 @@ public class CodeEditUtil { final int leftBlankLines = getBlankLines(left.getText()); final int rightBlankLines = getBlankLines(right.getText()); final boolean leaveRightText = leftBlankLines < rightBlankLines; - if (leftBlankLines == 0 && rightBlankLines == 0) text = left.getText() + right.getText(); - else if (leaveRightText) text = right.getText(); - else text = left.getText(); + if (leftBlankLines == 0 && rightBlankLines == 0) { + text = left.getText() + right.getText(); + } + else if (leaveRightText) { + text = right.getText(); + } + else { + text = left.getText(); + } if(leaveRightText || forceReformat){ final LeafElement merged = ASTFactory.whitespace(text); if(!leaveRightText){ @@ -373,9 +379,13 @@ public class CodeEditUtil { } public static void setNodeGenerated(final ASTNode next, final boolean value) { - if(next == null) return; - if(value) next.putCopyableUserData(GENERATED_FLAG, true); - else next.putCopyableUserData(GENERATED_FLAG, null); + if (next == null) return; + if (value) { + next.putCopyableUserData(GENERATED_FLAG, true); + } + else { + next.putCopyableUserData(GENERATED_FLAG, null); + } } public static void setOldIndentation(final TreeElement treeElement, final int oldIndentation) {