Java 类javax.swing.undo.CannotRedoException 实例源码

项目:incubator-netbeans    文件:BaseDocument.java   
public @Override void redo() throws CannotRedoException {
    if (previousEdit != null) {
        previousEdit.redo();
    }

    atomicLockImpl ();
    try {
        TokenHierarchyControl<?> thcInactive = thcInactive();
        try {
            super.redo();
        } finally {
            if (thcInactive != null) {
                thcInactive.setActive(true);
            }
        }
    } finally {
        atomicUnlockImpl ();
    }
}
项目:incubator-netbeans    文件:StableCompoundEdit.java   
@Override
   public void redo() throws CannotRedoException {
if (!canRedo()) {
    throw new CannotRedoException();
}
       int i = 0;
       int size = edits.size();
       try {
           for (; i < size; i++) {
               edits.get(i).redo();
           }
           setStatusBits(HAS_BEEN_DONE);
       } finally {
           if (i != size) { // i-th edit's redo failed => undo the ones below
               while (--i >= 0) {
                   edits.get(i).undo();
               }
           }
       }
   }
项目:incubator-netbeans    文件:WrapUndoEdit.java   
@Override
public void redo() throws CannotRedoException {
    undoRedoManager.checkLogOp("WrapUndoEdit.redo", this);
    boolean savepoint = undoRedoManager.isAtSavepoint();
    if (savepoint) {
        undoRedoManager.beforeRedoAtSavepoint(this);
    }
    boolean done = false;
    try {
        delegate.redo();
        done = true;
        // This will only happen if delegate.redo() does not throw CannotRedoException
        undoRedoManager.afterRedoCheck(this);
    } finally {
        if (!done && savepoint) {
            undoRedoManager.delegateRedoFailedAtSavepoint(this);
        }
    }
}
项目:incubator-netbeans    文件:PropertiesOpen.java   
/** Implements {@code UndoRedo}. Redo a previously undone edit. It finds a manager which next undo edit has the highest 
 * time stamp and makes undo on it.
 * @exception CannotRedoException if it fails
 */
@Override
public synchronized void redo () throws CannotRedoException {
    PropertiesEditorSupport.UndoRedoStampFlagManager chosenManager = (PropertiesEditorSupport.UndoRedoStampFlagManager)getNextRedo();

    if (chosenManager == null) {
        throw new CannotRedoException();
    } else {
        Object atomicFlag = chosenManager.getAtomicFlagOfEditToBeRedone();
        if (atomicFlag == null) {// not linked with other edits as one atomic action
            chosenManager.redo();
        } else { // atomic redo compound from more edits in underlying managers
            boolean redone;
            do { // the atomic action can consists from more redo edits from same manager
                redone = false;
                for (Iterator<Manager> it = managers.iterator(); it.hasNext(); ) {
                    PropertiesEditorSupport.UndoRedoStampFlagManager manager = (PropertiesEditorSupport.UndoRedoStampFlagManager)it.next();
                    if(atomicFlag.equals(manager.getAtomicFlagOfEditToBeRedone())) {
                        manager.redo();
                        redone = true;
                    }
                }
            } while(redone);
        }
    }
}
项目:incubator-netbeans    文件:StableCompoundEdit.java   
@Override
   public void redo() throws CannotRedoException {
if (!canRedo()) {
    throw new CannotRedoException();
}
       int i = 0;
       int size = edits.size();
       try {
           for (; i < size; i++) {
               edits.get(i).redo();
           }
           setStatusBits(HAS_BEEN_DONE);
       } finally {
           if (i != size) { // i-th edit's redo failed => undo the ones below
               while (--i >= 0) {
                   edits.get(i).undo();
               }
           }
       }
   }
项目:incubator-netbeans    文件:DocumentTesting.java   
public static void redo(Context context, final int count) throws Exception {
    final Document doc = getDocument(context);
    final UndoManager undoManager = (UndoManager) doc.getProperty(UndoManager.class);
    logUndoRedoOp(context, "REDO", count);
    invoke(context, new Runnable() {
        @Override
        public void run() {
            try {
                int cnt = count;
                while (undoManager.canRedo() && --cnt >= 0) {
                    undoManager.redo();
                }
            } catch (CannotRedoException e) {
                throw new IllegalStateException(e);
            }
        }
    });
    logPostUndoRedoOp(context, count);
}
项目:Pogamut3    文件:LapTreeMVElement.java   
@Override
public void redo() throws CannotRedoException {
    try {
        ignore = true;
        // take text from position + 1
        String planText = history.get(position + 1);
        // parse it
        PoshParser parser = new PoshParser(new StringReader(planText));
        PoshPlan plan = parser.parsePlan();
        // synchronize with the editor tree
        lapTree.synchronize(plan);

        if (position < history.size() - 1) {
            ++position;
        }
    } catch (ParseException ex) {
        throw new CannotRedoException();
    } finally {
        ignore = false;
        cs.fireChange();
    }
}
项目:JavaGraph    文件:SystemStore.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    try {
        Set<QualName> deleted = new HashSet<>(this.oldTexts.keySet());
        deleted.removeAll(this.newTexts.keySet());
        doDeleteTexts(getResourceKind(), deleted);
        if (this.newProps != null) {
            doPutProperties(this.newProps);
        }
        doPutTexts(getResourceKind(), this.newTexts);
    } catch (IOException exc) {
        throw new CannotRedoException();
    }
    notifyObservers(this);
}
项目:JavaGraph    文件:SystemStore.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    try {
        boolean layout = getType() == LAYOUT;
        if (!layout) {
            Set<QualName> deleted = getNames(this.oldGraphs);
            deleted.removeAll(getNames(this.newGraphs));
            doDeleteGraphs(getResourceKind(), deleted);
            if (this.newProps != null) {
                doPutProperties(this.newProps);
            }
        }
        doPutGraphs(getResourceKind(), this.newGraphs, layout);
    } catch (IOException exc) {
        throw new CannotRedoException();
    }
    notifyObservers(this);
}
项目:Neukoelln_SER316    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        System.out.println("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:incubator-netbeans    文件:UndoRedoSupport.java   
@Override
public void redo() throws CannotRedoException {
    synchronized(delegates) {
        for (CompoundUndoManager cm : delegates) {
            if(cm.hasFocus()) {
                cm.redo();
                return;
            }
        }
    }
}
项目:SER316-Aachen    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        System.out.println("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:incubator-netbeans    文件:DocumentContent.java   
public @Override void redo() throws CannotRedoException {
    super.redo();

    if (debugUndo) {
        /*DEBUG*/System.err.println("REDO-" + dump()); // NOI18N
    }
    undoOrRedo(length, false);
}
项目:incubator-netbeans    文件:UndoableWrapper.java   
@Override
public void redo() throws CannotRedoException {
    JTextComponent focusedComponent = EditorRegistry.focusedComponent();
    if (focusedComponent != null) {
        if (focusedComponent.getDocument() == ces.getDocument()) {
            //call global undo only for focused component
            undoManager.redo(session);
        }
    }
    //delegate.redo();
    inner.redo();
}
项目:incubator-netbeans    文件:Deadlock207571Test.java   
public void redo() throws CannotRedoException {
    assert (undone) : "Already redone";
    if (redoFail) {
        throw new CannotRedoException();
    }
    undone = false;
}
项目:incubator-netbeans    文件:InstantRefactoringPerformer.java   
@Override
            public void redo() throws CannotRedoException {
//                JTextComponent focusedComponent = EditorRegistry.focusedComponent();
//                if (focusedComponent != null) {
//                    if (focusedComponent.getDocument() == ces.getDocument()) {
//                        //call global undo only for focused component
//                        undoManager.redo(session);
//                    }
//                }
                //delegate.redo();
                inner.redo();
            }
项目:incubator-netbeans    文件:PropertiesEditorSupport.java   
/** Overrides superclass method. Updates time stamp for that edit. */
@Override
public synchronized void redo() throws CannotRedoException {
    UndoableEdit anEdit = editToBeRedone();
    if(anEdit != null) {
        Object atomicFlag = stampFlags.get(anEdit).getAtomicFlag(); // atomic flag remains
        super.redo();
        stampFlags.put(anEdit, new StampFlag(System.currentTimeMillis(), atomicFlag));
    }
}
项目:incubator-netbeans    文件:AbstractModel.java   
@Override
public void redo() throws CannotRedoException {
    boolean redoStartedTransaction = false;
    boolean needsRefresh = true;
    try {
        startTransaction(true, true); //start pseudo transaction for event firing
        redoStartedTransaction = true;
        AbstractModel.this.getAccess().prepareForUndoRedo();
        super.redo(); 
        AbstractModel.this.getAccess().finishUndoRedo();
        endTransaction();
        needsRefresh = false;
    } catch(CannotRedoException ex) {
        needsRefresh = false;
        throw ex;
    } finally {
        if (isIntransaction() && redoStartedTransaction) {
            try {
                endTransaction(true); // do not fire events
            } catch(Exception e) {
                Logger.getLogger(getClass().getName()).log(Level.INFO, "Redo error", e); //NOI18N
            }
        }
        if (needsRefresh) {
            setState(State.NOT_SYNCED);
            refresh();
        }
    }
}
项目:incubator-netbeans    文件:ContentEdit.java   
@Override
   public void redo() throws CannotRedoException {
if (!canRedo()) {
    throw new CannotRedoException();
}
statusBits |= HAS_BEEN_DONE;
   }
项目:incubator-netbeans    文件:ModRootElement.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    // #145588 - must recompute index according to current modList state
    index = findModElementIndex(modElement.getStartOffset(), true);
    run();
}
项目:incubator-netbeans    文件:ExpectedDocumentContent.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    if (removal) {
        removeEdit(this);
    } else {
        insertEdit(this);
    }
}
项目:incubator-netbeans    文件:PositionSyncList.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    if (mayDifferPairs != null) {
        for (PositionPair pair : mayDifferPairs) {
            assert (pair.mayDiffer) : "Invalid pair: " + pair; // NOI18N
            pair.mayDiffer = false;
        }
    }
    mayDifferUndoItem = this;
}
项目:incubator-netbeans    文件:StableCompoundEditTest.java   
@Override
public void redo() throws CannotRedoException {
    if (fireException) {
        throw new CannotRedoException();
    }
    super.redo();
}
项目:incubator-netbeans    文件:GapBranchElement.java   
public void redo() throws CannotRedoException {
    super.redo();

    // Switch childrenAdded with childrenRemoved
    Element[] tmp = childrenRemoved;
    childrenRemoved = childrenAdded;
    childrenAdded = tmp;

    replace(index, childrenRemoved.length, childrenAdded);
}
项目:incubator-netbeans    文件:XDMModelUndoableEdit.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
       try {
           model.resetDocument(newDocument);
       } catch (RuntimeException ex) {
           if (newDocument != model.getCurrentDocument()) {
               CannotRedoException e = new CannotRedoException();
               e.initCause(ex);
               throw e;
           } else {
               throw ex;
           }
       }
}
项目:incubator-netbeans    文件:RedoAction.java   
public void performAction() {
    try {
        UndoRedo undoRedo = UndoAction.getUndoRedo();

        if (undoRedo.canRedo()) {
            undoRedo.redo();
        }
    } catch (CannotRedoException ex) {
        UndoRedoAction.cannotUndoRedo(ex);
    }

    UndoAction.updateStatus();
}
项目:incubator-netbeans    文件:IssueTopComponent.java   
@Override
public void redo() throws CannotRedoException {
    if(delegate != null) {
        delegate.redo();
    } else {
        UndoRedo.NONE.redo();
    }
}
项目:EditCalculateAndChart    文件:Redo_Action.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
         TEdit.showDialog("Unable to redo: " + ex.getMessage());
        //ex.printStackTrace();
    }
    updateState();
}
项目:SER316-Dresden    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        Util.debug("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:JavaGraph    文件:SystemStore.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    try {
        doPutProperties(this.newProperties);
    } catch (IOException exc) {
        throw new CannotRedoException();
    }
    notifyObservers(this);
}
项目:powertext    文件:RTextArea.java   
/**
 * Attempt to redo the last action.
 *
 * @see #undoLastAction()
 */
public void redoLastAction() {
    // NOTE:  The try/catch block shouldn't be necessary...
    try {
        if (undoManager.canRedo()) {
            undoManager.redo();
        }
    } catch (CannotRedoException cre) {
        cre.printStackTrace();
    }
}
项目:jaer    文件:BiasgenFrame.java   
void redo() {
    try {
        undoManager.redo();
    } catch (CannotRedoException e) {
        Toolkit.getDefaultToolkit().beep();
        log.warning(e.getMessage());
    } finally {
        fixUndoRedo();
    }
}
项目:SER316-Munich    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        System.out.println("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:OpenJSharp    文件:GapContent.java   
public void redo() throws CannotRedoException {
    super.redo();
    try {
        insertString(offset, string);
        string = null;
        // Update the Positions that were in the range removed.
        if(posRefs != null) {
            updateUndoPositions(posRefs, offset, length);
            posRefs = null;
        }
    } catch (BadLocationException bl) {
        throw new CannotRedoException();
    }
}
项目:OpenJSharp    文件:GapContent.java   
public void redo() throws CannotRedoException {
    super.redo();
    try {
        string = getString(offset, length);
        // Get the Positions in the range being removed.
        posRefs = getPositionsInRange(null, offset, length);
        remove(offset, length);
    } catch (BadLocationException bl) {
      throw new CannotRedoException();
    }
}
项目:OpenJSharp    文件:DefaultStyledDocument.java   
/**
 * Redoes a change.
 *
 * @exception CannotRedoException if the change cannot be redone
 */
public void redo() throws CannotRedoException {
    super.redo();
    MutableAttributeSet as = (MutableAttributeSet)element
                             .getAttributes();
    if(isReplacing)
        as.removeAttributes(as);
    as.addAttributes(newAttributes);
}
项目:SER316-Ingolstadt    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        System.out.println("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:MaxSim    文件:DiagramScene.java   
@Override
public void redo() throws CannotRedoException {
    super.redo();
    boolean b = scene.getUndoRedoEnabled();
    scene.setUndoRedoEnabled(false);
    scene.getModel().getViewChangedEvent().addListener(this);
    scene.getModel().setData(newModel);
    scene.getModel().getViewChangedEvent().removeListener(this);
    scene.setUndoRedoEnabled(b);
}
项目:Wilmersdorf_SER316    文件:HTMLEditor.java   
public void actionPerformed(ActionEvent e) {
    try {
        undo.redo();
    } catch (CannotRedoException ex) {
        System.out.println("Unable to redo: " + ex);
        ex.printStackTrace();
    }
    update();
    undoAction.update();
}
项目:Cognizant-Intelligent-Test-Scripter    文件:ColUndoableEdit.java   
@Override
public void redo() throws CannotRedoException {
    startProgress();
    if (added) {
        getModel().insertColumnAt(colIndex, colName, values);
    } else {
        getModel().removeColumn(colIndex);
    }
    super.redo();
    stopProgress();
}