本文整理汇总了Java中org.eclipse.core.commands.operations.IOperationHistory.undo方法的典型用法代码示例。如果您正苦于以下问题:Java IOperationHistory.undo方法的具体用法?Java IOperationHistory.undo怎么用?Java IOperationHistory.undo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.commands.operations.IOperationHistory
的用法示例。
在下文中一共展示了IOperationHistory.undo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertDeleteConstraint
import org.eclipse.core.commands.operations.IOperationHistory; //导入方法依赖的package包/类
public void assertDeleteConstraint(PeriodicTemporalConstraint constraint, Timepoint timepoint) {
TemporalBoundColumn column = new TemporalBoundColumn(TEST_PROVIDER, timepoint);
EActivity a = constructBoundedActivity(constraint);
ConstraintsMember originalFacet = column.getFacet(a);
String originalText = column.getText(originalFacet);
column.modify(originalFacet, "", undoContext);
ConstraintsMember constraintsMember = a.getMember(ConstraintsMember.class, true);
List<PeriodicTemporalConstraint> bounds = constraintsMember.getPeriodicTemporalConstraints();
assertEquals("Number mismatch in bounds count after editing", 0, bounds.size());
ConstraintsMember changedFacet = column.getFacet(a);
assertEquals("Column text not equal", column.getText(changedFacet), "");
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.undo(undoContext, null, null);
} catch (Exception e) {
fail(e.getMessage());
}
ConstraintsMember finalFacet = column.getFacet(a);
assertEquals("Error in undo operation", originalText, column.getText(finalFacet));
}
示例2: undoOperation
import org.eclipse.core.commands.operations.IOperationHistory; //导入方法依赖的package包/类
/**
* Undo the given operation, which should be the next operation in the undo context.
* Tests that the operation can be undone, that it is the next in the undo context,
* that the undo result isOK() and that no ExecutionException is thrown.
* @param operation
* @param undoContext
* @param undoingRedo supply true if undoing a redo, to get a different error string during failure
*/
public static final void undoOperation(IUndoableOperation operation, IUndoContext undoContext, boolean undoingRedo) {
TestCase.assertTrue(operation.canUndo());
String string = "failed to undo" + (undoingRedo ? " the redo" : "");
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
TestCase.assertSame("the supplied operation should be next on the undo stack", operation, history.getUndoOperation(undoContext));
IStatus result = history.undo(undoContext, null, null);
TestCase.assertTrue(string + ": " + operation.getLabel(), result.isOK());
} catch (ExecutionException e) {
TestCase.fail(string);
}
TestCase.assertFalse(operation.canUndo());
TestCase.assertTrue(operation.canRedo());
}
示例3: undo
import org.eclipse.core.commands.operations.IOperationHistory; //导入方法依赖的package包/类
@Override
public void undo() {
try {
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
history.undo(context, null, null);
} catch (ExecutionException e) {
Logger.getLogger(OperationCommand.class).error("failed to undo: " + operation.toString(), e);
}
}
示例4: runWithEvent
import org.eclipse.core.commands.operations.IOperationHistory; //导入方法依赖的package包/类
@Override
public void runWithEvent(Event event) {
if (viewer != null && !viewer.getTextWidget().isDisposed()) {
XLIFFEditorImplWithNatTable xliffEditor = XLIFFEditorImplWithNatTable.getCurrent();
// 先保存在撤销,除非以后取消两种模式,否则不要删除此判断
if (viewer.canDoOperation(ITextOperationTarget.UNDO)) {
HsMultiActiveCellEditor.commit(true);
}
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
IUndoContext undoContext = (IUndoContext) xliffEditor.getTable().getData(IUndoContext.class.getName());
if (history.canUndo(undoContext)) {
try {
history.undo(undoContext, null, null);
undoBean.setCrosseStep(undoBean.getCrosseStep() + 1);
} catch (ExecutionException e) {
e.printStackTrace();
}
}
XLIFFEditorImplWithNatTable.getCurrent().redraw();
updateActionsEnableState();
return;
}
if (undoAction != null) {
undoAction.runWithEvent(event);
return;
}
}
示例5: runWithEvent
import org.eclipse.core.commands.operations.IOperationHistory; //导入方法依赖的package包/类
public void runWithEvent(Event event) {
TeActiveCellEditor.commit();
IOperationHistory history = OperationHistoryFactory.getOperationHistory();
IUndoContext context = PlatformUI.getWorkbench().getOperationSupport().getUndoContext();
if (history.canUndo(context)) {
try {
history.undo(context, null, null);
updateActionsEnableState();
} catch (ExecutionException e) {
e.printStackTrace();
}
}
}