use of org.eclipse.text.edits.UndoEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testMoveWithRangeMarker.
@Test
public void testMoveWithRangeMarker() throws Exception {
MoveSourceEdit s1 = new MoveSourceEdit(2, 2);
MoveTargetEdit t1 = new MoveTargetEdit(5, s1);
RangeMarker marker = new RangeMarker(2, 2);
s1.addChild(marker);
fRoot.addChild(s1);
fRoot.addChild(t1);
UndoEdit undo = fRoot.apply(fDocument);
Assert.assertEquals("Buffer content", "0142356789", fDocument.get());
assertEquals(s1, 2, 0);
assertEquals(t1, 3, 2);
assertEquals(marker, 3, 2);
doUndoRedo(undo, "0142356789");
}
use of org.eclipse.text.edits.UndoEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testInsert2.
@Test
public void testInsert2() throws Exception {
// [][]
TextEdit e1 = new InsertEdit(2, "yy");
TextEdit e2 = new InsertEdit(2, "xx");
fRoot.addChild(e1);
fRoot.addChild(e2);
UndoEdit undo = fRoot.apply(fDocument);
assertEquals(fRoot, 2, 4);
assertEquals(e1, 2, 2);
assertEquals(e2, 4, 2);
Assert.assertEquals("Buffer content", "01yyxx23456789", fDocument.get());
doUndoRedo(undo, "01yyxx23456789");
}
use of org.eclipse.text.edits.UndoEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testMove4.
@Test
public void testMove4() throws Exception {
MoveSourceEdit s1 = new MoveSourceEdit(7, 2);
MoveTargetEdit t1 = new MoveTargetEdit(2, s1);
TextEdit e2 = new ReplaceEdit(5, 1, "x");
fRoot.addChild(s1);
fRoot.addChild(t1);
fRoot.addChild(e2);
UndoEdit undo = fRoot.apply(fDocument);
Assert.assertEquals("Buffer content", "0178234x69", fDocument.get());
assertEquals(s1, 9, 0);
assertEquals(t1, 2, 2);
assertEquals(e2, 7, 1);
doUndoRedo(undo, "0178234x69");
}
Aggregations