Package javax.swing.undo

Examples of javax.swing.undo.UndoManager


        keyBindingsMap = Maps.newHashMap();
        editListener = new Listener();
    }

    public TableUndoRedoService() {
        this(new UndoManager());
    }
View Full Code Here


    /**
     * Changes the specified text component to support undo and redo using Ctrl-Z and Ctrl-Y.
     * @param textComponent  the text component to be modified
     */
    public static void makeTextComponentUndoable(JTextComponent textComponent) {
        final UndoManager undoManager = new UndoManager();
        final Action undoAction = new AbstractAction(UIMessages.instance.getString("GenericUndoName")) { //$NON-NLS-1$
            private static final long serialVersionUID = -2135822508998640523L;

                public void actionPerformed(ActionEvent e) {
                    try {
                        if (undoManager.canUndo()) {
                            undoManager.undo();
                        }
                    }
                    catch (CannotUndoException ex) {
                    }
                }
            };
        final Action redoAction = new AbstractAction(UIMessages.instance.getString("GenericRedoName")) { //$NON-NLS-1$
            private static final long serialVersionUID = 2928127985356997903L;

                public void actionPerformed(ActionEvent e) {
                    try {
                        if (undoManager.canRedo()) {
                            undoManager.redo();
                        }
                    }
                    catch (CannotUndoException ex) {
                    }
                }
            };

        UndoableEditListener undoListener = new UndoableEditListener() {
                public void undoableEditHappened(UndoableEditEvent e) {
                    undoManager.addEdit(e.getEdit());
                }
            };

        textComponent.getDocument().addUndoableEditListener(undoListener);

View Full Code Here

        fpcl = new FocusPropertyChangeListener();
        KeyboardFocusManager focusManager =
                KeyboardFocusManager.getCurrentKeyboardFocusManager();
        focusManager.addPropertyChangeListener(fpcl);
       
        undoManager = new UndoManager();
    }
View Full Code Here

                deselectedItem = e.getItem();
                break;
            case ItemEvent.SELECTED:
                // don't add event to undo list, if it was just the default setting
                if (isUserAction) {
                    UndoManager undoManager = Application.getInstance().getUndoManager();
                    undoManager.addEdit(new JComboBoxUndoableEdit((JComboBox) e
                            .getSource(), deselectedItem, e.getItem(), this));
                   
                }
                //set back to default value after the selecting new option
                isUserAction = true;
View Full Code Here

        setContentType(XMLEditorKit.XML_MIME_TYPE);
        setBackground(Color.white);
        //setFont(new Font("Monospaced", Font.PLAIN, 12));
               
        // add undoable edit
        undoManager = new UndoManager();
        UndoableEditListener undoableEditHandler = new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent e) {
                undoManager.addEdit(e.getEdit());
            }
        };
View Full Code Here

  {
    boolean undo = false;
    boolean redo = false;
    if (am.getUi().getEditorFocus() != null)
    {
      UndoManager undoManager = ((WoPeDJGraph) am.getUi()
          .getEditorFocus().getGraph()).getUndoManager();
      if (undoManager != null) {

        if (am.getUi().getEditorFocus() instanceof SubprocessEditorVC)
          undo = ((WoPeDUndoManager) undoManager).canUndo(am.getUi()
              .getEditorFocus().getModelProcessor()
              .getElementContainer())
     
        else
        undo = undoManager.canUndo();
        redo = undoManager.canRedo();
      }
    }
   
    setStatus(CAN_UNDO, undo);
    setStatus(CAN_REDO, redo);
View Full Code Here

  private boolean compoundMode = false;
  private CompoundEdit ce = null;

  UndoRedoSupport(JTextComponent textComponent, ResourceBundle messages) {
    this.messages = messages;
    undoManager = new UndoManager();
    undoAction = new UndoAction();
    redoAction = new RedoAction();
    textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() {
      @Override
      public void undoableEditHappened(UndoableEditEvent e) {
View Full Code Here

        setContentType(XMLEditorKit.XML_MIME_TYPE);
        setBackground(Color.white);
        //setFont(new Font("Monospaced", Font.PLAIN, 12));
               
        // add undoable edit
        undoManager = new UndoManager();
        UndoableEditListener undoableEditHandler = new UndoableEditListener() {
            public void undoableEditHappened(UndoableEditEvent e) {
                undoManager.addEdit(e.getEdit());
            }
        };
View Full Code Here

        return undoManager;
    }

    private void ensureUndoManager() {
        if (isEditable() && undoManager == null) {
            undoManager = new UndoManager();
            undoManager.setLimit(UNDO_LIMIT);
        }
    }
View Full Code Here

        return undoManager;
    }

    private void ensureUndoManager() {
        if (isEditable() && undoManager == null) {
            undoManager = new UndoManager();
            undoManager.setLimit(UNDO_LIMIT);
        }
    }
View Full Code Here

TOP

Related Classes of javax.swing.undo.UndoManager

Copyright © 2018 www.massapicom. 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.