/** * Begins an "atomic edit." All text editing operations between this call * and the next call to <tt>endAtomicEdit()</tt> will be treated as a * single operation by the undo manager.<p> * * Using this method should be done with great care. You should probably * wrap the call to <tt>endAtomicEdit()</tt> in a <tt>finally</tt> block: * * <pre> * textArea.beginAtomicEdit(); * try { * // Do editing * } finally { * textArea.endAtomicEdit(); * } * </pre> * * @see #endAtomicEdit() */ public void beginAtomicEdit() { undoManager.beginInternalAtomicEdit(); }
/** * "Plays back" the last recorded macro in this text area. */ public synchronized void playbackLastMacro() { if (currentMacro!=null) { List<MacroRecord> macroRecords = currentMacro.getMacroRecords(); if (!macroRecords.isEmpty()) { Action[] actions = getActions(); undoManager.beginInternalAtomicEdit(); try { for (MacroRecord record : macroRecords) { for (int i=0; i<actions.length; i++) { if ((actions[i] instanceof RecordableTextAction) && record.id.equals( ((RecordableTextAction)actions[i]).getMacroID())) { actions[i].actionPerformed( new ActionEvent(this, ActionEvent.ACTION_PERFORMED, record.actionCommand)); break; } } } } finally { undoManager.endInternalAtomicEdit(); } } } }
undoManager.beginInternalAtomicEdit(); ((AbstractDocument)doc).replace(start, end - start, str, null);
/** * Begins an "atomic edit." All text editing operations between this call * and the next call to <tt>endAtomicEdit()</tt> will be treated as a * single operation by the undo manager.<p> * * Using this method should be done with great care. You should probably * wrap the call to <tt>endAtomicEdit()</tt> in a <tt>finally</tt> block: * * <pre> * textArea.beginAtomicEdit(); * try { * // Do editing * } finally { * textArea.endAtomicEdit(); * } * </pre> * * @see #endAtomicEdit() */ public void beginAtomicEdit() { undoManager.beginInternalAtomicEdit(); }
/** * Begins an "atomic edit." All text editing operations between this call * and the next call to <tt>endAtomicEdit()</tt> will be treated as a * single operation by the undo manager.<p> * * Using this method should be done with great care. You should probably * wrap the call to <tt>endAtomicEdit()</tt> in a <tt>finally</tt> block: * * <pre> * textArea.beginAtomicEdit(); * try { * // Do editing * } finally { * textArea.endAtomicEdit(); * } * </pre> * * @see #endAtomicEdit() */ public void beginAtomicEdit() { undoManager.beginInternalAtomicEdit(); }
/** * Begins an "atomic edit." All text editing operations between this call * and the next call to <tt>endAtomicEdit()</tt> will be treated as a * single operation by the undo manager.<p> * * Using this method should be done with great care. You should probably * wrap the call to <tt>endAtomicEdit()</tt> in a <tt>finally</tt> block: * * <pre> * textArea.beginAtomicEdit(); * try { * // Do editing * } finally { * textArea.endAtomicEdit(); * } * </pre> * * @see #endAtomicEdit() */ public void beginAtomicEdit() { undoManager.beginInternalAtomicEdit(); }
int num = macroRecords.size(); if (num>0) { undoManager.beginInternalAtomicEdit(); try { for (int i=0; i<num; i++) {
int num = macroRecords.size(); if (num>0) { undoManager.beginInternalAtomicEdit(); try { for (int i=0; i<num; i++) {
/** * "Plays back" the last recorded macro in this text area. */ public synchronized void playbackLastMacro() { if (currentMacro!=null) { List<MacroRecord> macroRecords = currentMacro.getMacroRecords(); if (!macroRecords.isEmpty()) { Action[] actions = getActions(); undoManager.beginInternalAtomicEdit(); try { for (MacroRecord record : macroRecords) { for (int i=0; i<actions.length; i++) { if ((actions[i] instanceof RecordableTextAction) && record.id.equals( ((RecordableTextAction)actions[i]).getMacroID())) { actions[i].actionPerformed( new ActionEvent(this, ActionEvent.ACTION_PERFORMED, record.actionCommand)); break; } } } } finally { undoManager.endInternalAtomicEdit(); } } } }
undoManager.beginInternalAtomicEdit(); ((AbstractDocument)doc).replace(start, end - start, str, null);
undoManager.beginInternalAtomicEdit(); ((AbstractDocument)doc).replace(start, end - start, str, null);
undoManager.beginInternalAtomicEdit(); ((AbstractDocument)doc).replace(start, end - start, str, null);