public boolean isApplied() { return (compoundEdit!=null && compoundEdit.isApplied()); }
public boolean isApplied() { return (compoundEdit!=null && compoundEdit.isApplied()); }
@Override public void undo() { if (!applied) { throw new RuntimeException( "Attempt to undo edit that was never applied"); } if (linkUpEdit.isApplied()) linkUpEdit.undo(); if (compoundEdit1.isApplied()) compoundEdit1.undo(); applied = false; }
@Override protected void undoEditAction(DataflowImpl dataflow) { if (linkUpEdit.isApplied()) linkUpEdit.undo(); if (compoundEdit1.isApplied()) compoundEdit1.undo(); }
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }
/** * Attempts to call the doEdit method of all child edits. If any of those * children throws an EditException any successful edits are rolled back and * the exception is rethrown as the cause of a new EditException from the * CompoundEdit */ public synchronized Object doEdit() throws EditException { if (isApplied()) { throw new EditException("Cannot apply an edit more than once!"); } List<Edit<?>> doneEdits = new ArrayList<Edit<?>>(); try { for (Edit<?> edit : childEdits) { edit.doEdit(); // Insert the done edit at position 0 in the list so we can // iterate over the list in the normal order if we need to // rollback, this ensures that the most recent edit is first. doneEdits.add(0, edit); } applied = true; } catch (EditException ee) { for (Edit<?> undoMe : doneEdits) { undoMe.undo(); } applied = false; throw new EditException("Failed child of compound edit", ee); } return null; }