protected void createServerSelectionControl(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    group.setText(PHPServerUIMessages.getString("ServerTab.server")); // $NON-NLS-1$
    GridLayout ly = new GridLayout(1, false);
    ly.marginHeight = 0;
    ly.marginWidth = 0;
    group.setLayout(ly);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Composite phpServerComp = new Composite(group, SWT.NONE);
    phpServerComp.setLayout(new GridLayout(4, false));
    phpServerComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    phpServerComp.setFont(parent.getFont());

    Label label = new Label(phpServerComp, SWT.WRAP);
    GridData data = new GridData(GridData.BEGINNING);
    data.widthHint = 100;
    label.setLayoutData(data);
    label.setFont(parent.getFont());
    label.setText(PHPServerUIMessages.getString("ServerLaunchConfigurationTab.0")); // $NON-NLS-1$

    serverCombo = new Combo(phpServerComp, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
    serverCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    serverCombo.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            handleServerSelection();
          }
        });

    createNewServer =
        createPushButton(
            phpServerComp, PHPServerUIMessages.getString("ServerTab.new"), null); // $NON-NLS-1$
    createNewServer.addSelectionListener(fListener);

    configureServers =
        createPushButton(
            phpServerComp,
            PHPServerUIMessages.getString("ServerTab.configure"),
            null); //$NON-NLS-1$
    configureServers.addSelectionListener(fListener);

    servers = new ArrayList<Server>();
    populateServerList(servers);

    // initialize the servers list
    if (!servers.isEmpty()) {
      for (int i = 0; i < servers.size(); i++) {
        Server svr = servers.get(i);
        serverCombo.add(svr.getName());
      }
    }

    // select first item in list
    if (serverCombo.getItemCount() > 0) {
      serverCombo.select(0);
    }

    serverCombo.forceFocus();
  }
 protected void initializeServerControl(ILaunchConfiguration configuration) {
   try {
     String serverName = configuration.getAttribute(Server.NAME, ""); // $NON-NLS-1$
     if (serverName != null && !serverName.equals("")) { // $NON-NLS-1$
       server = ServersManager.getServer(serverName);
       if (server == null) { // server no longer exists
         setErrorMessage(
             PHPServerUIMessages.getString("ServerTab.invalidServerError")); // $NON-NLS-1$
         selectDefaultServer(configuration);
       } else {
         serverCombo.setText(server.getName());
       }
     } else {
       selectDefaultServer(configuration);
     }
     // flag should only be set if launch has been attempted on the
     // config
     if (configuration.getAttribute(READ_ONLY, false)) {
       serverCombo.setEnabled(false);
     }
     boolean enabled = configuration.getAttribute(SERVER_ENABLED, true);
     serverCombo.setEnabled(enabled);
     createNewServer.setEnabled(enabled);
   } catch (Exception e) {
   }
 }
  public void createURLControl(Composite composite) {
    Group group = new Group(composite, SWT.NONE);
    String projectLabel = PHPServerUIMessages.getString("ServerTab.url"); // $NON-NLS-1$
    group.setText(projectLabel);
    group.setLayout(new GridLayout(2, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    autoGeneratedURL = new Button(group, SWT.CHECK);
    autoGeneratedURL.setText(
        PHPServerUIMessages.getString("ServerTab.autoGenerate")); // $NON-NLS-1$
    autoGeneratedURL.setSelection(true);
    autoGeneratedURL.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1));
    autoGeneratedURL.addSelectionListener(
        new SelectionAdapter() {
          public void widgetSelected(SelectionEvent e) {
            initializeURLControl();
            updateLaunchConfigurationDialog();
          }
        });

    fURLLabel = new Label(group, SWT.NONE);
    fURLLabel.setText(PHPServerUIMessages.getString("ServerTab.urlLabel")); // $NON-NLS-1$
    GridData gridData = new GridData();
    gridData.horizontalIndent = 20;
    gridData.horizontalSpan = 1;
    fURLLabel.setLayoutData(gridData);

    Composite urlComposite = new Composite(group, SWT.NONE);
    urlComposite.setLayout(new GridLayout(2, false));
    urlComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fURLHost = new Text(urlComposite, SWT.SINGLE | SWT.BORDER);
    fURLHost.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fURLHost.setEnabled(false);

    fURLPath = new Text(urlComposite, SWT.SINGLE | SWT.BORDER);
    fURLPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fURLPath.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            updateLaunchConfigurationDialog();
          }
        });
  }
  protected void createFileComponent(Composite parent) {
    Group group = new Group(parent, SWT.NONE);
    String projectLabel = PHPServerUIMessages.getString("ServerTab.file_project"); // $NON-NLS-1$
    group.setText(projectLabel);
    group.setLayout(new GridLayout(3, false));
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fFile = new Text(group, SWT.SINGLE | SWT.BORDER);
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;
    fFile.setLayoutData(gd);
    fFile.addModifyListener(fListener);

    fileButton =
        createPushButton(
            group, PHPServerUIMessages.getString("ServerTab.browse"), null); // $NON-NLS-1$
    gd = (GridData) fileButton.getLayoutData();
    gd.horizontalSpan = 1;
    fileButton.addSelectionListener(fListener);

    handleServerSelection();
  }
  /** @see org.eclipse.debug.ui.ILaunchConfigurationTab#isValid(ILaunchConfiguration) */
  public boolean isValid(ILaunchConfiguration launchConfig) {
    setMessage(null);
    setErrorMessage(null);
    // TODO - Note that this method of removing invalid launches is still
    // buggy
    // In order to fix it completely, we might have to perform similar
    // checks when removing or renaming a server from
    // the PHP Servers preferences page.
    try {
      String serverName = launchConfig.getAttribute(Server.NAME, ""); // $NON-NLS-1$
      if (!serverName.equals("")) { // $NON-NLS-1$
        Server server = ServersManager.getServer(serverName);
        if (server == null) {
          deleteLaunchConfiguration(launchConfig);
          ILaunchConfiguration[] allConfigurations =
              DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
          for (ILaunchConfiguration element : allConfigurations) {
            launchConfig = element;
            serverName = launchConfig.getAttribute(Server.NAME, ""); // $NON-NLS-1$
            if (!serverName.equals("")
                && ServersManager.getServer(serverName) == null) { // $NON-NLS-1$
              // The server was removed, so remove this launch
              // configuration!
              deleteLaunchConfiguration(launchConfig);
            }
          }
          return false;
        }
      }

      String fileName = launchConfig.getAttribute(Server.FILE_NAME, ""); // $NON-NLS-1$
      IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(fileName);
      if (!(resource instanceof IFile)) {
        setErrorMessage(
            PHPServerUIMessages.getString("ServerTab.file_project_doesNotExist")); // $NON-NLS-1$
        return false;
      }

    } catch (CoreException e) {
      // ignore
    }

    return isValidExtension(launchConfig);
  }
  /** Called when a server is selected. This method should not be called directly. */
  protected void handleServerSelection() {
    int numEntries = serverCombo.getItemCount();
    int index = serverCombo.getSelectionIndex();

    if (!servers.isEmpty()) {
      Object obj = servers.get(serverCombo.getSelectionIndex());
      if (obj != null && obj instanceof Server) {
        server = servers.get(serverCombo.getSelectionIndex());
        initializeURLControl();
      }
    }

    if (server == null && (index + 1) != numEntries)
      setErrorMessage(
          PHPServerUIMessages.getString("ServerTab.noSelectedServerError")); // $NON-NLS-1$
    else {
      setErrorMessage(null);
    }
    updateLaunchConfigurationDialog();
  }
 /** @see org.eclipse.debug.ui.ILaunchConfigurationTab#getName() */
 public String getName() {
   return PHPServerUIMessages.getString("ServerTab.server"); // $NON-NLS-1$
 }