Search in sources :

Example 11 with CopySourceEdit

use of org.eclipse.text.edits.CopySourceEdit in project eclipse.platform.text by eclipse.

the class TextEditTests method testCopyUp.

@Test
public void testCopyUp() throws Exception {
    CopySourceEdit s1 = new CopySourceEdit(7, 2);
    CopyTargetEdit t1 = new CopyTargetEdit(3, s1);
    fRoot.addChild(s1);
    fRoot.addChild(t1);
    UndoEdit undo = fRoot.apply(fDocument);
    assertEquals(s1, 9, 2);
    assertEquals(t1, 3, 2);
    String result = "012783456789";
    Assert.assertEquals("Buffer content", result, fDocument.get());
    doUndoRedo(undo, result);
}
Also used : CopySourceEdit(org.eclipse.text.edits.CopySourceEdit) CopyTargetEdit(org.eclipse.text.edits.CopyTargetEdit) UndoEdit(org.eclipse.text.edits.UndoEdit) Test(org.junit.Test)

Aggregations

CopySourceEdit (org.eclipse.text.edits.CopySourceEdit)11 CopyTargetEdit (org.eclipse.text.edits.CopyTargetEdit)11 Test (org.junit.Test)10 UndoEdit (org.eclipse.text.edits.UndoEdit)6 MultiTextEdit (org.eclipse.text.edits.MultiTextEdit)5 TextEdit (org.eclipse.text.edits.TextEdit)5 Document (org.eclipse.jface.text.Document)3 IDocument (org.eclipse.jface.text.IDocument)3 ReplaceEdit (org.eclipse.text.edits.ReplaceEdit)3 InsertEdit (org.eclipse.text.edits.InsertEdit)1 MoveSourceEdit (org.eclipse.text.edits.MoveSourceEdit)1 MoveTargetEdit (org.eclipse.text.edits.MoveTargetEdit)1 TextEditCopier (org.eclipse.text.edits.TextEditCopier)1