MCPcopy Create free account
hub / github.com/CodeDead/opal / openWebsite

Method openWebsite

src/main/java/com/codedead/opal/utils/HelpUtils.java:123–150  ·  view source on GitHub ↗

Open a website @param url The URL of the website @param resourceBundle The ResourceBundle object that contains translations

(final String url, final ResourceBundle resourceBundle)

Source from the content-addressed store, hash-verified

121 * @param resourceBundle The {@link ResourceBundle} object that contains translations
122 */
123 public void openWebsite(final String url, final ResourceBundle resourceBundle) {
124 if (url == null)
125 throw new NullPointerException("URL cannot be null!");
126 if (url.isBlank())
127 throw new IllegalArgumentException("URL cannot be blank!");
128
129 logger.info("Opening the website {}", url);
130
131 final RunnableSiteOpener runnableSiteOpener = new RunnableSiteOpener(url, new IRunnableHelper() {
132 @Override
133 public void executed() {
134 Platform.runLater(() -> logger.info("Successfully opened website"));
135 }
136
137 @Override
138 public void exceptionOccurred(final Exception ex) {
139 Platform.runLater(new Runnable() {
140 @Override
141 public void run() {
142 logger.error("Error opening the website {}", url, ex);
143 FxUtils.showErrorAlert(resourceBundle.getString("WebsiteError"), ex.toString(), getClass().getResourceAsStream(SharedVariables.ICON_URL));
144 }
145 });
146 }
147 });
148
149 new Thread(runnableSiteOpener).start();
150 }
151}

Callers 3

codeDeadActionMethod · 0.80
homepageActionMethod · 0.80
donateActionMethod · 0.80

Calls 1

startMethod · 0.80

Tested by

no test coverage detected