本文整理汇总了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 ();
}
}
示例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();
}
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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();
}
}
示例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);
}
示例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();
}
示例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;
}
}
}
}
示例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);
}
示例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();
}
示例12: redo
import javax.swing.undo.CannotRedoException; //导入依赖的package包/类
public void redo() throws CannotRedoException {
assert (undone) : "Already redone";
if (redoFail) {
throw new CannotRedoException();
}
undone = false;
}
示例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();
}
示例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));
}
}
示例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();
}
}
}