Put the "No Org/Space" message constant where it belongs

This commit is contained in:
Kris De Volder
2017-02-02 13:58:21 -08:00
parent c24b4be073
commit f0fdf0895b
3 changed files with 13 additions and 5 deletions

View File

@@ -15,12 +15,14 @@ package org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget;
*
*/
public interface CFParamsProviderMessages {
String noTargetsFound();
String unauthorised();
String noNetworkConnection();
String noOrgSpace();
}

View File

@@ -67,7 +67,7 @@ public class CfCliParamsProvider implements ClientParamsProvider {
String orgName = (String) orgFields.get(NAME);
String spaceName = (String) spaceFields.get(NAME);
if (!StringUtil.hasText(orgName) || !StringUtil.hasText(spaceName)) {
throw new NoTargetsException("No org/space selected: Use CF CLI to login");
throw new NoTargetsException(getMessages().noOrgSpace());
}
params.add(new CFClientParams(target, null, credentials, orgName, spaceName, sslDisabled));
}

View File

@@ -20,6 +20,7 @@ public final class CfCliProviderMessages implements CFParamsProviderMessages {
*/
public static final String NO_CLI_TARGETS_FOUND_MESSAGE = "No Cloud Foundry targets found: Use cf CLI to login";
public static final String NO_NETWORK_CONNECTION = "No connection to Cloud Foundry: Use cf CLI to login or verify network connection";
public static final String NO_ORG_SPACE = "No org/space selected: Use CF CLI to login";
@Override
public String noTargetsFound() {
@@ -35,4 +36,9 @@ public final class CfCliProviderMessages implements CFParamsProviderMessages {
public String noNetworkConnection() {
return NO_NETWORK_CONNECTION;
}
@Override
public String noOrgSpace() {
return NO_ORG_SPACE;
}
}