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.
我想让我的Eclipse插件导致用户的默认浏览器打开一个URL。这似乎是非常标准的行为,但我无法找到任何关于如何执行此操作的文档。
Can anyone help?
有人可以帮忙吗?
4 个解决方案
#1
7
You are looking for:
您正在寻找:
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser( ... );
browser.openURL(url);
#2
12
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/"));
#3
7
Use Program.launch(String) from the SWT API.
使用SWT API中的Program.launch(String)。
(Alternatively, Java 6 introduced the Desktop class.)
(或者,Java 6引入了Desktop类。)
#4
1
Do you mean launch an external windows (IE, FireFox, ...) outside eclipse, or opening an internal "Browser" composite ?
你的意思是在eclipse之外启动外部窗口(IE,FireFox,...),或打开内部“浏览器”复合?
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.
因为在内部,org.eclipse.help.ui.internal.browser.embedded.EmbeddedBrowser似乎能够定义任何类型的主要浏览器。
To open the default user's browser (as an internal or external window) is a preference defined in General/Web browser.
要打开默认用户的浏览器(作为内部或外部窗口),请在常规/ Web浏览器中定义首选项。
#1
7
You are looking for:
您正在寻找:
final IWebBrowser browser = PlatformUI.getWorkbench().getBrowserSupport().createBrowser( ... );
browser.openURL(url);
#2
12
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/"));
#3
7
Use Program.launch(String) from the SWT API.
使用SWT API中的Program.launch(String)。
(Alternatively, Java 6 introduced the Desktop class.)
(或者,Java 6引入了Desktop类。)
#4
1
Do you mean launch an external windows (IE, FireFox, ...) outside eclipse, or opening an internal "Browser" composite ?
你的意思是在eclipse之外启动外部窗口(IE,FireFox,...),或打开内部“浏览器”复合?
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.
因为在内部,org.eclipse.help.ui.internal.browser.embedded.EmbeddedBrowser似乎能够定义任何类型的主要浏览器。
To open the default user's browser (as an internal or external window) is a preference defined in General/Web browser.
要打开默认用户的浏览器(作为内部或外部窗口),请在常规/ Web浏览器中定义首选项。