Launching a URL from an Eclipse plugin

前端 未结 4 871
星月不相逢
星月不相逢 2020-12-15 11:34

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 d

相关标签:
4条回答
  • 2020-12-15 12:07

    You are looking for:

    final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser( ... );
    browser.openURL(url);
    
    0 讨论(0)
  • 2020-12-15 12:11

    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/"));
    
    0 讨论(0)
  • 2020-12-15 12:14

    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.

    0 讨论(0)
  • 2020-12-15 12:20

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

    (Alternatively, Java 6 introduced the Desktop class.)

    0 讨论(0)
提交回复
热议问题