home *** CD-ROM | disk | FTP | other *** search
/ PC Plus SuperCD (UK) 2000 March / pcp161a.iso / handson / files / copyjava.exe / com / sun / java / swing / text / StringContent$InsertUndo.class (.txt) < prev    next >
Encoding:
Java Class File  |  1998-02-26  |  1.8 KB  |  69 lines

  1. package com.sun.java.swing.text;
  2.  
  3. import com.sun.java.swing.undo.AbstractUndoableEdit;
  4. import com.sun.java.swing.undo.CannotRedoException;
  5. import com.sun.java.swing.undo.CannotUndoException;
  6. import java.util.Vector;
  7.  
  8. class StringContent$InsertUndo extends AbstractUndoableEdit {
  9.    // $FF: synthetic field
  10.    private final StringContent this$0;
  11.    protected int offset;
  12.    protected int length;
  13.    protected String string;
  14.    protected Vector posRefs;
  15.  
  16.    protected StringContent$InsertUndo(StringContent var1, int var2, int var3) {
  17.       this.this$0 = var1;
  18.       this.this$0 = var1;
  19.       this.offset = var2;
  20.       this.length = var3;
  21.    }
  22.  
  23.    public void undo() throws CannotUndoException {
  24.       super.undo();
  25.  
  26.       try {
  27.          StringContent var1 = this.this$0;
  28.          synchronized(var1){}
  29.  
  30.          try {
  31.             if (this.this$0.marks != null) {
  32.                this.posRefs = this.this$0.getPositionsInRange((Vector)null, this.offset, this.length);
  33.             }
  34.  
  35.             this.string = this.this$0.getString(this.offset, this.length);
  36.             this.this$0.remove(this.offset, this.length);
  37.          } catch (Throwable var4) {
  38.             throw var4;
  39.          }
  40.  
  41.       } catch (BadLocationException var5) {
  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.  
  53.          try {
  54.             this.this$0.insertString(this.offset, this.string);
  55.             this.string = null;
  56.             if (this.posRefs != null) {
  57.                this.this$0.updateUndoPositions(this.posRefs);
  58.                this.posRefs = null;
  59.             }
  60.          } catch (Throwable var4) {
  61.             throw var4;
  62.          }
  63.  
  64.       } catch (BadLocationException var5) {
  65.          throw new CannotRedoException();
  66.       }
  67.    }
  68. }
  69.