private String findRootParent(Command command) { String parent = command.getParent(); if (parent != null) { CommandGroup commandGroup = commandManager.getCommandGroup(parent); if (commandGroup != null) { return findRootParent(commandGroup); } } return parent; }
protected final void insertCommandMenuItem(Command command) { JMenu menu = null; String parent = command.getParent(); if (parent != null) { menu = findMenu(parent); } if (menu == null) { menu = createNewMenu(parent); } if (menu != null) { commandMenuInserter.insertCommandIntoMenu(command, menu); } }
private static void addCommand(CommandManager commandManager, Command command, Map<String, Command> commandMap) { String parentId = command.getParent(); if (parentId != null && commandManager.getCommandGroup(parentId) == null) { Command parentCommand = commandMap.get(parentId); if (parentCommand != null) { // solve dependencies to other command groups addCommand(commandManager, parentCommand, commandMap); } } Command existingCommand = commandManager.getCommand(command.getCommandID()); if (existingCommand == null) { commandManager.addCommand(command); } }