Script MultiTextEdit
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.Document;
import org.eclipse.jface.text.IDocument;
import org.eclipse.text.edits.InsertEdit;
import org.eclipse.text.edits.MalformedTreeException;
import org.eclipse.text.edits.MultiTextEdit;
import org.eclipse.text.edits.UndoEdit;
public class Script {
public static void main(String[] args) throws MalformedTreeException,
BadLocationException {
IDocument document = new Document("Eclipse 3");
System.out.println(document.get());
MultiTextEdit edit = new MultiTextEdit();
edit.addChild(new InsertEdit(0, "Java Entwicklung"));
edit.addChild(new InsertEdit(0, " mit "));
UndoEdit undo = edit.apply(document);
System.out.println(document.get());
undo.apply(document);
System.out.println(document.get());
}
}
Related examples in the same category