本文整理汇总了Java中org.eclipse.core.commands.operations.IUndoableOperation.canUndo方法的典型用法代码示例。如果您正苦于以下问题:Java IUndoableOperation.canUndo方法的具体用法?Java IUndoableOperation.canUndo怎么用?Java IUndoableOperation.canUndo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.commands.operations.IUndoableOperation
的用法示例。
在下文中一共展示了IUndoableOperation.canUndo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: undo
import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public IStatus undo(IUndoContext context, IProgressMonitor monitor,
IAdaptable info) throws ExecutionException {
Assert.isNotNull(context);
IUndoableOperation operation = getUndoOperation(context);
// info if there is no operation
if (operation == null) {
return IOperationHistory.NOTHING_TO_UNDO_STATUS;
}
// error if operation is invalid
if (!operation.canUndo()) {
if (DEBUG_OPERATION_HISTORY_UNEXPECTED) {
Tracing.printTrace("OPERATIONHISTORY", //$NON-NLS-1$
"Undo operation not valid - " + operation); //$NON-NLS-1$
}
return IOperationHistory.OPERATION_INVALID_STATUS;
}
return doUndo(monitor, info, operation);
}
示例2: undoOperation
import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public IStatus undoOperation(IUndoableOperation operation,
IProgressMonitor monitor, IAdaptable info)
throws ExecutionException {
Assert.isNotNull(operation);
IStatus status;
if (operation.canUndo()) {
status = doUndo(monitor, info, operation);
} else {
if (DEBUG_OPERATION_HISTORY_UNEXPECTED) {
Tracing.printTrace("OPERATIONHISTORY", //$NON-NLS-1$
"Undo operation not valid - " + operation); //$NON-NLS-1$
}
status = IOperationHistory.OPERATION_INVALID_STATUS;
}
return status;
}
示例3: canUndo
import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public boolean canUndo() {
for (IUndoableOperation operation : operationList) {
if (!operation.canUndo()) {
return false;
}
}
return true;
}
示例4: undo
import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public IStatus undo(final IUndoContext context, final IProgressMonitor operationMonitor, final IAdaptable info) throws ExecutionException {
if (!isJobContext(context)) {
return super.undo(context, operationMonitor, info);
}
OperationJob job = new OperationJob(context, "undo") {
@Override
protected IStatus run(IProgressMonitor jobMonitor) {
IUndoableOperation operation = getUndoOperation(context);
// info if there is no operation
if (operation == null) {
return IOperationHistory.NOTHING_TO_UNDO_STATUS;
}
// error if operation is invalid
if (!operation.canUndo()) {
if (DEBUG_OPERATION_HISTORY_UNEXPECTED) {
Tracing.printTrace("OPERATIONHISTORY", //$NON-NLS-1$
"Undo operation not valid - " + operation); //$NON-NLS-1$
}
return IOperationHistory.OPERATION_INVALID_STATUS;
}
setName("undo " + operation.getLabel());
IProgressMonitor monitor = DoubleProgressMonitor.combine(operationMonitor, jobMonitor);
return inJobEnforceRule(info, monitor, operation, true);
}
};
job.schedule();
return new JobOperationStatus(job);
}
示例5: canUndo
import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public boolean canUndo(IUndoContext context) {
// null context is allowed and passed through
IUndoableOperation operation = getUndoOperation(context);
return (operation != null && operation.canUndo());
}