/**
   * Handles the event of an option being selected.
   *
   * @param evt, the event associated with the option being selected.
   */
  public void actionPerformed(ActionEvent evt) {

    Object source = evt.getSource();

    if (source.equals(miMenuItemShow)) {
      UITagUsageDialog dlg = new UITagUsageDialog(code, oParent);
      dlg.setVisible(true);
    } else if (source.equals(miMenuItemEdit)) {
      IModel model = ProjectCompendium.APP.getModel();

      String sOldName = code.getName();
      String sNewName =
          JOptionPane.showInputDialog(
              LanguageProperties.getString(
                  LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.edittagname"),
              sOldName); //$NON-NLS-1$
      sNewName = sNewName.trim();
      if (!sNewName.equals("")) { // $NON-NLS-1$
        try {
          String sCodeID = code.getId();

          // CHECK NAME DOES NOT ALREADY EXIST
          if (model.codeNameExists(sCodeID, sNewName)) {
            ProjectCompendium.APP.displayMessage(
                LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.tagexists")
                    + "\n\n"
                    + sNewName
                    + LanguageProperties.getString(
                        LanguageProperties.TAGS_BUNDLE, "UITagTreeLeafPopupMenu.pleasetryagain")
                    + "\n\n",
                LanguageProperties.getString(
                    LanguageProperties.TAGS_BUNDLE,
                    "UITagTreeLeafPopupMenu.tagmaintenance")); //$NON-NLS-1$ //$NON-NLS-2$
                                                               // //$NON-NLS-3$
          } else {
            code.initialize(model.getSession(), model);
            code.setName(sNewName); // Updates Database and model as model holds same object.
            oParent.updateTreeData();
          }

        } catch (Exception ex) {
          ProjectCompendium.APP.displayError(
              "UITagTreeLeafPopupMenu.editTagName\n\n" + ex.getMessage()); // $NON-NLS-1$
        }
      }
    } else if (source.equals(miMenuItemDelete)) {
      oParent.onDeleteCode(code);
    } else if (source.equals(miMenuItemRemove)) {
      oParent.onRemoveCodeFromGroup(code, sGroupID);
    } else if (source.equals(miMenuItemRemoveTag)) {
      oParent.onRemoveCodeFromNodes(code);
    }
  }
  /**
   * Handle the button push events.
   *
   * @param evt, the associated ActionEvent object.
   */
  public void actionPerformed(ActionEvent evt) {

    Object source = evt.getSource();

    // Handle button events
    if (source instanceof JButton) {
      if (source == pbImport) {

        Thread thread = new Thread("UIImportXMLDialog: Import") { // $NON-NLS-1$
              public void run() {
                onImport();
              }
            };
        thread.run();

      } else if (source == pbClose) {
        onCancel();
      }
    }
  }
  /**
   * Handles toolbar action event for this toolbar.
   *
   * @param evt the genereated action event to be handled.
   */
  public void actionPerformed(ActionEvent evt) {

    oParent.setWaitCursor();

    Object source = evt.getSource();

    if (source.equals(pbOpen)) {
      oParent.onFileOpen();
    } else if (source.equals(pbClose)) {
      oParent.onFileClose();
    } else if (source.equals(pbDelete)) {
      oParent.onEditDelete();
    } else if (source.equals(pbCut)) {
      oParent.onEditCut();
    } else if (source.equals(pbCopy)) {
      oParent.onEditCopy();
    } else if (source.equals(pbPaste)) {
      oParent.onEditPaste();
    } else if (source.equals(pbUndo)) {
      oParent.onEditUndo();
    } else if (source.equals(pbRedo)) {
      oParent.onEditRedo();
    } else if (source.equals(pbBack)) {
      onBack();
    } else if (source.equals(pbShowBackHistory)) {
      onShowBackHistory();
    } else if (source.equals(pbShowForwardHistory)) {
      onShowForwardHistory();
    } else if (source.equals(pbForward)) {
      onForward();
    } else if (source.equals(pbSearch)) {
      oParent.onSearch();
    } else if (source.equals(pbImageRollover)) {
      oParent.onImageRollover(!FormatProperties.imageRollover);
    }

    oParent.setDefaultCursor();
  }
  /**
   * Handles toolbar action event for this toolbar.
   *
   * @param evt the generated action event to be handled.
   */
  public void actionPerformed(ActionEvent evt) {

    // oParent.setWaitCursor();
    Object source = evt.getSource();
    // oParent.setDefaultCursor();
  }