question: public static void addCustomCommands ( String commands , ContextMenu m ) { Matcher matcher = CUSTOM_COMMANDS_PATTERN . matcher ( commands ) ; boolean sep = false ; while ( matcher . find ( ) ) { String match = matcher . group ( ) ; if ( match . equals ( "|" ) ) { sep = true ; } else { String command = matcher . group ( 2 ) ; String submenu = null ; if ( match . startsWith ( "//" ) ) { submenu = CUSTOM_COMMANDS_SUBMENU ; } if ( sep ) { m . addSeparator ( submenu ) ; } m . addSubItem ( "command" + command , Helper . replaceUnderscoreWithSpace ( command ) , submenu ) ; sep = false ; } } }
target:  Parses the given commands setting and adds menu items to the given ContextMenu.