Examples of undo()


Examples of javax.swing.undo.UndoableEdit.undo()

        int[] offsets = new int[v.size()];
        for (int i = 0; i < pos.size(); i++) {
            offsets[i] = pos.get(i).getOffset();
        }
        UndoableEdit ue = content.remove(0, 9);
        ue.undo();
        for (int i = 0; i < pos.size(); i++) {
            assertEquals(offsets[i], pos.get(i).getOffset());
        }
    }
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

    public void testCreatePositionBeforeUndo() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 8);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
        ue.undo();
        assertEquals(11, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
    }
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

        assertEquals(3, pos.getOffset());
    }

    public void testCreatePositionAfterUndone() throws BadLocationException {
        UndoableEdit ue = content.remove(3, 8);
        ue.undo();
        Position pos = content.createPosition(5);
        assertEquals(5, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
        ue.undo();
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

        ue.undo();
        Position pos = content.createPosition(5);
        assertEquals(5, pos.getOffset());
        ue.redo();
        assertEquals(3, pos.getOffset());
        ue.undo();
        assertEquals(5, pos.getOffset());
    }

    public void testCreatePositionAfterInsert() throws BadLocationException {
        UndoableEdit ue = content.insertString(10, "big ");
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

    public void testCreatePositionAfterInsert() throws BadLocationException {
        UndoableEdit ue = content.insertString(10, "big ");
        Position pos = content.createPosition(12);
        assertEquals(12, pos.getOffset());
        ue.undo();
        assertEquals(10, pos.getOffset());
        ue.redo();
        assertEquals(12, pos.getOffset());
    }
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

    catch (BadLocationException ble)
      {
        h.fail("BadLocation! " + ble.getMessage());
      }
    try{
      ue3.undo();
      h.fail("should not be able to undo!");
    }
    catch (CannotUndoException cannot)
      {
        h.checkPoint("cannot undo");
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

                "double undo: should be 'phXss\\n' and is: " + sc.getString(0, sc.length()));
        ue2.undo();
        h.check("phXsats\n", sc.getString(0, sc.length()), "should be 'phXsats\\n' and is: " + sc.getString(0, sc.length()));
        ue.redo();
        h.check("phXts\n", sc.getString(0, sc.length()), "double undo: should be 'phXts\\n' and is: " + sc.getString(0, sc.length()));
        ue3.undo();
        h.check("claphXts\n", sc.getString(0, sc.length()), "add an X: should be 'claphXts\\n' and is: " + sc.getString(0, sc.length()));
      }
    catch (BadLocationException ble)
      {
        h.fail("BadLocation! " + ble.getMessage());
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

    catch (BadLocationException ble)
      {
        h.fail("BadLocation! " + ble.getMessage());
      }
    try{
      ue3.undo();
      h.fail("should not be able to undo!");
    }
    catch (CannotUndoException cannot)
      {
        h.checkPoint("cannot undo");
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos1 = content.createPosition(3);
        assertEquals(3, pos1.getOffset());
        undoable.undo();
        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
View Full Code Here

Examples of javax.swing.undo.UndoableEdit.undo()

        content = new StringContent(10);
        content.insertString(0, "0123456789");
        undoable = content.remove(3, 5);
        Position pos = content.createPosition(3);
        assertEquals(3, pos.getOffset());
        undoable.undo();
        assertEquals(8, pos.getOffset());
        undoable.redo();
        assertEquals(3, pos.getOffset());
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.