I'd like to have my Eclipse plugin cause a URL to be opened by the users' default browser. This seems like pretty standard behavior, but I haven't been able to find any docs on how to do this.
Can anyone help?
I'd like to have my Eclipse plugin cause a URL to be opened by the users' default browser. This seems like pretty standard behavior, but I haven't been able to find any docs on how to do this.
Can anyone help?
Do you mean launch an external windows (IE, FireFox, ...) outside eclipse, or opening an internal "Browser" composite ?
Because on the internal side, the org.eclipse.help.ui.internal.browser.embedded.EmbeddedBrowser seems to be able to define any kind of major browser.
To open the default user's browser (as an internal or external window) is a preference defined in General/Web browser.
Use Program.launch(String) from the SWT API.
(Alternatively, Java 6 introduced the Desktop class.)
You are looking for:
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser( ... );
browser.openURL(url);
If you want it in an external browser, you don't need to create one. This is the way:
PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("http://www.example.com/"));