code: private int getNumberOfSelectedAlerts() {
          JTree treeAlert = this.extAlert.getAlertPanel().getTreeAlert();
          int count = treeAlert.getSelectionCount();
          if (count == 0) {
              return 0;
          }
  
          if (count == 1) {
              DefaultMutableTreeNode alertNode = (DefaultMutableTreeNode) treeAlert.getSelectionPath().getLastPathComponent();
              if (alertNode.getChildCount() == 0 || !isMultiSelect()) {
                  return 1;
              }
              return alertNode.getChildCount();
          }
  
          count = 0;
          TreePath[] paths = treeAlert.getSelectionPaths();
          for (int i = 0; i < paths.length; i++) {
              TreePath nodePath = paths[i];
              int childCount = ((DefaultMutableTreeNode) nodePath.getLastPathComponent()).getChildCount();
              count += childCount != 0 ? childCount : (treeAlert.isPathSelected(nodePath.getParentPath()) ? 0 : 1);
          }
          return count;
      }
docs: Gets the number of selected alerts in the Alerts tree.
  <p>
  If multiple alert nodes are selected it returns the corresponding number of alerts. If just a middle alert node (that is,
  the nodes that show the alert name) is selected it returns only one selected alert when {@link #isMultiSelect() multiple
  selection} is not supported, otherwise it returns the number of child nodes (which is one alert per node).
  
  @return the number of selected nodes