javax.swing.undo.CannotRedoException源码实例Demo

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

下面列出了javax.swing.undo.CannotRedoException 类实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: openAGV   文件: BringToFrontAction.java
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
  final DrawingView view = getView();
  final LinkedList<Figure> figures = new LinkedList<>(view.getSelectedFigures());
  bringToFront(view, figures);
  fireUndoableEditHappened(new AbstractUndoableEdit() {
    @Override
    public String getPresentationName() {
      return ResourceBundleUtil.getBundle(TOOLBAR_PATH).getString("bringToFrontAction.undo.presentationName");
    }

    @Override
    public void redo()
        throws CannotRedoException {
      super.redo();
      BringToFrontAction.bringToFront(view, figures);
    }

    @Override
    public void undo()
        throws CannotUndoException {
      super.undo();
      SendToBackAction.sendToBack(view, figures);
    }
  });
}
 
源代码2 项目: openAGV   文件: SendToBackAction.java
@Override
public void actionPerformed(java.awt.event.ActionEvent e) {
  final DrawingView view = getView();
  final LinkedList<Figure> figures = new LinkedList<>(view.getSelectedFigures());
  sendToBack(view, figures);
  fireUndoableEditHappened(new AbstractUndoableEdit() {
    @Override
    public String getPresentationName() {
      return ResourceBundleUtil.getBundle(TOOLBAR_PATH).getString("sendToBackAction.undo.presentationName");
    }

    @Override
    public void redo()
        throws CannotRedoException {
      super.redo();
      SendToBackAction.sendToBack(view, figures);
    }

    @Override
    public void undo()
        throws CannotUndoException {
      super.undo();
      BringToFrontAction.bringToFront(view, figures);
    }
  });
}
 
源代码3 项目: 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();
               }
           }
       }
   }
 
源代码4 项目: 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);
        }
    }
}
 
源代码5 项目: 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 ();
    }
}
 
源代码6 项目: 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);
        }
    }
}
 
源代码7 项目: 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();
               }
           }
       }
   }
 
源代码8 项目: 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);
}
 
源代码9 项目: constellation   文件: LockingManager.java
@Override
public void redo() {

    if (!canRedo() || !executed.compareAndSet(false, true)) {
        throw new CannotRedoException();
    }

    new Thread(() -> {
        // Get the global write lock because we will change the graph
        globalWriteLock.lock();
        try {
            writeContext.target.setOperationMode(GraphOperationMode.REDO);
            execute(writeContext.target);
            writeContext.target.validateKeys();
            writeContext.target.setOperationMode(GraphOperationMode.EXECUTE);

            // Switch the read context to the write context
            final Context originalReadContext = readContext;
            readContext = writeContext;

            originalReadContext.lock.writeLock().lock();
            try {
                originalReadContext.target.setOperationMode(GraphOperationMode.REDO);
                execute(originalReadContext.target);
                originalReadContext.target.validateKeys();
                originalReadContext.target.setOperationMode(GraphOperationMode.EXECUTE);
            } finally {
                originalReadContext.lock.writeLock().unlock();
            }

            // Switch the write context
            writeContext = originalReadContext;
        } finally {
            // Unlock the global write lock so new write requests can begin on the new write context
            globalWriteLock.unlock();
        }
    }).start();

    update(null, null);
}
 
源代码10 项目: openAGV   文件: UndoRedoManager.java
/**
 * Undoes or redoes the last edit event.
 * The UndoRedoManager ignores all incoming UndoableEdit events,
 * while undo or redo is in progress.
 */
@Override
public void undoOrRedo()
    throws CannotUndoException, CannotRedoException {
  undoOrRedoInProgress = true;

  try {
    super.undoOrRedo();
  }
  finally {
    undoOrRedoInProgress = false;
    updateActions();
  }
}
 
源代码11 项目: openAGV   文件: UndoRedoManager.java
@Override
public void actionPerformed(ActionEvent evt) {
  try {
    redo();
  }
  catch (CannotRedoException e) {
    LOG.debug("Cannot redo: {}", e);
  }
}
 
源代码12 项目: openAGV   文件: AbstractTreeViewPanel.java
@Override
public void redo()
    throws CannotRedoException {
  super.redo();
  // TODO: Delete again ...
  for (UserObject userObject : userObjects) {
    userObject.removed();
  }
}
 
源代码13 项目: openAGV   文件: CoordinateUndoActivity.java
@Override
public void redo()
    throws CannotRedoException {
  super.redo();

  pxModel.copyFrom(pxAfterModification);
  pyModel.copyFrom(pyAfterModification);
  pxModel.markChanged();
  pyModel.markChanged();

  saveTransformForRedo();

  pxModel.getModel().propertiesChanged(new NullAttributesChangeListener());
}
 
源代码14 项目: openAGV   文件: PropertyUndoActivity.java
@Override
public void redo() throws CannotRedoException {
  fProperty.copyFrom(fAfterModification);
  fProperty.markChanged();
  fProperty.getModel().propertiesChanged(new NullAttributesChangeListener());
  hasBeenDone = true;
}
 
源代码15 项目: openAGV   文件: DeleteEdit.java
@Override
public void redo() throws CannotRedoException {
  super.redo();
  for (Figure figure : figures) {
    drawingView.getDrawing().remove(figure);
  }
}
 
源代码16 项目: openjdk-jdk8u-backup   文件: 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();
    }
}
 
源代码17 项目: jdk8u-jdk   文件: 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();
    }
}
 
/**
 * 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);
}
 
源代码19 项目: MeteoInfo   文件: FrmMain.java
private void jMenuItem_RedoActionPerformed(ActionEvent evt) {
    try {
        currentUndoManager.redo();
    } catch (CannotRedoException cre) {
    }
    this.refreshUndoRedo();
}
 
源代码20 项目: Bytecoder   文件: GapContent.java
@SuppressWarnings("unchecked")
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();
    }
}
 
源代码21 项目: dragonwell8_jdk   文件: 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();
    }
}
 
@Override
public synchronized void redo() throws CannotRedoException {
    startProgress();
    for (int i = groupEdits.size() - 1; i >= 0; i--) {
        groupEdits.get(i).redo();
    }
    super.redo();
    stopProgress();
}
 
源代码23 项目: dragonwell8_jdk   文件: 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);
}
 
源代码24 项目: TencentKona-8   文件: 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);
}
 
源代码25 项目: TencentKona-8   文件: 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();
    }
}
 
源代码26 项目: TencentKona-8   文件: 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);
}
 
@Override
public void redo() throws CannotRedoException {
    startProgress();
    if (added) {
        getModel().insertRow(row, values);
    } else {
        getModel().removeRow(row);
    }
    super.redo();
    stopProgress();
}
 
源代码28 项目: jdk8u60   文件: 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);
}
 
源代码29 项目: jdk8u60   文件: 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();
    }
}
 
源代码30 项目: openjdk-jdk9   文件: GapContent.java
@SuppressWarnings("unchecked")
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();
    }
}
 
源代码评论
动弹
沙发等你来抢
 类所在包
 类方法
 同包方法