/**
   * @see org.eclipse.debug.ui.ILaunchConfigurationTab#performApply(ILaunchConfigurationWorkingCopy)
   */
  public void performApply(ILaunchConfigurationWorkingCopy configuration) {
    if (server != null) {
      configuration.setAttribute(Server.NAME, server.getName());
    } else {
      configuration.setAttribute(Server.NAME, (String) null);
    }
    String fileName = fFile.getText();

    String urlPath = fURLPath.getText().replace('\\', '/');
    if (urlPath.startsWith("/")) { // $NON-NLS-1$
      urlPath = urlPath.substring(1);
    }
    String url = fURLHost.getText() + urlPath;
    configuration.setAttribute(Server.FILE_NAME, fileName);
    configuration.setAttribute(Server.BASE_URL, url);
    configuration.setAttribute(AUTO_GENERATED_URL, autoGeneratedURL.getSelection());

    try {
      updateURLEnabled(configuration);
    } catch (CoreException e) {
      PHPDebugPlugin.log(e);
    }

    applyExtension(configuration);

    if (saveWorkingCopy) {
      try {
        configuration.doSave();
      } catch (CoreException e) {
      }
      saveWorkingCopy = false;
    }
    applyLaunchDelegateConfiguration(configuration);
  }
 /**
  * Apply the launch configuration delegate class that will be used when using this launch with the
  * {@link PHPLaunchDelegateProxy}. This method sets the class name of the launch delegate that is
  * associated with the debugger that was defined to this launch configuration. The class name is
  * retrieved from the debugger's {@link IDebuggerConfiguration}.
  *
  * @param configuration A ILaunchConfigurationWorkingCopy
  */
 protected void applyLaunchDelegateConfiguration(
     final ILaunchConfigurationWorkingCopy configuration) {
   String debuggerID = null;
   try {
     debuggerID =
         configuration.getAttribute(
             PHPDebugCorePreferenceNames.PHP_DEBUGGER_ID, PHPDebugPlugin.getCurrentDebuggerId());
     AbstractDebuggerConfiguration debuggerConfiguration =
         PHPDebuggersRegistry.getDebuggerConfiguration(debuggerID);
     configuration.setAttribute(
         PHPDebugCorePreferenceNames.CONFIGURATION_DELEGATE_CLASS,
         debuggerConfiguration.getWebLaunchDelegateClass());
   } catch (Exception e) {
     Logger.logException(e);
   }
 }
 /**
  * @param phpExe
  * @return debug port for given phpExe
  * @throws CoreException
  */
 protected int getDebugPort(PHPexeItem phpExe) throws CoreException {
   int customRequestPort = XDebugDebuggerSettingsUtil.getDebugPort(phpExe.getUniqueId());
   if (customRequestPort != -1) return customRequestPort;
   return PHPDebugPlugin.getDebugPort(XDebugCommunicationDaemon.XDEBUG_DEBUGGER_ID);
 }
  /*
   * (non-Javadoc)
   *
   * @seeorg.eclipse.php.internal.debug.core.debugger.parameters.
   * IDebugParametersInitializer
   * #generateQueryParameters(org.eclipse.debug.core.ILaunch)
   */
  public Hashtable<String, String> getDebugParameters(ILaunch launch) {
    Hashtable<String, String> parameters = new Hashtable<String, String>();
    ILaunchConfiguration launchConfiguration = launch.getLaunchConfiguration();
    parameters.put(START_DEBUG, "1"); // $NON-NLS-1$

    String port = launch.getAttribute(IDebugParametersKeys.PORT);
    if (port != null) {
      parameters.put(DEBUG_PORT, port);
    } else {
      PHPDebugPlugin.logErrorMessage(
          "A port was not defined for the DefaultDebugParametersInitializer."); //$NON-NLS-1$
    }

    if (getBooleanValue(launch.getAttribute(IDebugParametersKeys.PASSIVE_DEBUG))) {
      parameters.put(DEBUG_PASSIVE, "1"); // $NON-NLS-1$
    }

    parameters.put(SEND_SESS_END, "1"); // $NON-NLS-1$

    if (getBooleanValue(launch.getAttribute(IDebugParametersKeys.WEB_SERVER_DEBUGGER))) {
      String debugHosts = PHPDebugPlugin.getDebugHosts();
      // Set up custom server debug hosts if any
      if (launchConfiguration != null) {
        try {
          Server server =
              ServersManager.getServer(
                  launchConfiguration.getAttribute(Server.NAME, "")); // $NON-NLS-1$
          String customHosts = ZendDebuggerSettingsUtil.getDebugHosts(server.getUniqueId());
          if (!customHosts.isEmpty()) debugHosts = customHosts;
        } catch (CoreException ce) {
          Logger.logException(ce);
        }
      }
      parameters.put(DEBUG_HOST, debugHosts);

      parameters.put(DEBUG_NO_CACHE, Long.toString(System.currentTimeMillis()));
    }

    if (ILaunchManager.DEBUG_MODE.equals(launch.getLaunchMode())
        && getBooleanValue(launch.getAttribute(IDebugParametersKeys.FIRST_LINE_BREAKPOINT))) {
      parameters.put(DEBUG_STOP, "1"); // $NON-NLS-1$
    }
    String url = launch.getAttribute(IDebugParametersKeys.ORIGINAL_URL);
    if (url != null) {
      parameters.put(ORIGINAL_URL, url);
    }
    if (launchConfiguration != null) {
      try {
        String sessionSetting =
            launchConfiguration.getAttribute(
                IPHPDebugConstants.DEBUGGING_PAGES, IPHPDebugConstants.DEBUGGING_ALL_PAGES);
        if (IPHPDebugConstants.DEBUGGING_ALL_PAGES.equals(sessionSetting)) {
          parameters.put(DEBUG_ALL_PAGES, "1"); // $NON-NLS-1$
        } else if (IPHPDebugConstants.DEBUGGING_FIRST_PAGE.equals(sessionSetting)) {
          parameters.put(DEBUG_FIRST_PAGE, "1"); // $NON-NLS-1$
        } else if (IPHPDebugConstants.DEBUGGING_START_FROM.equals(sessionSetting)) {
          parameters.put(
              DEBUG_START_URL,
              launchConfiguration.getAttribute(
                  IPHPDebugConstants.DEBUGGING_START_FROM_URL, "")); // $NON-NLS-1$
          if (launchConfiguration.getAttribute(
              IPHPDebugConstants.DEBUGGING_SHOULD_CONTINUE, false)) {
            parameters.put(DEBUG_CONTINUE, "1"); // $NON-NLS-1$
          }
        }
      } catch (CoreException ce) {
        Logger.logException(ce);
      }
    }
    String sessID = launch.getAttribute(IDebugParametersKeys.SESSION_ID);
    if (sessID != null) {
      parameters.put(DEBUG_SESSION_ID, sessID);
    }

    return parameters;
  }