在 RCP 应用程序中设置网络选项
我们有一个 RCP 应用程序,有时确实会从互联网上的 URL 获取一些数据。我们的客户使用代理服务器,除非网络设置正确(设置代理服务器的 IP 和端口号),否则我们无法获取所需的信息。
在 Eclipse(IDE)中,可以通过 Preferences->General->Network Connections 对话框来设置这些设置。我设法包含了首选项对话框(menu.add(new OpenPreferencesAction(window));
,甚至获得了一个选项“网络连接”(通过添加对org.eclipse的依赖项。 ui.net
在插件设置中。)但是当我打开对话框时,它显示“当前显示的页面包含无效值。”并且我无法在
日志文件中设置任何值:(谢谢。至 VonC)
!ENTRY org.eclipse.jface 4 2 2009-11-09 21:51:39.798 !MESSAGE 从插件“org.eclipse.jface”调用代码时出现问题。 !堆栈0 java.lang.NoClassDefFoundError: org/eclipse/core/internal/net/ProxySelector 在 org.eclipse.ui.internal.net.ProxyEntriesComposite.initializeValues(ProxyEntriesComposite.java:248) 在 org.eclipse.ui.internal.net.ProxyEntriesComposite.createWidgets(ProxyEntriesComposite.java:130) 在 org.eclipse.ui.internal.net.ProxyEntriesComposite。(ProxyEntriesComposite.java:57) 在 org.eclipse.ui.internal.net.ProxyPreferencePage.createProxyEntriesComposite(ProxyPreferencePage.java:81) 在 org.eclipse.ui.internal.net.ProxyPreferencePage.createContents(ProxyPreferencePage.java:54) 在 org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:235)
有谁知道一种方法来告诉 eclipse-RCP 应用程序使用什么网络设置,或者通过使用首选项页面,通过手动编码,或者通过使用一些配置文件?
We have a RCP application that does sometimes get some data from URLs in the internet. Our customer uses a Proxy-Server, and we can't get to the information we need unless the network-settings are correct (Setting IP of Proxy and the Port-Number).
In Eclipse (the IDE), there is the Preferences->General->Network Connections Dialog to set those settings. I managed to include the Preferences Dialog( menu.add(new OpenPreferencesAction(window));
, and even to get an option "Network Connections" (By adding a dependency to org.eclipse.ui.net
in the plugin-settings.) But when I open the dialog, it says "The currently displayed page contains invalid values." and I can't set any values there.
the log files says: (thanks to VonC)
!ENTRY org.eclipse.jface 4 2 2009-11-09 21:51:39.798
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: org/eclipse/core/internal/net/ProxySelector
at org.eclipse.ui.internal.net.ProxyEntriesComposite.initializeValues(ProxyEntriesComposite.java:248)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.createWidgets(ProxyEntriesComposite.java:130)
at org.eclipse.ui.internal.net.ProxyEntriesComposite.(ProxyEntriesComposite.java:57)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createProxyEntriesComposite(ProxyPreferencePage.java:81)
at org.eclipse.ui.internal.net.ProxyPreferencePage.createContents(ProxyPreferencePage.java:54)
at org.eclipse.jface.preference.PreferencePage.createControl(PreferencePage.java:235)
Does someone know a way to tell an eclipse-RCP application what network settings to use, either by using the preference page, by manual coding, or by using some configuration files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看起来我终于明白了:
如何在 Windows 32 位的 RCP 应用程序中通过首选项页面设置网络配置:
menu.add(new OpenPreferencesAction(getActionBarConfigurer().getWindowConfigurer()
.getWindow()));
将一些 DLL 文件放在硬盘上的某个位置是没有必要的!
Looks like I finally got it:
How to make setting the network configuration by the preference page possible in an RCP-Application in windows 32 bit:
menu.add(new OpenPreferencesAction(getActionBarConfigurer().getWindowConfigurer()
.getWindow()));
Putting some DLL-files somewhere on the harddrive is not nessesary!
如何在自己的插件中使用 eclipse 网络选项(已测试 win32):
添加 jar:org.eclipse.core.net 和 org.eclipse.ui.net
将 jWinHttp-1.0.0.dll (从 org.eclipse.core.net.win32.x86 中提取)添加到目录中
它位于 Windows 路径上(例如 c:\windows)。
也许还可以传递系统属性来搜索特定位置的 dll。
现在您可以使用 net api 了。
Howto use eclipse network options in your own plug-in (tested win32):
add jars: org.eclipse.core.net and org.eclipse.ui.net
add jWinHttp-1.0.0.dll (extraced from org.eclipse.core.net.win32.x86) to a directory
that is on the windows path (e.g. c:\windows).
Maybe it is also possible to pass a system property to search the dll at a specific location.
Now you can use the net api.