|
Lines 18-39
Link Here
|
| 18 |
import java.util.List; |
18 |
import java.util.List; |
| 19 |
import java.util.Properties; |
19 |
import java.util.Properties; |
| 20 |
|
20 |
|
|
|
21 |
import org.eclipse.core.internal.net.auth.ProxyAuthenticator; |
| 21 |
import org.eclipse.core.net.proxy.IProxyChangeEvent; |
22 |
import org.eclipse.core.net.proxy.IProxyChangeEvent; |
| 22 |
import org.eclipse.core.net.proxy.IProxyChangeListener; |
23 |
import org.eclipse.core.net.proxy.IProxyChangeListener; |
| 23 |
import org.eclipse.core.net.proxy.IProxyData; |
24 |
import org.eclipse.core.net.proxy.IProxyData; |
| 24 |
import org.eclipse.core.net.proxy.IProxyService; |
25 |
import org.eclipse.core.net.proxy.IProxyService; |
| 25 |
import org.eclipse.core.runtime.Assert; |
26 |
import org.eclipse.core.runtime.Assert; |
| 26 |
import org.eclipse.core.runtime.CoreException; |
|
|
| 27 |
import org.eclipse.core.runtime.IConfigurationElement; |
| 28 |
import org.eclipse.core.runtime.IExtension; |
| 29 |
import org.eclipse.core.runtime.ISafeRunnable; |
27 |
import org.eclipse.core.runtime.ISafeRunnable; |
| 30 |
import org.eclipse.core.runtime.IStatus; |
|
|
| 31 |
import org.eclipse.core.runtime.ListenerList; |
28 |
import org.eclipse.core.runtime.ListenerList; |
| 32 |
import org.eclipse.core.runtime.RegistryFactory; |
|
|
| 33 |
import org.eclipse.core.runtime.SafeRunner; |
29 |
import org.eclipse.core.runtime.SafeRunner; |
| 34 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; |
30 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences.IPreferenceChangeListener; |
| 35 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; |
31 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences.PreferenceChangeEvent; |
| 36 |
import org.eclipse.osgi.util.NLS; |
|
|
| 37 |
import org.osgi.service.prefs.BackingStoreException; |
32 |
import org.osgi.service.prefs.BackingStoreException; |
| 38 |
|
33 |
|
| 39 |
public class ProxyManager implements IProxyService, IPreferenceChangeListener { |
34 |
public class ProxyManager implements IProxyService, IPreferenceChangeListener { |
|
Lines 272-278
Link Here
|
| 272 |
ProxyType type = proxies[i]; |
267 |
ProxyType type = proxies[i]; |
| 273 |
type.initialize(); |
268 |
type.initialize(); |
| 274 |
} |
269 |
} |
| 275 |
registerAuthenticator(); |
270 |
Authenticator.setDefault(new ProxyAuthenticator()); |
| 276 |
} |
271 |
} |
| 277 |
|
272 |
|
| 278 |
public IProxyData getProxyData(String type) { |
273 |
public IProxyData getProxyData(String type) { |
|
Lines 370-401
Link Here
|
| 370 |
return null; |
365 |
return null; |
| 371 |
} |
366 |
} |
| 372 |
|
367 |
|
| 373 |
private void registerAuthenticator() { |
|
|
| 374 |
Authenticator a = getPluggedInAuthenticator(); |
| 375 |
if (a != null) { |
| 376 |
Authenticator.setDefault(a); |
| 377 |
} |
| 378 |
} |
| 379 |
|
| 380 |
private Authenticator getPluggedInAuthenticator() { |
| 381 |
IExtension[] extensions = RegistryFactory.getRegistry().getExtensionPoint(Activator.ID, Activator.PT_AUTHENTICATOR).getExtensions(); |
| 382 |
if (extensions.length == 0) |
| 383 |
return null; |
| 384 |
IExtension extension = extensions[0]; |
| 385 |
IConfigurationElement[] configs = extension.getConfigurationElements(); |
| 386 |
if (configs.length == 0) { |
| 387 |
Activator.log(IStatus.ERROR, NLS.bind("Authenticator {0} is missing required fields", (new Object[] {extension.getUniqueIdentifier()})), null);//$NON-NLS-1$ |
| 388 |
return null; |
| 389 |
} |
| 390 |
try { |
| 391 |
IConfigurationElement config = configs[0]; |
| 392 |
return (Authenticator) config.createExecutableExtension("class");//$NON-NLS-1$ |
| 393 |
} catch (CoreException ex) { |
| 394 |
Activator.log(IStatus.ERROR, NLS.bind("Unable to instantiate authenticator {0}", (new Object[] {extension.getUniqueIdentifier()})), ex);//$NON-NLS-1$ |
| 395 |
return null; |
| 396 |
} |
| 397 |
} |
| 398 |
|
| 399 |
private synchronized void checkMigrated() { |
368 |
private synchronized void checkMigrated() { |
| 400 |
if (preferenceManager.isMigrated() || !Activator.getInstance().instanceLocationAvailable()) { |
369 |
if (preferenceManager.isMigrated() || !Activator.getInstance().instanceLocationAvailable()) { |
| 401 |
return; |
370 |
return; |