本文整理汇总了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();
}
});
}
}
}
示例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()]);
}
示例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;
}
示例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;
}