public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
public boolean addEdit(UndoableEdit edit) { boolean result = super.addEdit(edit); if (result && editedTime == 0) { editedTime = System.currentTimeMillis(); } return result; }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { // Track Caret and Document information of this compound edit lastOffset = editor.getCaretPosition(); lastLength = editor.getDocument().getLength(); // The compound edit is used to store incremental edits compoundEdit = new MyCompoundEdit(); compoundEdit.addEdit(anEdit); // The compound edit is added to the UndoManager. All incremental // edits stored in the compound edit will be undone/redone at once addEdit(compoundEdit); return compoundEdit; }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { // Track Caret and Document information of this compound edit // AbstractDocument.DefaultDocumentEvent docEvt = (DefaultDocumentEvent) anEdit; // The compound edit is used to store incremental edits compoundEdit = new MyCompoundEdit(); compoundEdit.addEdit(anEdit); // The compound edit is added to the UndoManager. All incremental // edits stored in the compound edit will be undone/redone at once addEdit(compoundEdit); return compoundEdit; }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { // Track Caret and Document information of this compound edit AbstractDocument.DefaultDocumentEvent docEvt = (DefaultDocumentEvent) anEdit; // The compound edit is used to store incremental edits compoundEdit = new MyCompoundEdit(); compoundEdit.addEdit(anEdit); // The compound edit is added to the UndoManager. All incremental // edits stored in the compound edit will be undone/redone at once addEdit(compoundEdit); return compoundEdit; }
public synchronized boolean addEdit(UndoableEdit anEdit) { assert (!(anEdit instanceof UndoableEditProxy)); boolean retVal; trimEdits(m_indexOfNextAdd, edits.size() - 1); retVal = super.addEdit(new UndoableEditProxy((FormUndoableEdit) anEdit)); if (isInProgress()) { retVal = true; } m_indexOfNextAdd = edits.size(); trimForLimit(); return retVal; }
private void startNewEdit (JTextComponent component, UndoableEdit atomicEdit) { if (edit != null) { // finish the last edit edit.end(); } edit = new MyCompoundEdit(); edit.addEdit(atomicEdit); super.undoableEditHappened(new UndoableEditEvent(component, edit)); lastOffset = component.getCaretPosition(); lastLength = component.getDocument().getLength(); }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { lastOffset = editor.getCaretPosition(); lastLength = editor.getDocument().getLength(); compoundEdit = (this.adapter != null) ? new TextCompoundEdit(adapter, this) : new TextCompoundEdit(editor, this); compoundEdit.addEdit(anEdit); Application.getInstance().getUndoManager().addEdit(compoundEdit); return compoundEdit; }
public void undoableEditHappened(UndoableEditEvent e) { if (compoundEdit == null || !compoundEdit.canUndo()) { compoundEdit = startCompoundEdit(e.getEdit()); lastLength = editor.getDocument().getLength(); return; } // See AbstractDocument.DefaultDocumentEvent.getPresentationName() method if("AbstractDocument.styleChangeText".equals(e.getEdit().getPresentationName())) { compoundEdit.addEdit(e.getEdit()); return; } int offsetChange = editor.getCaretPosition() - lastOffset; int lengthChange = editor.getDocument().getLength() - lastLength; if (Math.abs(offsetChange) == 1 && Math.abs(lengthChange) == 1) { compoundEdit.addEdit(e.getEdit()); lastOffset = editor.getCaretPosition(); lastLength = editor.getDocument().getLength(); return; } compoundEdit.end(); compoundEdit = startCompoundEdit(e.getEdit()); }
/** * When an undoable event is fired, we add it to the undo/redo list. */ public void undoableEditHappened(UndoableEditEvent e) { if (!getOperation()) { if (compoundEdit == null) undo.addEdit(e.getEdit()); else compoundEdit.addEdit(e.getEdit()); } }
/** * When an undoable event is fired, we add it to the undo/redo list. */ public void undoableEditHappened(UndoableEditEvent e) { if (!getOperation()) { if (compoundEdit == null) undo.addEdit(e.getEdit()); else compoundEdit.addEdit(e.getEdit()); } }
public void undoableEditHappened(UndoableEditEvent e) { if(!isEnabled()) return; CompoundEdit groupEdit = getUndoGroup(); if(groupEdit == null) addEditEvent(e.getEdit()); else groupEdit.addEdit(e.getEdit()); } }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { // Track Caret and Document information of this compound edit lastOffset = editor.getCaretPosition(); lastLength = editor.getStyledDocument().getLength(); // The compound edit is used to store incremental edits compoundEdit = new MyCompoundEdit(); compoundEdit.addEdit( anEdit ); // The compound edit is added to the UndoManager. All incremental // edits stored in the compound edit will be undone/redone at once addEdit( compoundEdit ); return compoundEdit; }
private CompoundEdit startCompoundEdit(UndoableEdit anEdit) { // Track Caret and Document information of this compound edit lastOffset = editor.getCaretPosition(); lastLength = editor.getStyledDocument().getLength(); // The compound edit is used to store incremental edits compoundEdit = new MyCompoundEdit(); compoundEdit.addEdit( anEdit ); // The compound edit is added to the UndoManager. All incremental // edits stored in the compound edit will be undone/redone at once addEdit( compoundEdit ); return compoundEdit; }
@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); }
@Override public void afterChangingColorOnElement(final IColorableNode element) { this.newColorChoice = new ColorChoice(element.getBackgroundColor(), element.getBorderColor(), element.getTextColor()); this.compoundBehavior.startHistoryCapture(); CompoundEdit currentCapturedEdit = this.compoundBehavior.getCurrentCapturedEdit(); currentCapturedEdit.addEdit(new UndoableColorEdit(element, this.oldColorChoice, this.newColorChoice)); this.compoundBehavior.stopHistoryCapture(); reset(); }