protected MenuElement getPreviousValidItem(JPopupMenu popup, int offset) {

		int n = popup.getComponentCount();
		for (int i = n - 1; i >= 0; i--) {

			// handle wrapping
			int updated = (n - (i + 1));
			int index = (updated > offset) ? updated : offset - updated;

			Component c = popup.getComponent(index);
			if (isValidItem(c)) {
				return (MenuElement) c;
			}
		}
		return null;
	}
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