English 中文(简体)
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.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?

问题回答

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.





相关问题
C# Networking API s [closed]

Lately I ve been looking for a good networking API i could possibly use and/or reference some of the code within, but i have mere luck searching for some on Google/Bing. Hopefully somebody here has ...

Listen to a port that is in use [duplicate]

Possible Duplicate: Get connecting IP from specified ports that using by other program. If a port is used by a program, is there any way I can listen that port and get the connected IP on that ...

Twisted Spread suitable for multiplayer racing sim?

Do you think that Twisted Spread may be suitable (in terms of performance) for a multiplayer racing simulator? The rest of the application is based on Python-Ogre. Can Perspective Broker run upon (...

Optimizing a LAN server for a game

I m the network programmer on a school game project. We want to have up to 16 players at once on a LAN. I am using the Server-Client model and am creating a new thread per client that joins. ...

multicast ip address - blocked in call to recvfrom

i am writing a simple multicast application. i intend to run it on localhost. i have done the following: char *maddr; . . . sendfd = socket(...); struct sockaddr_in sasend; sasend.sin_family = ...

Java HTTPAUTH

我试图把桌面应用程序连接起来,我是同D.icio.us api @ Delicious Alan书写的,简单地向他们提供我的用户名和密码,并请他把书记上写给我......。

热门标签