List<String> servicesToDelete = new ArrayList<String>();
// Fetch an updated application so that it has the lastest
// service list
CloudApplication application = null;
if (updatedApplications != null) {
for (CloudApplication app : updatedApplications) {
if (app.getName().equals(appModule.getDeployedApplicationName())) {
application = app;
break;
}
}
}
// ONLY delete a remote application if an application is found.
if (application != null) {
List<String> actualServices = application.getServices();
if (actualServices != null) {
// This has to be used instead of addAll(..), as
// there is a chance the list is non-empty but
// contains null entries
for (String serviceName : actualServices) {
if (serviceName != null) {
servicesToDelete.add(serviceName);
}
}
}
this.cloudFoundryServerBehaviour.deleteApplication(application.getName(), monitor);
}
CloudFoundryPlugin.getCallback().stopApplicationConsole(appModule, cloudServer);