use of org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFParamsProviderMessages in project sts4 by spring-projects.
the class ManifestYamlLanguageServer method applyCfLoginParameterSettings.
@SuppressWarnings("unchecked")
private void applyCfLoginParameterSettings(CfTargetsInfo info) {
List<Target> cfTargets = info.getCfTargets();
if (cfTargets != null) {
CfTargetsInfoProvder cfClientParamsProvider = new CfTargetsInfoProvder(info);
cfClientConfig.setClientParamsProvider(new ClientParamsProvider() {
@Override
public Collection<CFClientParams> getParams() throws NoTargetsException, ExecutionException {
List<ClientParamsProvider> providers = ImmutableList.of(defaultClientParamsProvider, cfClientParamsProvider);
List<CFClientParams> params = new ArrayList<>();
for (ClientParamsProvider provider : providers) {
try {
params.addAll(provider.getParams());
} catch (Exception e) {
// ignore
}
}
if (params.isEmpty()) {
throw new NoTargetsException(getMessages().noTargetsFound());
}
return params;
}
@Override
public CFParamsProviderMessages getMessages() {
return cfTargets.isEmpty() ? defaultClientParamsProvider.getMessages() : cfClientParamsProvider.getMessages();
}
});
}
}
Aggregations