From d2cb3f70ed50a4a8090fa9ff036cc2986c4d08bd Mon Sep 17 00:00:00 2001 From: "Denis.Zhdanov" Date: Wed, 22 Aug 2012 23:52:02 +0400 Subject: [PATCH] IDEA-19061 Integrate the Rearranger-plugin into core-IDE Corrected arrangement node user data comparison for tree root case (no settings node is available) --- .../codeStyle/arrangement/ArrangementConfigUtil.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConfigUtil.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConfigUtil.java index 8c98d0a7149c..169957d42119 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConfigUtil.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/arrangement/ArrangementConfigUtil.java @@ -339,7 +339,7 @@ public class ArrangementConfigUtil { //region Insert nodes. int insertionIndex = root.getChildCount() < childCountBefore ? childCountBefore - 1 : childCountBefore; - boolean merged = insert(root, insertionIndex, replacement, treeModel); + insert(root, insertionIndex, replacement, treeModel); if (cutHierarchy != null) { List toInsert = new ArrayList(); if (hasEqualSetting(root, cutHierarchy)) { @@ -529,9 +529,11 @@ public class ArrangementConfigUtil { private static boolean hasEqualSetting(@NotNull ArrangementTreeNode node1, @NotNull ArrangementTreeNode node2) { ArrangementSettingsNode setting1 = node1.getBackingSetting(); ArrangementSettingsNode setting2 = node2.getBackingSetting(); - if (setting1 == null || setting2 == null) { - return false; + if (setting1 == null) { + return setting2 == null; + } + else { + return setting1.equals(setting2); } - return setting1.equals(setting2); } }