当前位置: 首页>>代码示例>>Java>>正文


Java CannotRedoException类代码示例

本文整理汇总了Java中javax.swing.undo.CannotRedoException的典型用法代码示例。如果您正苦于以下问题:Java CannotRedoException类的具体用法?Java CannotRedoException怎么用?Java CannotRedoException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CannotRedoException类属于javax.swing.undo包,在下文中一共展示了CannotRedoException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
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 ();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:BaseDocument.java

示例2: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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();
               }
           }
       }
   }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:StableCompoundEdit.java

示例3: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:WrapUndoEdit.java

示例4: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
/** 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);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:PropertiesOpen.java

示例5: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:DocumentTesting.java

示例6: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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();
    }
}
 
开发者ID:kefik,项目名称:Pogamut3,代码行数:23,代码来源:LapTreeMVElement.java

示例7: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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);
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:17,代码来源:SystemStore.java

示例8: actionPerformed

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
public void actionPerformed(ActionEvent e) {
	try {
		undo.redo();
	} catch (CannotRedoException ex) {
		System.out.println("Unable to redo: " + ex);
		ex.printStackTrace();
	}
	update();
	undoAction.update();
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:11,代码来源:HTMLEditor.java

示例9: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@Override
public void redo() throws CannotRedoException {
    synchronized(delegates) {
        for (CompoundUndoManager cm : delegates) {
            if(cm.hasFocus()) {
                cm.redo();
                return;
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:UndoRedoSupport.java

示例10: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
public @Override void redo() throws CannotRedoException {
    super.redo();

    if (debugUndo) {
        /*DEBUG*/System.err.println("REDO-" + dump()); // NOI18N
    }
    undoOrRedo(length, false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DocumentContent.java

示例11: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:UndoableWrapper.java

示例12: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
public void redo() throws CannotRedoException {
    assert (undone) : "Already redone";
    if (redoFail) {
        throw new CannotRedoException();
    }
    undone = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:Deadlock207571Test.java

示例13: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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();
            }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:InstantRefactoringPerformer.java

示例14: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
/** 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));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:PropertiesEditorSupport.java

示例15: redo

import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
@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();
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:AbstractModel.java


注:本文中的javax.swing.undo.CannotRedoException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。