/**
   * @param host
   * @param port
   * @param timeout
   * @param appName
   * @param launchName
   * @return non-null launch configuration to debug the given application name.
   * @throws CoreException if unable to resolve launch configuration.
   */
  protected ILaunchConfiguration resolveLaunchConfiguration(String host, int port, int timeout)
      throws CoreException {

    String launchLabel = getLaunchLabel();

    String configID =
        provider.getLaunchConfigurationID() != null
            ? provider.getLaunchConfigurationID()
            : CloudFoundryDebuggingLaunchConfigDelegate.LAUNCH_CONFIGURATION_ID;
    launchConfigType =
        DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(configID);

    if (launchConfigType != null) {

      IProject project = getApplicationModule().getLocalModule().getProject();

      // Create the launch configuration, whether the project exists
      // or not, as there may
      // not be a local project associated with the deployed app
      ILaunchConfiguration launchConfiguration = launchConfigType.newInstance(project, launchLabel);
      ILaunchConfigurationWorkingCopy wc = launchConfiguration.getWorkingCopy();

      if (project != null && project.isAccessible()) {
        wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, project.getName());
      }

      // Convert all to String to make it consistent when reading the
      // attributes later.
      wc.setAttribute(CloudFoundryDebuggingLaunchConfigDelegate.HOST_NAME, host);
      wc.setAttribute(CloudFoundryDebuggingLaunchConfigDelegate.PORT, port + ""); // $NON-NLS-1$
      wc.setAttribute(
          CloudFoundryDebuggingLaunchConfigDelegate.TIME_OUT, timeout + ""); // $NON-NLS-1$
      wc.setAttribute(DebugOperations.CLOUD_DEBUG_LAUNCH_ID, getDebuggerConnectionIdentifier());
      wc.setAttribute(DebugOperations.CLOUD_DEBUG_SERVER, getCloudFoundryServer().getServerId());
      wc.setAttribute(
          DebugOperations.CLOUD_DEBUG_APP_NAME,
          getApplicationModule().getDeployedApplicationName());

      return launchConfiguration = wc.doSave();

    } else {
      throw CloudErrorUtil.toCoreException(
          "No debug launch configuration found for - "
              + provider.getLaunchConfigurationID()); // $NON-NLS-1$
    }
  }
  /**
   * @param monitor
   * @return non-null descriptor
   * @throws CoreException if failed to resolve descriptor
   * @throws OperationCanceledException if cancelled
   */
  protected DebugConnectionDescriptor resolveDescriptor(IProgressMonitor monitor)
      throws CoreException, OperationCanceledException {

    DebugConnectionDescriptor descriptor =
        provider.getDebugConnectionDescriptor(
            getApplicationModule(), getCloudFoundryServer(), monitor);

    return descriptor;
  }
 public boolean isDebugEnabled() {
   return provider.isDebugSupported(getApplicationModule(), getCloudFoundryServer());
 }
 public boolean configure(final IProgressMonitor monitor) throws CoreException {
   return provider.configureApp(getApplicationModule(), getCloudFoundryServer(), monitor);
 }