org.eclipse.core.commands.operations.IOperationHistoryListener Java Examples
The following examples show how to use
org.eclipse.core.commands.operations.IOperationHistoryListener.
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: HistoryBasedDirtyStateProvider.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * Returns the {@link IOperationHistoryListener} that is to be used to * update the dirty state of this editor. * * @return The {@link IOperationHistoryListener} that is to be used to * update the dirty state of this editor. */ protected IOperationHistoryListener createOperationHistoryListener() { return new IOperationHistoryListener() { @Override public void historyNotification(final OperationHistoryEvent event) { // XXX: Only react to a subset of the history event // notifications. OPERATION_ADDED is issued when a transaction // is committed on the domain or an operation without a // transaction is executed on the domain; in the latter // case, we would also obtain a DONE notification (which we // ignore here). OPERATION_REMOVED is issued then flushing the // history IUndoableOperation[] undoHistory = event.getHistory() .getUndoHistory(getUndoContext()); if (event.getEventType() == OperationHistoryEvent.UNDONE || event.getEventType() == OperationHistoryEvent.REDONE || event.getEventType() == OperationHistoryEvent.OPERATION_ADDED || event.getEventType() == OperationHistoryEvent.OPERATION_REMOVED) { dirtyProperty.set(getMostRecentDirtyRelevantOperation( undoHistory) != saveLocation); } } }; }
Example #2
Source File: UndoablePropertySheetEntry.java From gef with Eclipse Public License 2.0 | 6 votes |
/** * Constructs a new root entry. * * @param workbenchPart * The {@link IWorkbenchPart} to adapt for an * {@link IPropertySource}, in case no values are provided. * @param operationHistory * The {@link IOperationHistory} to use. * @param undoContext * The {@link IUndoContext} to use. */ public UndoablePropertySheetEntry(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) { refreshFromRoot(); } }; this.operationHistory .addOperationHistoryListener(operationHistoryListener); }
Example #3
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()); }
Example #4
Source File: BonitaOperationHistory.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void addOperationHistoryListener(final IOperationHistoryListener listener) { defaultOperationHistory.addOperationHistoryListener(listener); }
Example #5
Source File: BonitaOperationHistory.java From bonita-studio with GNU General Public License v2.0 | 4 votes |
@Override public void removeOperationHistoryListener( final IOperationHistoryListener listener) { defaultOperationHistory.removeOperationHistoryListener(listener); }