Skip to content

Commit

Permalink
Improve help command
Browse files Browse the repository at this point in the history
  • Loading branch information
nixonwidjaja committed Oct 26, 2023
1 parent e1042de commit 49269bd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/main/java/seedu/address/ui/HelpWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
public class HelpWindow extends UiPart<Stage> {

public static final String USERGUIDE_URL = "https://se-education.org/addressbook-level3/UserGuide.html";
public static final String USERGUIDE_URL = "https://ay2324s1-cs2103-f13-2.github.io/tp/UserGuide.html";
public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL;

private static final Logger logger = LogsCenter.getLogger(HelpWindow.class);
Expand Down
14 changes: 10 additions & 4 deletions src/main/java/seedu/address/ui/MainWindow.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package seedu.address.ui;

import java.awt.Desktop;
import java.net.URL;
import java.util.logging.Logger;

import javafx.event.ActionEvent;
Expand Down Expand Up @@ -136,14 +138,18 @@ private void setWindowDefaultSize(GuiSettings guiSettings) {
}

/**
* Opens the help window or focuses on it if it's already opened.
* Opens the help window.
*/
@FXML
public void handleHelp() {
if (!helpWindow.isShowing()) {
if (!Desktop.isDesktopSupported() || !Desktop.getDesktop().isSupported(Desktop.Action.BROWSE)) {
helpWindow.show();
return;
}
try {
Desktop.getDesktop().browse(new URL(HelpWindow.USERGUIDE_URL).toURI());
} catch (Exception e) {
helpWindow.show();
} else {
helpWindow.focus();
}
}

Expand Down

0 comments on commit 49269bd

Please sign in to comment.