本文整理汇总了Java中org.eclipse.core.commands.operations.OperationHistoryEvent.getOperation方法的典型用法代码示例。如果您正苦于以下问题:Java OperationHistoryEvent.getOperation方法的具体用法?Java OperationHistoryEvent.getOperation怎么用?Java OperationHistoryEvent.getOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.core.commands.operations.OperationHistoryEvent
的用法示例。
在下文中一共展示了OperationHistoryEvent.getOperation方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的package包/类
@Override
public void historyNotification(OperationHistoryEvent event) {
IUndoableOperation op = event.getOperation();
String typeString = decodeEventType(event.getEventType());
// System.out.println("type='"+typeString+"' operation='"+op+"' of type '"+op.getClass().getName()+"' e="+op.canExecute()+" u="+op.canUndo()+" r="+op.canRedo());
// for(IUndoContext c : op.getContexts()) {
// System.out.println("\t"+c.getLabel());
// }
switch(event.getEventType()) {
case OperationHistoryEvent.OPERATION_ADDED:
case OperationHistoryEvent.OPERATION_CHANGED:
case OperationHistoryEvent.OPERATION_REMOVED:
case OperationHistoryEvent.ABOUT_TO_EXECUTE:
case OperationHistoryEvent.ABOUT_TO_REDO:
case OperationHistoryEvent.ABOUT_TO_UNDO:
break;
default:
EnsembleUsageLogger.logUsage(op.getLabel() + " - " + typeString + "\n" + op.toString());
}
}
示例2: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的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();
}
});
}
}
}
示例3: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的package包/类
public void historyNotification(OperationHistoryEvent event) {
IUndoableOperation op = event.getOperation();
if (op instanceof TriggeredOperations) {
op = ((TriggeredOperations) op).getTriggeringOperation();
}
UndoableOperation2ChangeAdapter changeOperation = null;
if (op instanceof UndoableOperation2ChangeAdapter) {
changeOperation = (UndoableOperation2ChangeAdapter) op;
}
if (changeOperation == null) return;
Change change = changeOperation.getChange();
switch (event.getEventType()) {
case OperationHistoryEvent.ABOUT_TO_EXECUTE:
case OperationHistoryEvent.ABOUT_TO_UNDO:
case OperationHistoryEvent.ABOUT_TO_REDO:
fireAboutToPerformChange(change);
break;
case OperationHistoryEvent.DONE:
case OperationHistoryEvent.UNDONE:
case OperationHistoryEvent.REDONE:
fireChangePerformed(change);
fireUndoStackChanged();
fireRedoStackChanged();
break;
case OperationHistoryEvent.OPERATION_NOT_OK:
fireChangePerformed(change);
break;
case OperationHistoryEvent.OPERATION_ADDED:
// would be better to have different events for this
fireUndoStackChanged();
fireRedoStackChanged();
break;
case OperationHistoryEvent.OPERATION_REMOVED:
// would be better to have different events for this
fireUndoStackChanged();
fireRedoStackChanged();
break;
}
}
示例4: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的package包/类
@Override
public void historyNotification(OperationHistoryEvent event)
{
if (event.getOperation() instanceof MapOperation)
{
System.out.println("Undo-History Event: " + event);
panel.redraw();
}
}
示例5: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的package包/类
@Override
public void historyNotification(OperationHistoryEvent event) {
IUndoableOperation eventOperation = event.getOperation();
IUndoContext inputUndoContext = getUndoContext();
IUndoContext[] operationContexts = eventOperation.getContexts();
boolean matches = false;
for (IUndoContext operationContext : operationContexts) {
matches = operationContext.matches(inputUndoContext);
if (matches) {
break;
}
}
if (!matches) {
return;
}
switch (event.getEventType()) {
case OperationHistoryEvent.REDONE: {
if (eventOperation == cleanStateOperation) {
dirty = false;
fireDirtyStateChanged();
} else if (!dirty) {
dirty = true;
fireDirtyStateChanged();
}
break;
}
case OperationHistoryEvent.DONE: {
if (!dirty) {
dirty = true;
fireDirtyStateChanged();
}
break;
}
case OperationHistoryEvent.UNDONE: {
IUndoableOperation undoOperation = event.getHistory().getUndoOperation(inputUndoContext);
if (undoOperation == cleanStateOperation) {
dirty = false;
fireDirtyStateChanged();
} else if (!dirty) {
dirty = true;
fireDirtyStateChanged();
}
break;
}
default:
// nothing to do yet
break;
}
}
示例6: historyNotification
import org.eclipse.core.commands.operations.OperationHistoryEvent; //导入方法依赖的package包/类
@Override
public void historyNotification(final OperationHistoryEvent event) {
if (event.getOperation() == theEditLabelOperation) {
if (event.getEventType() == OperationHistoryEvent.UNDONE) {
async(new Runnable() {
@Override
public void run() {
final IUndoableOperation[] theUndoHistory = theCommandStack.getOperationHistory()
.getUndoHistory(theCommandStack.getDefaultUndoContext());
if (theUndoHistory.length > 0
&& theUndoHistory[theUndoHistory.length - 1] == theCreateElementOperation) {
theCommandStack.undo();
} else {
Activator.INSTANCE
.log("Unable to cascade the undo after the element label change was undone. The Reference Library Subset may be in an illegal state.");
stopListening();
}
}
});
} else if (event.getEventType() == OperationHistoryEvent.OPERATION_REMOVED) {
stopListening();
}
}
if (event.getOperation() == theCreateElementOperation) {
if (event.getEventType() == OperationHistoryEvent.REDONE) {
async(new Runnable() {
@Override
public void run() {
final IUndoableOperation[] theRedoHistory = theCommandStack.getOperationHistory()
.getRedoHistory(theCommandStack.getDefaultUndoContext());
if (theRedoHistory.length > 0
&& theRedoHistory[theRedoHistory.length - 1] == theEditLabelOperation) {
theCommandStack.redo();
} else {
Activator.INSTANCE
.log("Unable to cascade the redo after the create element change was redone. The Reference Library Subset may be in an illegal state.");
stopListening();
}
}
});
} else if (event.getEventType() == OperationHistoryEvent.OPERATION_REMOVED) {
stopListening();
}
}
}
开发者ID:info-sharing-environment,项目名称:NIEM-Modeling-Tool,代码行数:46,代码来源:ClassifierNamePopupEditorConfiguration.java