protected void setNewMenuItemIndex(MenuSelectionManager manager, MenuElement[] path,
			int index) {

		if (index < 0) {
			return;
		}

		int popupIndex = getLeafPopupIndex(path);
		JPopupMenu popup = (JPopupMenu) path[popupIndex];

		JMenuItem newItem = (JMenuItem) popup.getComponent(index);
		int length = path.length - 1 == popupIndex ? path.length + 1 : path.length;

		MenuElement[] newPath = new MenuElement[length];
		System.arraycopy(path, 0, newPath, 0, popupIndex + 1);
		newPath[popupIndex + 1] = newItem;

		// replace last path element
		manager.setSelectedPath(newPath);
	}
The work method of this handler.  This method will only be called when a menu or popup
menu is open.

@param manager the active menu selection manager
@param path the active menu path
Ghidra/Framework/Docking/src/main/java/docking/menu/keys/MenuKeyHandler.java