docs: JMenuBar createMainMenuBar() {
          JMenuBar menuBar = new JMenuBar();
  
          // Create JMenus for menuBar.
          JMenu fileMenu = newJMenu("menu.file_menu", "File");
          fileMenu.setMnemonic(KeyEvent.VK_F);
          JMenu editMenu = newJMenu("menu.edit_menu", "Edit");
          editMenu.setMnemonic(KeyEvent.VK_E);
  
          // Edit fileMenu JMenu object.
          JMenuItem openMenuItem = newJMenuItem("menu.open_item", "Open...", KeyEvent.VK_O);
          recentMenu = newJMenu("menu.recent_menu", "Recent");
          recentMenuCache = new RecentMenu(recentMenu);
          saveAsMenuItem = newJMenuItem("menu.saveas_item", "Save As...", KeyEvent.VK_A);
          JMenuItem importFilter = newJMenuItem("menu.importFilter_item", "Import bug filters...");
          JMenuItem exportFilter = newJMenuItem("menu.exportFilter_item", "Export bug filters...");
  
          JMenuItem exitMenuItem = null;
          if (!MainFrame.MAC_OS_X) {
              exitMenuItem = newJMenuItem("menu.exit", "Exit", KeyEvent.VK_X);
              exitMenuItem.addActionListener(evt -> mainFrame.callOnClose());
          }
          JMenu windowMenu = mainFrame.getGuiLayout().createWindowMenu();
  
          JMenuItem newProjectMenuItem = null;
          if (!FindBugs.isNoAnalysis()) {
              newProjectMenuItem = newJMenuItem("menu.new_item", "New Project", KeyEvent.VK_N);
  
              attachAcceleratorKey(newProjectMenuItem, KeyEvent.VK_N);
  
              newProjectMenuItem.addActionListener(evt -> mainFrame.createNewProjectFromMenuItem());
          }
  
          reconfigMenuItem.setEnabled(false);
          attachAcceleratorKey(reconfigMenuItem, KeyEvent.VK_F);
          reconfigMenuItem.addActionListener(evt -> new NewProjectWizard(mainFrame.getCurProject()));
  
          JMenuItem mergeMenuItem = newJMenuItem("menu.mergeAnalysis", "Merge Analysis...");
  
          mergeMenuItem.setEnabled(true);
          mergeMenuItem.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().mergeAnalysis());
  
          if (!FindBugs.isNoAnalysis()) {
              redoAnalysis = newJMenuItem("menu.rerunAnalysis", "Redo Analysis", KeyEvent.VK_R);
  
              redoAnalysis.setEnabled(false);
              attachAcceleratorKey(redoAnalysis, KeyEvent.VK_R);
              redoAnalysis.addActionListener(evt -> mainFrame.redoAnalysis());
          }
          closeProjectItem = newJMenuItem("menu.closeProject", "Close Project");
          closeProjectItem.addActionListener(e -> {
              mainFrame.getMainFrameLoadSaveHelper().closeProject();
              mainFrame.clearBugCollection();
          });
          closeProjectItem.setEnabled(false);
  
  
          openMenuItem.setEnabled(true);
          attachAcceleratorKey(openMenuItem, KeyEvent.VK_O);
          openMenuItem.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().open());
  
          saveAsMenuItem.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().saveAs());
          exportFilter.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().exportFilter());
          importFilter.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().importFilter());
          saveMenuItem.setEnabled(false);
          attachAcceleratorKey(saveMenuItem, KeyEvent.VK_S);
          saveMenuItem.addActionListener(evt -> mainFrame.getMainFrameLoadSaveHelper().save());
  
          if (!FindBugs.isNoAnalysis()) {
              fileMenu.add(newProjectMenuItem);
          }
  
          fileMenu.add(openMenuItem);
          fileMenu.add(recentMenu);
          fileMenu.addSeparator();
          fileMenu.add(saveAsMenuItem);
          fileMenu.add(saveMenuItem);
          fileMenu.addSeparator();
          fileMenu.add(reconfigMenuItem);
          if (!FindBugs.isNoAnalysis()) {
              fileMenu.add(redoAnalysis);
          }
  
          fileMenu.addSeparator();
          fileMenu.add(closeProjectItem);
          // fileMenu.add(mergeMenuItem);
          fileMenu.addSeparator();
          fileMenu.add(importFilter);
          fileMenu.add(exportFilter);
  
          if (exitMenuItem != null) {
              fileMenu.addSeparator();
              fileMenu.add(exitMenuItem);
          }
  
          menuBar.add(fileMenu);
  
          // Edit editMenu Menu object.
          JMenuItem cutMenuItem = new JMenuItem(new CutAction());
          JMenuItem copyMenuItem = new JMenuItem(new CopyAction());
          JMenuItem pasteMenuItem = new JMenuItem(new PasteAction());
          preferencesMenuItem = newJMenuItem("menu.preferences_menu", "Preferences...");
          groupByMenuItem = newJMenuItem("menu.sortConfiguration", "Sort Configuration...");
          JMenuItem goToLineMenuItem = newJMenuItem("menu.gotoLine", "Go to line...");
  
          attachAcceleratorKey(cutMenuItem, KeyEvent.VK_X);
          attachAcceleratorKey(copyMenuItem, KeyEvent.VK_C);
          attachAcceleratorKey(pasteMenuItem, KeyEvent.VK_V);
  
          preferencesMenuItem.addActionListener(evt -> mainFrame.preferences());
  
          groupByMenuItem.addActionListener(evt -> {
              SorterDialog.getInstance().setLocationRelativeTo(mainFrame);
              SorterDialog.getInstance().setVisible(true);
          });
  
          attachAcceleratorKey(goToLineMenuItem, KeyEvent.VK_L);
          goToLineMenuItem.addActionListener(evt -> {
              mainFrame.getGuiLayout().makeSourceVisible();
              try {
                  int num = Integer.parseInt(JOptionPane.showInputDialog(mainFrame, "",
                          L10N.getLocalString("dlg.go_to_line_lbl", "Go To Line") + ":", JOptionPane.QUESTION_MESSAGE));
                  mainFrame.getSourceCodeDisplayer().showLine(num);
              } catch (NumberFormatException e) {
              }
          });
  
          editMenu.add(cutMenuItem);
          editMenu.add(copyMenuItem);
          editMenu.add(pasteMenuItem);
          editMenu.addSeparator();
          editMenu.add(goToLineMenuItem);
          editMenu.addSeparator();
          // editMenu.add(selectAllMenuItem);
          // editMenu.addSeparator();
          if (!MainFrame.MAC_OS_X) {
              // Preferences goes in Findbugs menu and is handled by OSXAdapter
              editMenu.add(preferencesMenuItem);
          }
  
          menuBar.add(editMenu);
  
          if (windowMenu != null) {
              menuBar.add(windowMenu);
          }
  
          viewMenu = newJMenu("menu.view_menu", "View");
          setViewMenu();
          menuBar.add(viewMenu);
  
          final ActionMap map = mainFrame.getMainFrameTree().getTree().getActionMap();
  
          JMenu navMenu = newJMenu("menu.navigation", "Navigation");
  
          addNavItem(map, navMenu, "menu.expand", "Expand", "expand", KeyEvent.VK_RIGHT);
          addNavItem(map, navMenu, "menu.collapse", "Collapse", "collapse", KeyEvent.VK_LEFT);
          addNavItem(map, navMenu, "menu.up", "Up", "selectPrevious", KeyEvent.VK_UP);
          addNavItem(map, navMenu, "menu.down", "Down", "selectNext", KeyEvent.VK_DOWN);
  
          menuBar.add(navMenu);
  
          if (!MainFrame.MAC_OS_X) {
              // On Mac, 'About' appears under Findbugs menu, so no need for it
              // here
              JMenu helpMenu = newJMenu("menu.help_menu", "Help");
              JMenuItem aboutItem = newJMenuItem("menu.about_item", "About SpotBugs");
              helpMenu.add(aboutItem);
  
              aboutItem.addActionListener(evt -> mainFrame.about());
  
              menuBar.add(helpMenu);
          }
          return menuBar;
      }