int n = fileMenu.getItemCount();   for (int i = 2; i < n-1; i++) { JMenuItem menuItem = fileMenu.getItem(i); if (menuItem != null) { Action action = menuItem.getAction(); if (action != null) ActionUtil.setActionAllowed(action, organizer); } }
enableActions((JMenu)e.getSource());
        public void menuSelected(MenuEvent e) {          int n = fileMenu.getItemCount();          // skip Open Workspace, Save New Results, and Exit           // which are always enabled          for (int i = 2; i < n-1; i++) {            JMenuItem menuItem = fileMenu.getItem(i);            if (menuItem != null) {              Action action = menuItem.getAction();              if (action != null)                ActionUtil.setActionAllowed(action, organizer);            }          }        }