/** Sets ACIDE - A Configurable IDE database panel menu item listeners. */
  public void setListeners() {

    // Sets the name menu item action listener
    _nameMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_NAME)));

    // Sets the name fields menu item action listener
    _nameFieldsMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_FIELDS_NAME)));

    // Sets the name fields menu item action listener
    _nameFieldsTypesMenuItem.addActionListener(
        new AcideInsertedItemListener(
            AcideMenuItemsConfiguration.getInstance()
                .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
                .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
                .getSubmenu(SHOW_DETAILS_NAME)
                .getItem(SHOW_NAME_FIELDS_TYPES_NAME)));

    Iterator<AcideMenuObjectConfiguration> it = _insertedObjects.iterator();
    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = it.next();
      if (ob.isSubmenu()) {
        _insertedMenus.get(ob.getName()).addMouseListener(new AcideMenuBarMouseClickListener());
        _insertedMenus.get(ob.getName()).setListeners();
      } else {
        AcideInsertedItem aux = _insertedItems.get(ob.getName());
        aux.addActionListener((new AcideInsertedItemListener(aux)));
      }
    }
  }
  /** Adds the components to the ACIDE - A Configurable IDE database panel menu. */
  private void addComponents() {

    Iterator<Object> it =
        AcideMenuItemsConfiguration.getInstance()
            .getMenuItemsManager()
            .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
            .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
            .getItemsManager()
            .getSubmenu(SHOW_DETAILS_NAME)
            .getItemsManager()
            .managerIterator();
    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = (AcideMenuObjectConfiguration) it.next();
      String name = ob.getName();
      if (name.equals(SHOW_NAME_NAME)) {
        // Adds the name menu item
        add(_nameMenuItem);
        _nameInserted = true;
      } else if (name.equals(SHOW_NAME_FIELDS_NAME)) {
        // Adds the name fields menu item
        add(_nameFieldsMenuItem);
        _nameFieldsInserted = true;
      } else if (name.equals(SHOW_NAME_FIELDS_TYPES_NAME)) {
        // Adds the name fields types menu item
        add(_nameFieldsTypesMenuItem);
        _nameFieldsTypesInserted = true;
      } else {
        if (ob.isSubmenu()) {
          add(_insertedMenus.get(ob.getName()));
        } else {
          add(_insertedItems.get(ob.getName()));
        }
      }
    }

    if (!_nameInserted) add(_nameMenuItem);
    if (!_nameFieldsInserted) add(_nameFieldsMenuItem);
    if (!_nameFieldsTypesInserted) add(_nameFieldsTypesMenuItem);
  }
  /**
   * Sets the text of the ACIDE - A Configurable IDE database panel menu components with the labels
   * in the selected language to display.
   */
  public void setTextOfMenuComponents() {

    // Sets the name menu item text
    _nameMenuItem.setText(AcideLanguageManager.getInstance().getLabels().getString("s2272"));

    // Sets the name fields menu item text
    _nameFieldsMenuItem.setText(AcideLanguageManager.getInstance().getLabels().getString("s2273"));

    // Sets the name fields types menu item text
    _nameFieldsTypesMenuItem.setText(
        AcideLanguageManager.getInstance().getLabels().getString("s2274"));

    Iterator<AcideMenuObjectConfiguration> it = _insertedObjects.iterator();
    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = it.next();
      if (ob.isSubmenu()) {
        _insertedMenus.get(ob.getName()).setText(ob.getName());
        _insertedMenus.get(ob.getName()).setTextOfMenuComponents();
      } else {
        _insertedItems.get(ob.getName()).setText(ob.getName());
      }
    }
  }
  /**
   * Updates the ACIDE - A Configurable IDE console menu components visibility with the menu
   * configuration.
   */
  public void updateComponentsVisibility() {

    AcideMenuItemConfiguration nameConfiguration;
    AcideMenuItemConfiguration nameFieldsConfiguration;
    AcideMenuItemConfiguration nameFieldsTypesConfiguration;

    _showDetailsSubmenuConfiguration =
        AcideMenuItemsConfiguration.getInstance()
            .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
            .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
            .getSubmenu(SHOW_DETAILS_NAME);

    // Sets the name menu item to visible or not visible
    nameConfiguration = _showDetailsSubmenuConfiguration.getItem(SHOW_NAME_NAME);
    _nameMenuItem.setVisible(nameConfiguration.isVisible());

    // Sets the name fields menu item to visible or not visible
    nameFieldsConfiguration = _showDetailsSubmenuConfiguration.getItem(SHOW_NAME_FIELDS_NAME);
    _nameFieldsMenuItem.setVisible(nameFieldsConfiguration.isVisible());

    // Sets the name fields types menu item to visible or not visible
    nameFieldsTypesConfiguration =
        _showDetailsSubmenuConfiguration.getItem(SHOW_NAME_FIELDS_TYPES_NAME);
    _nameFieldsTypesMenuItem.setVisible(nameFieldsTypesConfiguration.isVisible());

    Iterator<AcideMenuObjectConfiguration> it = _insertedObjects.iterator();
    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = it.next();
      if (ob.isSubmenu()) {
        _insertedMenus.get(ob.getName()).updateComponentsVisibility();
        _insertedMenus.get(ob.getName()).setVisible(ob.isVisible());
      } else {
        _insertedItems.get(ob.getName()).setVisible(ob.isVisible());
      }
    }

    // Sets the console menu to visible or not visible
    _showDetailsSubmenuConfiguration.setVisible(
        _nameMenuItem.isVisible()
            || _nameFieldsMenuItem.isVisible()
            || _nameFieldsTypesMenuItem.isVisible());
    _showDetailsSubmenuConfiguration.setErasable(false);

    try {
      // Save the configuration for the menu that could have been modified
      AcideMenuConfiguration.getInstance()
          .saveMenuConfigurationFile("./configuration/menu/lastModified.menuConfig");

      // Gets the the ACIDE - A Configurable IDE current menu
      // configuration
      String currentMenuConfiguration =
          AcideResourceManager.getInstance().getProperty("currentMenuConfiguration");

      if (!currentMenuConfiguration.endsWith("lastModified.menuConfig")
          && !currentMenuConfiguration.endsWith("newMenu.menuConfig")) {

        // Updates the the ACIDE - A Configurable IDE previous
        // menu
        // configuration
        AcideResourceManager.getInstance()
            .setProperty("previousMenuConfiguration", currentMenuConfiguration);
      }

      // Updates the the ACIDE - A Configurable IDE current menu
      // configuration
      AcideResourceManager.getInstance()
          .setProperty("currentMenuConfiguration", "./configuration/menu/lastModified.menuConfig");
    } catch (Exception exception2) {

      // Updates the log
      AcideLog.getLog().error(exception2.getMessage());
      exception2.printStackTrace();
    }
  }
  /** Builds the ACIDE - A Configurable IDE components. */
  private void buildComponents() {

    if (!AcideMenuItemsConfiguration.getInstance()
        .getMenuItemsManager()
        .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
        .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
        .hasSubmenu(SHOW_DETAILS_NAME)) {
      AcideMenuItemsConfiguration.getInstance()
          .getMenuItemsManager()
          .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
          .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
          .insertObject(new AcideMenuSubmenuConfiguration(SHOW_DETAILS_NAME));
    }

    Iterator<Object> it =
        AcideMenuItemsConfiguration.getInstance()
            .getMenuItemsManager()
            .getSubmenu(AcideConfigurationMenu.CONFIGURATION_MENU_NAME)
            .getSubmenu(AcideDatabasePanelMenu.DATABASE_MENU_NAME)
            .getItemsManager()
            .getSubmenu(SHOW_DETAILS_NAME)
            .getItemsManager()
            .managerIterator();

    while (it.hasNext()) {
      AcideMenuObjectConfiguration ob = (AcideMenuObjectConfiguration) it.next();
      String name = ob.getName();
      if (isOriginal(name)) {
        _insertedObjects.add(ob);
        if (ob.isSubmenu()) {
          AcideMenuSubmenuConfiguration obSubmenu = (AcideMenuSubmenuConfiguration) ob;
          _insertedMenus.put(ob.getName(), new AcideInsertedMenu(obSubmenu));
        } else {
          AcideMenuItemConfiguration obItem = (AcideMenuItemConfiguration) ob;
          _insertedItems.put(
              obItem.getName(),
              new AcideInsertedItem(IconsUtils.getIcon(obItem.getImage()), obItem));
        }
      }
    }

    _nameMenuItem = new JCheckBoxMenuItem();

    // Sets the name menu item name
    _nameMenuItem.setName(SHOW_NAME_NAME);

    _nameMenuItem.setSelected(false);

    _nameFieldsMenuItem = new JCheckBoxMenuItem();

    // Sets the name fields menu item name
    _nameFieldsMenuItem.setName(SHOW_NAME_FIELDS_NAME);

    _nameFieldsMenuItem.setSelected(false);

    _nameFieldsTypesMenuItem = new JCheckBoxMenuItem();

    // Sets the name fields types menu item name
    _nameFieldsTypesMenuItem.setName(SHOW_NAME_FIELDS_TYPES_NAME);

    _nameFieldsTypesMenuItem.setSelected(false);
  }