/** * Used for ReplaceAll. * This merges all text changes made between the beginCompoundEdit() * and the endCompoundEdit() calls into only one undo event. */ public void beginCompoundEdit() { if (compoundEdit == null) compoundEdit = new CompoundEdit(); }
/** * Used for ReplaceAll. This merges all text changes made between the beginCompoundEdit() and the endCompoundEdit() * calls into only one undo event. */ public void beginCompoundEdit() { if (compoundEdit == null) compoundEdit = new CompoundEdit(); }
/** * Starts capturing actions on graph */ protected void startHistoryCapture() { if (this.currentCapturedEdit == null) { this.currentCapturedEdit = new CompoundEdit(); } }
private void undoPending() { synchronized( pendingEdits ) { if( pendingEditCount > 0 ) { pendingEdits.end(); pendingEdits.undo(); pendingEdits = new CompoundEdit(); pendingEditCount = 0; } } }
@Override public synchronized boolean addEdit(UndoableEdit anEdit) { if (_cache == null) { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Create cache: " + anEdit); } _cache = new CompoundEdit(); boolean ret = _cache.addEdit(anEdit); if (ret) { _timer = new Timer(_delay, new ActionListener() { public void actionPerformed(ActionEvent e) { commitCache(); } }); _timer.setRepeats(false); _timer.start(); } return ret; } else { if (LOGGER.isLoggable(Level.FINE)) { LOGGER.fine("Add to cache: " + anEdit); } if (_timer != null) { _timer.restart(); } return _cache.addEdit(anEdit); } }
/** * Purge the undo history and * update the undo / redo actions enabled / disabled state. * * @see de.sciss.app.Document#setDirty( boolean ) */ public void discardAllEdits() { synchronized( pendingEdits ) { pendingEdits.die(); pendingEdits = new CompoundEdit(); pendingEditCount = 0; } super.discardAllEdits(); updateStates(); }
} else { System.out.println("replace"); compoundEdit = new CompoundEdit(); super.fireUndoableEditUpdate(new UndoableEditEvent(this, compoundEdit)); super.replace(offset, length, text, attrs);
checkLogOp("addEdit-inSaveActions", edit); // NOI18N if (onSaveTasksEdit == null) { onSaveTasksEdit = new CompoundEdit();
/** * Instantiate a new UndoManager. * * @param doc the document whose edits are monitored */ public UndoManager( Document doc ) { super(); setLimit( 1000 ); this.doc = doc; undoText = doc.getApplication().getResourceString( "menuUndo" ); redoText = doc.getApplication().getResourceString( "menuRedo" ); undoAction = createUndoAction(); redoAction = createRedoAction(); pendingEdits= new CompoundEdit(); updateStates(); }
@Override public synchronized boolean addEdit(UndoableEdit edit) { if (!isInProgress()) { return false; } if (edit == BEGIN_COMMIT_GROUP) { beginUndoGroup(); return true; } else if (edit == END_COMMIT_GROUP) { endUndoGroup(); return true; } else if (edit == MARK_COMMIT_GROUP) { commitUndoGroup(); return true; } if (needsNestingCommit > 0) { commitUndoGroup(); } if (!awaitingOnSaveTasks && buildUndoGroup > 0) { if (undoGroup == null) { undoGroup = new CompoundEdit(); } return undoGroup.addEdit(edit); } return addEditImpl(edit); }
TextArea.undo.setLimit(500); TextArea.compoundEdit = new CompoundEdit(); TextArea.undo.addEdit(TextArea.compoundEdit); if (TextArea.compoundEdit.isInProgress()) TextArea.compoundEdit.end(); TextArea.compoundEdit = new CompoundEdit(); TextArea.undo.addEdit(TextArea.compoundEdit); } else if (! TextArea.compoundEdit.isInProgress()) { TextArea.compoundEdit = new CompoundEdit(); TextArea.undo.addEdit(TextArea.compoundEdit);
pendingEdits.end(); super.addEdit( pendingEdits ); pendingEdits = new CompoundEdit(); pendingEditCount = 0;