Script MultiTextEdit : Editor « SWT JFace Eclipse « Java






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

1.Java Source code ViewerJava Source code Viewer
2.SWT Text Editor DemoSWT Text Editor Demo
3.SWT Completion Editor
4.Basic Editor 2Basic Editor 2
5.Basic EditorBasic Editor
6.Basic Editor 3Basic Editor 3
7.SWT Editor