@Override
  public void dispose(
      IUndoContext context, boolean flushUndo, boolean flushRedo, boolean flushContext) {
    // dispose of any limit that was set for the context if it is not to be
    // used again.
    if (context instanceof EditingDomainUndoContext) {
      EditingDomainUndoContext editingDomainContext = (EditingDomainUndoContext) context;
      EditingDomain editingDomain = editingDomainContext.getEditingDomain();
      if (PlatformUI.isWorkbenchRunning()
          && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null
          && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null
          && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
              != null) {

        IEditorReference[] editorReferences =
            PlatformUI.getWorkbench()
                .getActiveWorkbenchWindow()
                .getActivePage()
                .getEditorReferences();
        for (IEditorReference editorRef : editorReferences) {
          try {
            IWorkbenchPart part = editorRef.getPart(false);
            if (part instanceof DiagramEditor) {
              DiagramEditor editor = (DiagramEditor) part;
              if (editor.getEditingDomain() != null
                  && editor.getEditingDomain().equals(editingDomain)) {
                return; // do not dispose if the editing domain
                // is else
              }
            }
          } catch (Exception e) {
            BonitaStudioLog.error(e);
          }
        }
      }
    }
    defaultOperationHistory.dispose(context, flushUndo, flushRedo, flushContext);
  }
 @Override
 public void add(IUndoableOperation operation) {
   defaultOperationHistory.add(operation);
 }
 @Override
 public IStatus undo(IUndoContext context, IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   return defaultOperationHistory.undo(context, monitor, info);
 }
 @Override
 public IStatus undoOperation(
     IUndoableOperation operation, IProgressMonitor monitor, IAdaptable info)
     throws ExecutionException {
   return defaultOperationHistory.undoOperation(operation, monitor, info);
 }
 @Override
 public void replaceOperation(IUndoableOperation operation, IUndoableOperation[] replacements) {
   defaultOperationHistory.replaceOperation(operation, replacements);
 }
 @Override
 public void setLimit(IUndoContext context, int limit) {
   defaultOperationHistory.setLimit(context, limit);
 }
 @Override
 public void removeOperationApprover(IOperationApprover approver) {
   defaultOperationHistory.removeOperationApprover(approver);
 }
 @Override
 public boolean canUndo(IUndoContext context) {
   return defaultOperationHistory.canUndo(context);
 }
 @Override
 public void operationChanged(IUndoableOperation operation) {
   defaultOperationHistory.operationChanged(operation);
 }
 @Override
 public IUndoableOperation getUndoOperation(IUndoContext context) {
   return defaultOperationHistory.getUndoOperation(context);
 }
 @Override
 public void openOperation(ICompositeOperation operation, int mode) {
   defaultOperationHistory.openOperation(operation, mode);
 }
 @Override
 public IUndoableOperation[] getRedoHistory(IUndoContext context) {
   return defaultOperationHistory.getRedoHistory(context);
 }
 @Override
 public int getLimit(IUndoContext context) {
   return defaultOperationHistory.getLimit(context);
 }
 @Override
 public void addOperationApprover(IOperationApprover approver) {
   defaultOperationHistory.addOperationApprover(approver);
 }
 @Override
 public void removeOperationHistoryListener(IOperationHistoryListener listener) {
   defaultOperationHistory.removeOperationHistoryListener(listener);
 }
 @Override
 public void addOperationHistoryListener(IOperationHistoryListener listener) {
   defaultOperationHistory.addOperationHistoryListener(listener);
 }
 @Override
 public void closeOperation(boolean operationOK, boolean addToHistory, int mode) {
   defaultOperationHistory.closeOperation(operationOK, addToHistory, mode);
 }