protected void serverSelectionChanged(
     CloudFoundryServer cloudServer, CloudFoundryApplicationModule appModule, IAction action) {
   if (cloudServer != null
       && (cloudServer.getServer().getServerState() == IServer.STATE_STARTED)) {
     if (appModule != null) {
       int state = appModule.getState();
       // Enable only if application is running and deployed
       if (state == IServer.STATE_STARTED && appModule.getApplication() != null) {
         action.setEnabled(true);
         return;
       }
     }
   }
   action.setEnabled(false);
 }
  public CloudSpacesSelectionPart(
      CloudSpaceChangeHandler spaceChangeHandler,
      CloudFoundryServer cloudServer,
      IWizardHandle wizardHandle) {
    this.spaceChangeHandler = spaceChangeHandler;

    String serverTypeId = cloudServer.getServer().getServerType().getId();

    wizardHandle.setTitle("Organizations and Spaces");
    wizardHandle.setDescription(DEFAULT_DESCRIPTION);
    ImageDescriptor banner = CloudFoundryImages.getWizardBanner(serverTypeId);
    if (banner != null) {
      wizardHandle.setImageDescriptor(banner);
    }
  }
    @Override
    protected IStatus run(final IProgressMonitor monitor) {
      CloudFoundryServer cf =
          (CloudFoundryServer) server.loadAdapter(CloudFoundryServer.class, monitor);
      if (cf.getPassword() == null) {
        // configuration has not been saved, yet, ignore
        return Status.CANCEL_STATUS;
      }

      if (cf != null
          && cf.getUsername().equals(originalServer.getUsername())
          && cf.getPassword().equals(originalServer.getPassword())
          && cf.getUrl().equals(originalServer.getUrl())) {
        CloudFoundryServerBehaviour behaviour = cf.getBehaviour();
        if (behaviour != null) {
          try {
            behaviour.connect(monitor);
          } catch (CoreException e) {
            CloudFoundryServerUiPlugin.getDefault().getLog().log(e.getStatus());
          }
        }
      }
      return Status.OK_STATUS;
    }
 protected CloudFoundryCredentialsWizardPage(CloudFoundryServer server) {
   super(server.getServer().getName() + " Credentials");
   spaceChangeHandler = new CloudSpaceChangeHandler(server);
   credentialsPart = new CloudFoundryCredentialsPart(server, this, spaceChangeHandler);
 }