Search in sources :

Example 1 with ProxyData

use of org.eclipse.core.internal.net.ProxyData in project tycho by eclipse.

the class ProxyServiceFacadeImpl method configureProxy.

@Override
public void configureProxy(String protocol, String host, int port, String user, String password, String nonProxyHosts) {
    ProxyData proxyData = new ProxyData(getProxyType(protocol));
    proxyData.setHost(host);
    proxyData.setPort(port);
    proxyData.setUserid(user);
    proxyData.setPassword(password);
    proxyData.setSource(MAVEN_SETTINGS_SOURCE);
    try {
        proxyService.setProxyData(new IProxyData[] { proxyData });
        if (nonProxyHosts != null && nonProxyHosts.trim().length() > 0) {
            proxyService.setNonProxiedHosts(NON_PROXY_DELIMITERS.split(nonProxyHosts.trim()));
        }
    } catch (CoreException e) {
        throw new RuntimeException(e);
    }
    // have to register authenticator manually as this is provided as extension point in
    // org.eclipse.ui.net only ...
    registerAuthenticator(user, password);
    proxyService.setProxiesEnabled(true);
    // disable the eclipse native proxy providers
    proxyService.setSystemProxiesEnabled(false);
}
Also used : ProxyData(org.eclipse.core.internal.net.ProxyData) IProxyData(org.eclipse.core.net.proxy.IProxyData) CoreException(org.eclipse.core.runtime.CoreException)

Aggregations

ProxyData (org.eclipse.core.internal.net.ProxyData)1 IProxyData (org.eclipse.core.net.proxy.IProxyData)1 CoreException (org.eclipse.core.runtime.CoreException)1