/** * Removes all undoable edits from this document's undo manager. This * method also makes the undo/redo actions disabled. */ /* * NOTE: For some reason, it appears I have to create an entirely new * <code>undoManager</code> for undo/redo to continue functioning * properly; if I don't, it only ever lets you do one undo. Not * too sure why this is... */ public void discardAllEdits() { undoManager.discardAllEdits(); getDocument().removeUndoableEditListener(undoManager); undoManager = createUndoManager(); getDocument().addUndoableEditListener(undoManager); undoManager.updateActions(); }
@Override public void loadContent(@Nullable final File file) throws IOException { this.ignoreChange = true; try { if (file != null) { this.editor.setText(FileUtils.readFileToString(file, "UTF-8")); //NOI18N this.editor.setCaretPosition(0); } } finally { this.ignoreChange = false; } this.undoManager.discardAllEdits(); this.title.setChanged(false); this.mainPanel.revalidate(); this.mainPanel.repaint(); }
@Override public void loadContent(@Nullable final File file) throws IOException { this.ignoreChange = true; try { if (file != null) { this.editor.setText(FileUtils.readFileToString(file, "UTF-8")); //NOI18N this.editor.setCaretPosition(0); startRenderScript(); } } finally { this.ignoreChange = false; } this.undoManager.discardAllEdits(); this.title.setChanged(false); this.mainPanel.revalidate(); this.mainPanel.repaint(); }
/** * Removes all undoable edits from this document's undo manager. This * method also makes the undo/redo actions disabled. */ /* * NOTE: For some reason, it appears I have to create an entirely new * <code>undoManager</code> for undo/redo to continue functioning * properly; if I don't, it only ever lets you do one undo. Not * too sure why this is... */ public void discardAllEdits() { undoManager.discardAllEdits(); getDocument().removeUndoableEditListener(undoManager); undoManager = createUndoManager(); getDocument().addUndoableEditListener(undoManager); undoManager.updateActions(); }
/** * Removes all undoable edits from this document's undo manager. This * method also makes the undo/redo actions disabled. */ /* * NOTE: For some reason, it appears I have to create an entirely new * <code>undoManager</code> for undo/redo to continue functioning * properly; if I don't, it only ever lets you do one undo. Not * too sure why this is... */ public void discardAllEdits() { undoManager.discardAllEdits(); getDocument().removeUndoableEditListener(undoManager); undoManager = new RUndoManager(this); getDocument().addUndoableEditListener(undoManager); undoManager.updateActions(); }
/** * Removes all undoable edits from this document's undo manager. This * method also makes the undo/redo actions disabled. */ /* * NOTE: For some reason, it appears I have to create an entirely new * <code>undoManager</code> for undo/redo to continue functioning * properly; if I don't, it only ever lets you do one undo. Not * too sure why this is... */ public void discardAllEdits() { undoManager.discardAllEdits(); getDocument().removeUndoableEditListener(undoManager); undoManager = new RUndoManager(this); getDocument().addUndoableEditListener(undoManager); undoManager.updateActions(); }
this.undoManager.discardAllEdits();
this.undoManager.discardAllEdits();