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$RemoveUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1979-12-31  |  1.4 KB  |  64 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$RemoveUndo 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$RemoveUndo(StringContent var1, int var2, String var3) {
  17.       this.this$0 = var1;
  18.       this.offset = var2;
  19.       this.string = var3;
  20.       this.length = var3.length();
  21.       if (var1.marks != null) {
  22.          this.posRefs = var1.getPositionsInRange((Vector)null, var2, this.length);
  23.       }
  24.  
  25.    }
  26.  
  27.    public void undo() throws CannotUndoException {
  28.       super.undo();
  29.  
  30.       try {
  31.          StringContent var1 = this.this$0;
  32.          synchronized(var1) {
  33.             this.this$0.insertString(this.offset, this.string);
  34.             if (this.posRefs != null) {
  35.                this.this$0.updateUndoPositions(this.posRefs);
  36.                this.posRefs = null;
  37.             }
  38.  
  39.             this.string = null;
  40.          }
  41.       } catch (BadLocationException var4) {
  42.          throw new CannotUndoException();
  43.       }
  44.    }
  45.  
  46.    public void redo() throws CannotRedoException {
  47.       super.redo();
  48.  
  49.       try {
  50.          StringContent var1 = this.this$0;
  51.          synchronized(var1) {
  52.             this.string = this.this$0.getString(this.offset, this.length);
  53.             if (this.this$0.marks != null) {
  54.                this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  55.             }
  56.  
  57.             this.this$0.remove(this.offset, this.length);
  58.          }
  59.       } catch (BadLocationException var4) {
  60.          throw new CannotRedoException();
  61.       }
  62.    }
  63. }
  64.