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


Java IUndoableOperation.canUndo方法代码示例

本文整理汇总了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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:23,代码来源:DefaultOperationHistory.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:18,代码来源:DefaultOperationHistory.java

示例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;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:10,代码来源:CompositeOperation.java

示例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);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:30,代码来源:JobOperationHistory.java

示例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());
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:7,代码来源:DefaultOperationHistory.java


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