protected boolean getOriginalSystemProxiesEnabled() {
return originalSystemProxiesEnabled;
}
public void run() throws CoreException {
IProxyService proxyService = getProxyService();
originalSystemProxiesEnabled = proxyService.isSystemProxiesEnabled();
originalProxiesEnabled = proxyService.isProxiesEnabled();
originalData = proxyService.getProxyData();
try {
// set new proxy
proxyService.setSystemProxiesEnabled(false);
proxyService.setProxiesEnabled(enableProxies);
IProxyData[] data = proxyService.getProxyData();
IProxyData matchedData = null;
for (IProxyData singleData : data) {
if (singleData.getType().equals(proxyDataType)) {
matchedData = singleData;
break;
}
}
if (matchedData == null) {
throw new CoreException(CloudFoundryPlugin.getErrorStatus("No matched proxy data type found for: "
+ proxyDataType));
}
matchedData.setHost(host);
matchedData.setPort(port);
proxyService.setProxyData(data);
handleProxyChange();
}
finally {
// restore proxy settings
proxyService.setSystemProxiesEnabled(originalSystemProxiesEnabled);
proxyService.setProxiesEnabled(originalProxiesEnabled);
proxyService.setProxyData(originalData);
}
}