home *** CD-ROM | disk | FTP | other *** search
/ S283 Planetary Science &n…he Search for Life DVD 2 / DVD-ROM.iso / install / jre1_3 / lib / rt.jar / javax / swing / text / StringContent$InsertUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.3 KB  |  59 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 StringContent$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 StringContent this$0;
  15.  
  16.    protected StringContent$InsertUndo(StringContent 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.          StringContent var1 = this.this$0;
  27.          synchronized(var1) {
  28.             if (this.this$0.marks != null) {
  29.                this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  30.             }
  31.  
  32.             this.string = this.this$0.getString(this.offset, this.length);
  33.             this.this$0.remove(this.offset, this.length);
  34.          }
  35.       } catch (BadLocationException var4) {
  36.          throw new CannotUndoException();
  37.       }
  38.    }
  39.  
  40.    public void redo() throws CannotRedoException {
  41.       super.redo();
  42.  
  43.       try {
  44.          StringContent var1 = this.this$0;
  45.          synchronized(var1) {
  46.             this.this$0.insertString(this.offset, this.string);
  47.             this.string = null;
  48.             if (this.posRefs != null) {
  49.                this.this$0.updateUndoPositions(this.posRefs);
  50.                this.posRefs = null;
  51.             }
  52.  
  53.          }
  54.       } catch (BadLocationException var4) {
  55.          throw new CannotRedoException();
  56.       }
  57.    }
  58. }
  59.