|
1 | 1 | package seedu.address.ui; |
2 | 2 |
|
| 3 | +import java.awt.Desktop; |
| 4 | +import java.io.IOException; |
| 5 | +import java.net.URISyntaxException; |
| 6 | +import java.net.URL; |
3 | 7 | import java.util.logging.Logger; |
4 | 8 |
|
5 | 9 | import javafx.fxml.FXML; |
6 | 10 | import javafx.scene.control.Button; |
7 | 11 | import javafx.scene.control.Label; |
8 | | -import javafx.scene.input.Clipboard; |
9 | | -import javafx.scene.input.ClipboardContent; |
10 | 12 | import javafx.stage.Stage; |
11 | 13 | import seedu.address.commons.core.LogsCenter; |
12 | 14 |
|
|
15 | 17 | */ |
16 | 18 | public class HelpWindow extends UiPart<Stage> { |
17 | 19 |
|
18 | | - public static final String USERGUIDE_URL = "https://se-education.org/addressbook-level3/UserGuide.html"; |
19 | | - public static final String HELP_MESSAGE = "Refer to the user guide: " + USERGUIDE_URL; |
| 20 | + public static final String USERGUIDE_URL = |
| 21 | + "https://github.com/AY2223S2-CS2103-F10-2/tp/blob/master/docs/UserGuide.md"; |
| 22 | + public static final String HELP_MESSAGE = "Click on the button to navigate to the user guide >>>"; |
20 | 23 |
|
21 | 24 | private static final Logger logger = LogsCenter.getLogger(HelpWindow.class); |
22 | 25 | private static final String FXML = "HelpWindow.fxml"; |
23 | 26 |
|
24 | 27 | @FXML |
25 | | - private Button copyButton; |
| 28 | + private Button openButton; |
26 | 29 |
|
27 | 30 | @FXML |
28 | 31 | private Label helpMessage; |
@@ -90,13 +93,16 @@ public void focus() { |
90 | 93 | } |
91 | 94 |
|
92 | 95 | /** |
93 | | - * Copies the URL to the user guide to the clipboard. |
| 96 | + * Navigates the user to the user guide URL. |
94 | 97 | */ |
95 | 98 | @FXML |
96 | | - private void copyUrl() { |
97 | | - final Clipboard clipboard = Clipboard.getSystemClipboard(); |
98 | | - final ClipboardContent url = new ClipboardContent(); |
99 | | - url.putString(USERGUIDE_URL); |
100 | | - clipboard.setContent(url); |
| 99 | + private void openUrl() { |
| 100 | + try { |
| 101 | + Desktop.getDesktop().browse(new URL(USERGUIDE_URL).toURI()); |
| 102 | + } catch (IOException e) { |
| 103 | + logger.warning("Cannot open user guide URL"); |
| 104 | + } catch (URISyntaxException e) { |
| 105 | + logger.warning("Cannot open user guide URL"); |
| 106 | + } |
101 | 107 | } |
102 | 108 | } |
0 commit comments