Skip to content

Commit

Permalink
Merge pull request #141 from dawg420/fix-viewbackups
Browse files Browse the repository at this point in the history
fixes viewbackups
  • Loading branch information
Creationsv2 authored Mar 30, 2023
2 parents 4b4a769 + a339192 commit d23da47
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 15 deletions.
21 changes: 14 additions & 7 deletions src/main/java/seedu/address/logic/commands/CommandResult.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,19 @@ public class CommandResult {

private final String feedbackToUser;

/** Light mode should be shown to the user. */
/**
* Light mode should be shown to the user.
*/
private final boolean showLight;

/** Dark mode should be shown to the user. */
/**
* Dark mode should be shown to the user.
*/
private final boolean showDark;

/** Help information should be shown to the user. */
/**
* Help information should be shown to the user.
*/
private final boolean showHelp;

/**
Expand Down Expand Up @@ -92,10 +98,11 @@ public boolean equals(Object other) {

CommandResult otherCommandResult = (CommandResult) other;
return feedbackToUser.equals(otherCommandResult.feedbackToUser)
&& showHelp == otherCommandResult.showHelp
&& exit == otherCommandResult.exit
&& showLight == otherCommandResult.showLight
&& showDark == otherCommandResult.showDark;
&& showHelp == otherCommandResult.showHelp
&& exit == otherCommandResult.exit
&& showLight == otherCommandResult.showLight
&& showDark == otherCommandResult.showDark
&& showBackups == otherCommandResult.showBackups;
}

@Override
Expand Down
10 changes: 4 additions & 6 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import seedu.address.logic.commands.CommandResult;
import seedu.address.logic.commands.ViewCommand;
import seedu.address.logic.commands.exceptions.CommandException;
import seedu.address.logic.parser.exceptions.ParseException;
import seedu.address.ui.theme.Theme;
import seedu.address.ui.theme.ThemeException;

Expand Down Expand Up @@ -183,7 +182,7 @@ void show() {
@FXML
private void handleExit() {
GuiSettings guiSettings = new GuiSettings(primaryStage.getWidth(), primaryStage.getHeight(),
(int) primaryStage.getX(), (int) primaryStage.getY(), theme.toString());
(int) primaryStage.getX(), (int) primaryStage.getY(), theme.toString());
logic.setGuiSettings(guiSettings);
helpWindow.hide();
primaryStage.hide();
Expand All @@ -194,8 +193,7 @@ private void handleExit() {
*
* @see seedu.address.logic.Logic#execute(String)
*/
private CommandResult executeCommand(String commandText) throws CommandException,
ParseException, IllegalValueException {
private CommandResult executeCommand(String commandText) throws CommandException, IllegalValueException {
try {
CommandResult commandResult = logic.execute(commandText);
logger.info("Result: " + commandResult.getFeedbackToUser());
Expand All @@ -214,7 +212,7 @@ private CommandResult executeCommand(String commandText) throws CommandException
isShowBackup = true;
}

if (isShowBackup) {
if (!commandResult.isShowBackups()) {
newFillInnerParts();
isShowBackup = false;
}
Expand All @@ -228,7 +226,7 @@ private CommandResult executeCommand(String commandText) throws CommandException
}

return commandResult;
} catch (CommandException | ParseException e) {
} catch (CommandException e) {
logger.info("Invalid command: " + commandText);
resultDisplay.setFeedbackToUser(e.getMessage());
throw e;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public void setUp() {

@Test
public void execute_success() {
assertCommandSuccess(new ViewBackupsCommand(), model, ViewBackupsCommand.MESSAGE_SUCCESS,
expectedModel);
ViewBackupsCommand toTest = new ViewBackupsCommand();
assertCommandSuccess(toTest, model, toTest.execute(model), expectedModel);
}
}

0 comments on commit d23da47

Please sign in to comment.