/**
   * Fired by a view when the figure seleciton changes. Since Commands and Tools are Actions and
   * they are registered to hear these events, they will handle themselves. So selection sensitive
   * menuitems will update their own states.
   *
   * @see DrawingEditor
   */
  public void figureSelectionChanged(DrawingView view) {
    JMenuBar mb = getJMenuBar();
    CommandMenu editMenu = (CommandMenu) mb.getMenu(EDIT_MENU);
    // make sure it does exist
    if (editMenu != null) {
      editMenu.checkEnabled();
    }
    CommandMenu alignmentMenu = (CommandMenu) mb.getMenu(ALIGNMENT_MENU);
    // make sure it does exist
    if (alignmentMenu != null) {
      alignmentMenu.checkEnabled();
    }

    JMenu attributeMenu = mb.getMenu(ATTRIBUTES_MENU);
    // make sure it does exist
    if (attributeMenu != null) {
      for (int i = 0; i < attributeMenu.getItemCount(); i++) {
        JMenuItem currentMenu = attributeMenu.getItem(i);
        if (currentMenu instanceof CommandMenu) {
          ((CommandMenu) currentMenu).checkEnabled();
        }
      }
    }
  }