Skip to content

Commit d80f0a3

Browse files
author
jantje
committed
Other way of opening browser for #397
1 parent 1f85689 commit d80f0a3

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

it.baeyens.arduino.core/src/it/baeyens/arduino/actions/LinkCommandHandler.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
package it.baeyens.arduino.actions;
22

3-
import java.awt.Desktop;
4-
import java.io.IOException;
5-
import java.net.URI;
6-
import java.net.URISyntaxException;
7-
83
import org.eclipse.core.commands.AbstractHandler;
94
import org.eclipse.core.commands.ExecutionEvent;
105
import org.eclipse.core.commands.ExecutionException;
@@ -21,8 +16,9 @@ public class LinkCommandHandler extends AbstractHandler {
2116
public Object execute(ExecutionEvent event) throws ExecutionException {
2217
try {
2318
String url = event.getParameter("it.baeyens.arduino.core.link.parameter");//$NON-NLS-1$
24-
Desktop.getDesktop().browse(new URI(url));
25-
} catch (IOException | URISyntaxException e) {
19+
// Desktop.getDesktop().browse(new URI(url));
20+
org.eclipse.swt.program.Program.launch(url);
21+
} catch (IllegalArgumentException e) {
2622
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.json_browser_fail, e));
2723
}
2824
return null;

it.baeyens.arduino.core/src/it/baeyens/arduino/ui/LinkPreferencePage.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@
1212

1313
import java.awt.Desktop;
1414
import java.io.File;
15-
import java.io.IOException;
16-
import java.net.URI;
17-
import java.net.URISyntaxException;
1815
import java.util.Arrays;
1916
import java.util.HashSet;
2017
import java.util.Set;
@@ -114,9 +111,10 @@ protected void createFieldEditors() {
114111
public void linkActivated(HyperlinkEvent he) {
115112
if (Desktop.isDesktopSupported()) {
116113
try {
117-
Desktop.getDesktop().browse(new URI(link.getHref().toString()));
114+
// Desktop.getDesktop().browse(new URI());
115+
org.eclipse.swt.program.Program.launch(link.getHref().toString());
118116

119-
} catch (IOException | URISyntaxException e) {
117+
} catch (IllegalArgumentException e) {
120118
Common.log(new Status(IStatus.ERROR, Const.CORE_PLUGIN_ID, Messages.json_browser_fail, e));
121119
}
122120

0 commit comments

Comments
 (0)