mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-19061 Integrate the Rearranger-plugin into core-IDE
Correct tree merge when single node is replaced
This commit is contained in:
+37
-5
@@ -80,9 +80,7 @@ four = '4'()
|
||||
'3'()}
|
||||
from = '4' {
|
||||
to = '5'()
|
||||
'6'()
|
||||
}
|
||||
|
||||
'6'()}
|
||||
}
|
||||
|
||||
// Modify.
|
||||
@@ -100,8 +98,42 @@ to = '5'()
|
||||
'3'()
|
||||
'5'()}
|
||||
'4' {
|
||||
'6'()
|
||||
}
|
||||
'6'()}
|
||||
}
|
||||
assertNodesEqual(expected, initial)
|
||||
checkRowMappings([:], rowMappings)
|
||||
}
|
||||
|
||||
@Test
|
||||
void replaceWithTwoLevelMergeToNodeAbove() {
|
||||
// Init.
|
||||
def node;
|
||||
def initial = new TreeNodeBuilder().
|
||||
'0' {
|
||||
'1'() {
|
||||
'2'()
|
||||
'3'()}
|
||||
node = '4'()
|
||||
'5'() {
|
||||
'6'()}
|
||||
}
|
||||
|
||||
// Modify.
|
||||
def replacement = new TreeNodeBuilder().
|
||||
'1' {
|
||||
'4'()
|
||||
}
|
||||
def rowMappings = doReplace(initial, node, node, replacement)
|
||||
|
||||
// Check.
|
||||
def expected = new TreeNodeBuilder().
|
||||
'0' {
|
||||
'1' {
|
||||
'2'()
|
||||
'3'()
|
||||
'4'()}
|
||||
'5' {
|
||||
'6'()}
|
||||
}
|
||||
assertNodesEqual(expected, initial)
|
||||
checkRowMappings([:], rowMappings)
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ public class ArrangementConfigUtil {
|
||||
ArrangementTreeNode parent = from.getParent();
|
||||
int index = parent.getIndex(from);
|
||||
treeModel.removeNodeFromParent(from);
|
||||
treeModel.insertNodeInto(replacement, parent, index);
|
||||
insert(parent, index, replacement, treeModel);
|
||||
return collectRowChangesAndUnmark(parent, rootVisible);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user