@Override protected final void after() { final IOperationHistory theOperationHistory = theWorkspaceCommandStack.getOperationHistory(); final IUndoContext theDefaultUndoContext = theWorkspaceCommandStack.getDefaultUndoContext(); final IUndoableOperation[] theUndoHistory = theOperationHistory.getUndoHistory(theDefaultUndoContext); final IUndoableOperation theEditLabelOperation = theUndoHistory[theUndoHistory.length - 1]; final IUndoableOperation theCreateElementOperation = theUndoHistory[theUndoHistory.length - 2]; final IOperationHistoryListener theOperationHistoryListener = new AtomicElementLabelingSupport( theWorkspaceCommandStack, theEditLabelOperation, theCreateElementOperation); theOperationHistory.addOperationHistoryListener(theOperationHistoryListener); }
@Override public void removeOperationHistoryListener( IOperationHistoryListener listener) { listeners.remove(listener); }
/** * <p> * Add the specified listener to the list of operation history listeners * that are notified about changes in the history or operations that are * executed, undone, or redone. This method has no effect if the instance * being added is already in the list. * </p> * <p> * Operation history listeners must be prepared to receive notifications * from a background thread. Any UI access occurring inside the * implementation must be properly synchronized using the techniques * specified by the client's widget library. * </p> * * @param listener * the IOperationHistoryListener to be added as a listener. * * @see org.eclipse.core.commands.operations.IOperationHistoryListener * @see org.eclipse.core.commands.operations.OperationHistoryEvent */ @Override public void addOperationHistoryListener(IOperationHistoryListener listener) { listeners.add(listener); }