开发者

Setting network options in a RCP Application

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.createWidg开发者_C百科ets(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?


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:

  1. Put the packages org.eclipse.ui.net, org.eclipse.core.net and org.eclipse.core.net.win32.x86 into your target plattform and add dependencies to the first two of these in your Manfifest.MF
  2. Make sure you have compatible versions (That was my mistake, I had an old version of org.eclipse.net.win32.x86). For example, get the all three files from your Galileo Eclipse IDE
  3. In your ActionBarAdvisor class, add: menu.add(new OpenPreferencesAction(getActionBarConfigurer().getWindowConfigurer() .getWindow()));

Putting some DLL-files somewhere on the harddrive is not nessesary!


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜