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


Java IUndoableOperation.hasContext方法代码示例

本文整理汇总了Java中org.eclipse.core.commands.operations.IUndoableOperation.hasContext方法的典型用法代码示例。如果您正苦于以下问题:Java IUndoableOperation.hasContext方法的具体用法?Java IUndoableOperation.hasContext怎么用?Java IUndoableOperation.hasContext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.core.commands.operations.IUndoableOperation的用法示例。


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

示例1: historyNotification

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public void historyNotification(OperationHistoryEvent event) {
	int type = event.getEventType();
	if ((type == OperationHistoryEvent.DONE)
		|| (type == OperationHistoryEvent.REDONE)
		|| (type == OperationHistoryEvent.UNDONE)) {
		IUndoableOperation operation = event.getOperation();
		if ((undoContext == null) || operation.hasContext(undoContext) || operation.getContexts().length == 0) {
			Display display = WidgetUtils.getDisplay();
			display.asyncExec(new Runnable() {
				@Override
				public void run() {
					updateEnablement();
				}
			});
		}
	}
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:19,代码来源:AbstractUndoableOperationAction.java

示例2: filter

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
private IUndoableOperation[] filter(List list, IUndoContext context) {
	/*
	 * This method is used whenever there is a need to filter the undo or
	 * redo history on a particular context. Currently there are no caches
	 * kept to optimize repeated requests for the same filter. If benchmarks
	 * show this to be a common pattern that causes performances problems,
	 * we could implement a filtered cache here that is nullified whenever
	 * the global history changes.
	 */

	List filtered = new ArrayList();
	Iterator iterator = list.iterator();
	synchronized (undoRedoHistoryLock) {
		while (iterator.hasNext()) {
			IUndoableOperation operation = (IUndoableOperation) iterator
					.next();
			if (operation.hasContext(context)) {
				filtered.add(operation);
			}
		}
	}
	return (IUndoableOperation[]) filtered
			.toArray(new IUndoableOperation[filtered.size()]);
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:25,代码来源:DefaultOperationHistory.java

示例3: getRedoOperation

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public IUndoableOperation getRedoOperation(IUndoContext context) {
	Assert.isNotNull(context);
	synchronized (undoRedoHistoryLock) {
		for (int i = redoList.size() - 1; i >= 0; i--) {
			IUndoableOperation operation = (IUndoableOperation) redoList
					.get(i);
			if (operation.hasContext(context)) {
				return operation;
			}
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:DefaultOperationHistory.java

示例4: getUndoOperation

import org.eclipse.core.commands.operations.IUndoableOperation; //导入方法依赖的package包/类
@Override
public IUndoableOperation getUndoOperation(IUndoContext context) {
	Assert.isNotNull(context);
	synchronized (undoRedoHistoryLock) {
		for (int i = undoList.size() - 1; i >= 0; i--) {
			IUndoableOperation operation = (IUndoableOperation) undoList
					.get(i);
			if (operation.hasContext(context)) {
				return operation;
			}
		}
	}
	return null;
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:15,代码来源:DefaultOperationHistory.java


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