1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-04 06:45:43 +02:00

[218304] Improve deferred adapter loading

This commit is contained in:
Martin Oberhuber 2008-04-10 15:47:48 +00:00
parent dc383c52f3
commit bfbabda969

View file

@ -1,16 +1,17 @@
/******************************************************************************** /********************************************************************************
* Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved. * Copyright (c) 2007, 2008 IBM Corporation and others. All rights reserved.
* This program and the accompanying materials are made available under the terms * This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is * of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html * available at http://www.eclipse.org/legal/epl-v10.html
* *
* Contributors: * Contributors:
* David Dykstal (IBM) - 168977: refactoring IConnectorService * David Dykstal (IBM) - 168977: refactoring IConnectorService
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
* Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType * Martin Oberhuber (Wind River) - [184095] Replace systemTypeName by IRSESystemType
* Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util * Martin Oberhuber (Wind River) - [186748] Move ISubSystemConfigurationAdapter from UI/rse.core.subsystems.util
* David Dykstal (IBM) - [210474] Deny save password function missing * David Dykstal (IBM) - [210474] Deny save password function missing
* David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception * David Dykstal (IBM) - [225089][ssh][shells][api] Canceling connection leads to exception
* Martin Oberhuber (Wind River) - [218304] Improve deferred adapter loading
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.subsystems; package org.eclipse.rse.ui.subsystems;
@ -108,7 +109,7 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
} }
/** /**
* A runnable that will prompt for a new password. Typically used when * A runnable that will prompt for a new password. Typically used when
* a password has expired. * a password has expired.
*/ */
private class PromptForNewPassword implements Runnable { private class PromptForNewPassword implements Runnable {
@ -147,8 +148,8 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
private boolean acquiring = false; private boolean acquiring = false;
/** /**
* Creates a standard credentials provider for a connector service. * Creates a standard credentials provider for a connector service.
* @param connectorService the connector service associated with this * @param connectorService the connector service associated with this
* provider. * provider.
* @see IConnectorService * @see IConnectorService
*/ */
@ -376,7 +377,15 @@ public class StandardCredentialsProvider extends AbstractCredentialsProvider {
private ISystemValidator getUserIdValidator() { private ISystemValidator getUserIdValidator() {
ISubSystemConfiguration subsystemConfiguration = getPrimarySubSystem().getSubSystemConfiguration(); ISubSystemConfiguration subsystemConfiguration = getPrimarySubSystem().getSubSystemConfiguration();
ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) Platform.getAdapterManager().getAdapter(subsystemConfiguration, ISubSystemConfigurationAdapter.class); ISubSystemConfigurationAdapter adapter = (ISubSystemConfigurationAdapter) subsystemConfiguration.getAdapter(ISubSystemConfigurationAdapter.class);
// TODO This typically runs in the UI thread. It should probably be
// moved into the promptForCredentials() method which typically runs in
// a Job, or even into {@link SubSystem#promptForPassword()}. See
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=218304
if (adapter == null) {
Platform.getAdapterManager().loadAdapter(subsystemConfiguration, ISubSystemConfigurationAdapter.class.getName());
adapter = (ISubSystemConfigurationAdapter) subsystemConfiguration.getAdapter(ISubSystemConfigurationAdapter.class);
}
ISystemValidator validator = adapter.getUserIdValidator(subsystemConfiguration); ISystemValidator validator = adapter.getUserIdValidator(subsystemConfiguration);
return validator; return validator;
} }