1 11 package org.eclipse.text.edits; 12 13 import java.util.ArrayList ; 14 import java.util.List ; 15 16 import org.eclipse.jface.text.BadLocationException; 17 import org.eclipse.jface.text.IDocument; 18 19 30 public final class UndoEdit extends TextEdit { 31 32 UndoEdit() { 33 super(0, Integer.MAX_VALUE); 34 } 35 36 private UndoEdit(UndoEdit other) { 37 super(other); 38 } 39 40 43 void internalAdd(TextEdit child) throws MalformedTreeException { 44 throw new MalformedTreeException(null, this, TextEditMessages.getString("UndoEdit.no_children")); } 46 47 50 void aboutToBeAdded(TextEdit parent) { 51 throw new MalformedTreeException(parent, this, TextEditMessages.getString("UndoEdit.can_not_be_added")); } 53 54 UndoEdit dispatchPerformEdits(TextEditProcessor processor) throws BadLocationException { 55 return processor.executeUndo(); 56 } 57 58 void dispatchCheckIntegrity(TextEditProcessor processor) throws MalformedTreeException { 59 processor.checkIntegrityUndo(); 60 } 61 62 65 protected TextEdit doCopy() { 66 return new UndoEdit(this); 67 } 68 69 72 protected void accept0(TextEditVisitor visitor) { 73 boolean visitChildren= visitor.visit(this); 74 if (visitChildren) { 75 acceptChildren(visitor); 76 } 77 } 78 79 82 int performDocumentUpdating(IDocument document) throws BadLocationException { 83 fDelta= 0; 84 return fDelta; 85 } 86 87 void add(ReplaceEdit edit) { 88 List children= internalGetChildren(); 89 if (children == null) { 90 children= new ArrayList (2); 91 internalSetChildren(children); 92 } 93 children.add(edit); 94 } 95 96 void defineRegion(int offset, int length) { 97 internalSetOffset(offset); 98 internalSetLength(length); 99 } 100 101 boolean deleteChildren() { 102 return false; 103 } 104 } 105 106 | Popular Tags |