Add simple message when no CF target available
When no CF targets available, display a message in the CA UI to the user.
This commit is contained in:
@@ -18,6 +18,7 @@ import javax.inject.Provider;
|
||||
|
||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTarget;
|
||||
import org.springframework.ide.vscode.commons.cloudfoundry.client.cftarget.CFTargetsFactory;
|
||||
import org.springframework.ide.vscode.commons.yaml.schema.BasicYValueHint;
|
||||
import org.springframework.ide.vscode.commons.yaml.schema.YValueHint;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
@@ -26,6 +27,12 @@ public abstract class AbstractCFHintsProvider implements Provider<Collection<YVa
|
||||
|
||||
private final CFTargetsFactory targetsFactory;
|
||||
|
||||
/*
|
||||
* TODO: This is probably a very wrong way of handling "No connections available"
|
||||
*/
|
||||
public static final YValueHint NO_CF_TARGET_HINT = new BasicYValueHint("",
|
||||
"No valid Cloud Foundry target found. Please ensure that you are connected to Cloud Foundry and try again.");
|
||||
|
||||
public AbstractCFHintsProvider(CFTargetsFactory targetsFactory) {
|
||||
this.targetsFactory = targetsFactory;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,12 @@ public class ManifestYamlCFBuildpacksProvider extends AbstractCFHintsProvider {
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
}
|
||||
|
||||
// TODO: probably a very bad thing to do, but for now a workaround to notify the user via the CA UI that there are no
|
||||
// CF targets available.
|
||||
if (hints.isEmpty()) {
|
||||
hints.add(NO_CF_TARGET_HINT);
|
||||
}
|
||||
return hints;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,6 +56,12 @@ public class ManifestYamlCFServicesProvider extends AbstractCFHintsProvider {
|
||||
} catch (Exception e) {
|
||||
logger.log(Level.SEVERE, e.getMessage(), e);
|
||||
}
|
||||
|
||||
// TODO: probably a very bad thing to do, but for now a workaround to notify the user via the CA UI that there are no
|
||||
// CF targets available.
|
||||
if (hints.isEmpty()) {
|
||||
hints.add(NO_CF_TARGET_HINT);
|
||||
}
|
||||
|
||||
return hints;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user