/** Used when the context is switched. Installs the undoMa */
  public void update() {
    try {
      actualProjectDiagram = ModelerSession.getProjectService().getSelectedDiagram();
      actualUCDiagramModel = (UCDiagramModel) actualProjectDiagram.getDiagramModel();
      actualUCDiagramModel.installUndoActions(
          actions.get(UCNotationModel.UNDO_ACTION_KEY),
          actions.get(UCNotationModel.REDO_ACTION_KEY));

      actions
          .get(UCNotationModel.UNDO_ACTION_KEY)
          .setEnabled(actualUCDiagramModel.getUndoManager().canUndo());
      actions
          .get(UCNotationModel.REDO_ACTION_KEY)
          .setEnabled(actualUCDiagramModel.getUndoManager().canRedo());

      final ProjectDiagram projectDiagram = ModelerSession.getProjectService().getSelectedDiagram();
      projectDiagram.addChangeListener(this);
      actions.get(UCNotationModel.SAVE_ACTION_KEY).setEnabled(projectDiagram.isChanged());

    } catch (ClassCastException exception) {
      LOG.error("Unable to cast selected diagram model to UCDiagramModel class.", exception);
    } catch (Exception exception) {
      LOG.error("An error has occurred during context switch.", exception);
    }

    this.setTitleAt(0, actualProjectDiagram.getDisplayName());
    ((UCTabParent) this.getComponent(0)).update();
  }
  /**
   * {@inheritDoc}
   *
   * <p>Un-install the last UC notation diagram's listeners, sets the UNDO & REDO action as disable
   * and makes the actualUCDiagramModel variable null (actual UC notation diagram is none).
   */
  public void over() {
    if (actualUCDiagramModel != null) {
      actualUCDiagramModel.uninstallUndoActions();
    } else {
      LOG.error(
          "over() method of UC notation workspace has been invoked, but there hasn't been set any"
              + "actual UC notation diagram before.");
    }

    if (actualProjectDiagram != null) {
      actualProjectDiagram.removeChangeListener(this);
    }
  }