use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method setUp.
@Before
public void setUp() {
fDocument = new Document("0123456789");
fRoot = new MultiTextEdit();
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testDeleteWithChildren.
@Test
public void testDeleteWithChildren() throws Exception {
TextEdit e1 = new DeleteEdit(2, 6);
MultiTextEdit e2 = new MultiTextEdit(3, 3);
e1.addChild(e2);
TextEdit e3 = new ReplaceEdit(3, 1, "xx");
TextEdit e4 = new ReplaceEdit(5, 1, "yy");
e2.addChild(e3);
e2.addChild(e4);
fRoot.addChild(e1);
UndoEdit undo = fRoot.apply(fDocument);
Assert.assertEquals("Buffer content", "0189", fDocument.get());
assertEquals(fRoot, 2, 0);
assertEquals(e1, 2, 0);
assertTrue(e2.isDeleted());
assertTrue(e3.isDeleted());
assertTrue(e4.isDeleted());
doUndoRedo(undo, "0189");
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testUndefinedMultiEdit6.
@Test
public void testUndefinedMultiEdit6() throws Exception {
DeleteEdit d1 = new DeleteEdit(1, 3);
MultiTextEdit m2 = new MultiTextEdit();
assertTrue(d1.covers(m2));
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testUndefinedMultiEdit2.
@Test
public void testUndefinedMultiEdit2() throws Exception {
MultiTextEdit m1 = new MultiTextEdit();
MultiTextEdit m2 = new MultiTextEdit();
assertTrue(m1.covers(m2));
assertTrue(m2.covers(m1));
}
use of org.eclipse.text.edits.MultiTextEdit in project eclipse.platform.text by eclipse.
the class TextEditTests method testTreeUpdate1.
@Test
public void testTreeUpdate1() throws Exception {
MultiTextEdit m1 = new MultiTextEdit();
TextEdit e1 = new InsertEdit(2, "aa");
TextEdit e2 = new InsertEdit(4, "bb");
m1.addChild(e1);
m1.addChild(e2);
MultiTextEdit m2 = new MultiTextEdit();
TextEdit e3 = new InsertEdit(6, "cc");
TextEdit e4 = new InsertEdit(8, "dd");
m2.addChild(e3);
m2.addChild(e4);
fRoot.addChild(m1);
fRoot.addChild(m2);
assertEquals(m1, 2, 2);
assertEquals(m2, 6, 2);
UndoEdit undo = fRoot.apply(fDocument);
Assert.assertEquals("Buffer content", "01aa23bb45cc67dd89", fDocument.get());
assertEquals(e1, 2, 2);
assertEquals(e2, 6, 2);
assertEquals(e3, 10, 2);
assertEquals(e4, 14, 2);
assertEquals(m1, 2, 6);
assertEquals(m2, 10, 6);
assertEquals(fRoot, 2, 14);
doUndoRedo(undo, "01aa23bb45cc67dd89");
}
Aggregations