home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &… the Search for Life CD 3 / 0_CD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / GapContent$InsertUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.2 KB  |  50 lines

  1. package javax.swing.text;
  2.  
  3. import java.util.Vector;
  4. import javax.swing.undo.AbstractUndoableEdit;
  5. import javax.swing.undo.CannotRedoException;
  6. import javax.swing.undo.CannotUndoException;
  7.  
  8. class GapContent$InsertUndo extends AbstractUndoableEdit {
  9.    protected int offset;
  10.    protected int length;
  11.    protected String string;
  12.    protected Vector posRefs;
  13.    // $FF: synthetic field
  14.    private final GapContent this$0;
  15.  
  16.    protected GapContent$InsertUndo(GapContent var1, int var2, int var3) {
  17.       this.this$0 = var1;
  18.       this.offset = var2;
  19.       this.length = var3;
  20.    }
  21.  
  22.    public void undo() throws CannotUndoException {
  23.       super.undo();
  24.  
  25.       try {
  26.          this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  27.          this.string = this.this$0.getString(this.offset, this.length);
  28.          this.this$0.remove(this.offset, this.length);
  29.       } catch (BadLocationException var2) {
  30.          throw new CannotUndoException();
  31.       }
  32.    }
  33.  
  34.    public void redo() throws CannotRedoException {
  35.       super.redo();
  36.  
  37.       try {
  38.          this.this$0.insertString(this.offset, this.string);
  39.          this.string = null;
  40.          if (this.posRefs != null) {
  41.             this.this$0.updateUndoPositions(this.posRefs, this.offset, this.length);
  42.             this.posRefs = null;
  43.          }
  44.  
  45.       } catch (BadLocationException var2) {
  46.          throw new CannotRedoException();
  47.       }
  48.    }
  49. }
  50.