Java Code Examples for org.eclipse.core.commands.operations.OperationHistoryEvent#ABOUT_TO_UNDO
The following examples show how to use
org.eclipse.core.commands.operations.OperationHistoryEvent#ABOUT_TO_UNDO .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: HistoricizingDomain.java From gef with Eclipse Public License 2.0 | 6 votes |
@Override public void historyNotification(OperationHistoryEvent event) { if (event.getEventType() == OperationHistoryEvent.ABOUT_TO_UNDO) { if (!transactionContext.isEmpty() && transaction != null) { if (transaction.getOperations().isEmpty()) { // XXX: Copy transaction context to prevent CME when an // interaction is started while performing undo. for (IGesture gesture : new ArrayList<>( transactionContext)) { closeExecutionTransaction(gesture); } } else { // XXX: Need a test case. I think it might be fine to // perform undo even though a handler already // contributed an operation. throw new IllegalStateException( "Cannot perform UNDO while a currently open execution transaction contains operations."); } } } }
Example 2
Source File: UndoablePropertySheetPage.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * Constructs a new {@link UndoablePropertySheetPage} using the provided * {@link IOperationHistory}. * * @param operationHistory * The {@link IOperationHistory} shared with the editor/view. * @param undoContext * The {@link IUndoContext} shared with the editor/view. * @param workbenchPart * The {@link IWorkbenchPart} this * {@link UndoablePropertySheetPage} is related to. . * */ @Inject public UndoablePropertySheetPage(@Assisted IWorkbenchPart workbenchPart, IOperationHistory operationHistory, IUndoContext undoContext) { this.workbenchPart = workbenchPart; this.operationHistory = operationHistory; this.undoContext = undoContext; this.operationHistoryListener = new IOperationHistoryListener() { @Override public void historyNotification(OperationHistoryEvent event) { if (event.getEventType() == OperationHistoryEvent.ABOUT_TO_REDO || event.getEventType() == OperationHistoryEvent.ABOUT_TO_UNDO) { refresh(); } } }; operationHistory.addOperationHistoryListener(operationHistoryListener); setRootEntry(createRootEntry()); }