src/main/java/seedu/address/ui/MainWindow.java
/**
     * Executes the command and returns the result.
     *
     * @see seedu.address.logic.Logic#execute(String)
     */
Executes the command and returns the result.
Executes the command and returns the result .
private CommandResult executeCommand(String commandText) throws CommandException, ParseException {
        try {
            CommandResult commandResult = logic.execute(commandText);
            logger.info("Result: " + commandResult.getFeedbackToUser());
            resultDisplay.setFeedbackToUser(commandResult.getFeedbackToUser());
            if (commandResult.isShowHelp()) {
                handleHelp();
            }
            if (commandResult.isExit()) {
                handleExit();
            }
            if (commandResult.isShowAllStats()) {
                handleAllStats();
            }
            if (commandResult.isShowCalorieStats()) {
                handleCalorieStats();
            }
            if (commandResult.isShowWeightStats()) {
                handleWeightStats();
            }
            if (commandResult.isClear()) {
                handleClear();
            }
            if (commandResult.isDelete()) {
                handleDelete(commandResult.getIndexDelete() - 1);
            }
            if (commandResult.isProfileChanged()) {
                handleProfileChanged();
            }
            if (commandResult.isView()) {
                handleView(commandResult.getIndexView() - 1);
            }
            if (commandResult.isShowCommanderStats()) {
                handleCommanderStats();
            }
            if (!commandResult.isClear()) {
                handleUpdateProfilePanel();
            }
            return commandResult;
        } catch (CommandException | ParseException e) {
            logger.info("Invalid command: " + commandText);
            resultDisplay.setFeedbackToUser(e.getMessage());
            throw e;
        }
    }
private CommandResult executeCommand ( String commandText ) throws CommandException , ParseException { try { CommandResult commandResult = logic . execute ( commandText ) ; logger . info ( "Result: " + commandResult . getFeedbackToUser ( ) ) ; resultDisplay . setFeedbackToUser ( commandResult . getFeedbackToUser ( ) ) ; if ( commandResult . isShowHelp ( ) ) { handleHelp ( ) ; } if ( commandResult . isExit ( ) ) { handleExit ( ) ; } if ( commandResult . isShowAllStats ( ) ) { handleAllStats ( ) ; } if ( commandResult . isShowCalorieStats ( ) ) { handleCalorieStats ( ) ; } if ( commandResult . isShowWeightStats ( ) ) { handleWeightStats ( ) ; } if ( commandResult . isClear ( ) ) { handleClear ( ) ; } if ( commandResult . isDelete ( ) ) { handleDelete ( commandResult . getIndexDelete ( ) - 1 ) ; } if ( commandResult . isProfileChanged ( ) ) { handleProfileChanged ( ) ; } if ( commandResult . isView ( ) ) { handleView ( commandResult . getIndexView ( ) - 1 ) ; } if ( commandResult . isShowCommanderStats ( ) ) { handleCommanderStats ( ) ; } if ( ! commandResult . isClear ( ) ) { handleUpdateProfilePanel ( ) ; } return commandResult ; } catch ( CommandException | ParseException e ) { logger . info ( "Invalid command: " + commandText ) ; resultDisplay . setFeedbackToUser ( e . getMessage ( ) ) ; throw e ; } }
Executes the command and returns the result.
Executes the command and returns the result .