Running URLs from Eclipse Plugin

I want my Eclipse plugin to call the URL that the default browser opens for users. This seems like pretty standard behavior, but I could not find any documents on how to do this.

Can anyone help?

+7
java eclipse eclipse-plugin
source share
4 answers

You are looking for:

final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser( ... ); browser.openURL(url); 
+7
source share

If you want it in an external browser, you do not need to create it. This is the way:

 PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL("http://www.example.com/")); 
+12
source share

Use Program.launch (String) from the SWT API.

(As an alternative, Java 6 introduced the Desktop class.)

+7
source share

Do you mean launching external windows (IE, FireFox, ...) outside of eclipse or opening an internal " browser " composite?

Since on the inside, org.eclipse.help.ui.internal.browser.embedded.EmbeddedBrowser seems to be able to detect any kind of main browser.

To open the user's default browser (as an internal or external window), this is the preference set in the general / web browser.

+1
source share

All Articles