Package org.eclipse.php.internal.server.core

Examples of org.eclipse.php.internal.server.core.Server


   * @param group
   * @param numColumns
   */
  protected void createLocalServersGroup(final Group group, final int numColumns) {
    Server[] servers = ServersManager.getServers();
    Server defaultServer = ServersManager.getDefaultServer(null);
    List<String> docRoots = new ArrayList<String>();
    int selection = 0;
    for (int i = 0; i < servers.length; i++) {
      String docRoot = servers[i].getDocumentRoot();
      if (docRoot != null && !"".equals(docRoot.trim())) { //$NON-NLS-1$
        docRoots.add(docRoot);
        if (defaultServer != null && servers[i].getDocumentRoot().equals(defaultServer.getDocumentRoot())) {
          selection = i;
        }
      }
    }
   
View Full Code Here


   * @param serverName
   * @return debugger id
   */
  public static String getDebuggerId(String serverName) {
    if (serverName != null) {
      Server server = ServersManager.getServer(serverName);
      String serverDebuggerId = server.getDebuggerId();
      if (serverDebuggerId != null) {
        return serverDebuggerId;
      }
    }
    return PHPDebugPlugin.getCurrentDebuggerId();
View Full Code Here

   * Creates a default server in case the ServersManager does not hold any
   * defined server.
   */
  public static void createDefaultPHPServer() {
    if (ServersManager.getServers().length == 0) {
      Server server = null;
      try {
        server = ServersManager.createServer(
            IPHPDebugConstants.Default_Server_Name, BASE_URL);
      } catch (MalformedURLException e) {
        // safe - no exception
View Full Code Here

      String phpExeFile = (String) entryMap.get("phpExe"); //$NON-NLS-1$
      String phpIniFile = (String) entryMap.get("phpIni"); //$NON-NLS-1$
      PathMapper pathMapper = new PathMapper();
      pathMapper.restoreFromMap((HashMap) entryMap.get("mapper")); //$NON-NLS-1$
      if (serverName != null) {
        Server server = ServersManager.getServer(serverName);
        if (server != null) {
          serverPathMapper.put(server, pathMapper);
        }
      } else if (phpExeFile != null) {
        PHPexeItem phpExeItem = PHPexes.getInstance().getItemForFile(
View Full Code Here

    HashMap elements = new HashMap();
    Iterator i = serverPathMapper.keySet().iterator();
    int c = 1;
    while (i.hasNext()) {
      HashMap entry = new HashMap();
      Server server = (Server) i.next();
      PathMapper pathMapper = serverPathMapper.get(server);
      entry.put("server", server.getName()); //$NON-NLS-1$
      if (pathMapper != null) {
        entry.put("mapper", pathMapper.storeToMap()); //$NON-NLS-1$
      }
      elements.put("item" + (c++), entry); //$NON-NLS-1$
    }
View Full Code Here

      target = new DBGpTarget(remoteLaunch, null, null,
          session.getIdeKey(), stopAtFirstLine, null);

      // try to locate a relevant server definition so we can get its path
      // mapper
      Server server = null;
      Server[] servers = ServersManager.getServers();
      for (int i = 0; i < servers.length; i++) {
        if (servers[i].getPort() == session.getRemotePort()
            && servers[i].getHost().equalsIgnoreCase(
                session.getRemoteHostname())) {
View Full Code Here

    name.forceFocus();
  }

  protected void init() {
    Server server = getServer();
    if (name == null || server == null)
      return;

    originalValuesCache.url = server.getBaseURL();
    originalValuesCache.serverName = server.getName();
    originalValuesCache.host = server.getHost();
    originalValuesCache.webroot = server.getDocumentRoot();
    originalValuesCache.debuggerId = server.getDebuggerId();
    // Clone the cache
    modifiedValuesCache = new ValuesCache(originalValuesCache);

    if (originalValuesCache.serverName != null) {
      boolean nameSet = false;
      String serverName = originalValuesCache.serverName;
      String orgName = serverName;
      if (!isForEditing()) {
        for (int i = 0; i < 10; i++) {
          boolean ok = checkServerName(serverName);
          if (ok) {
            name.setText(serverName);
            // workingCopy.setName(serverName);
            modifiedValuesCache.serverName = serverName;
            nameSet = true;
            break;
          }
          serverName = orgName + " (" + Integer.toString(i + 2) + ")"; //$NON-NLS-1$ //$NON-NLS-2$
        }
        if (!nameSet) {
          name.setText(""); //$NON-NLS-1$
          // workingCopy.setName("");
          modifiedValuesCache.serverName = ""; //$NON-NLS-1$
        }
      } else {
        name.setText(serverName);
      }
    } else {
      name.setText(""); //$NON-NLS-1$
    }
    if (originalValuesCache.webroot != null) {
      webroot.setText(originalValuesCache.webroot);
    }
    if (originalValuesCache.debuggerId != null) {
      String name = PHPDebuggersRegistry
          .getDebuggerName(originalValuesCache.debuggerId);
      String[] values = debuggerCombo.getItems();
      for (int i = 0; i < values.length; i++) {
        if (values[i].equals(name)) {
          debuggerCombo.select(i);
          break;
        }
      }
    }
    String baseURL = originalValuesCache.url;
    if (!baseURL.equals("")) { //$NON-NLS-1$
      url.setText(baseURL);
      try {
        URL originalURL = new URL(baseURL);
        int port = originalURL.getPort();
        originalValuesCache.port = port;
        modifiedValuesCache.port = port;
      } catch (Exception e) {
        setMessage(
            PHPServerUIMessages
                .getString("ServerCompositeFragment.enterValidURL"), IMessageProvider.ERROR); //$NON-NLS-1$
      }
    } else {
      baseURL = "http://" + server.getHost(); //$NON-NLS-1$
      url.setText(baseURL);
      modifiedValuesCache.url = baseURL;
      try {
        URL createdURL = new URL(baseURL);
        int port = createdURL.getPort();
View Full Code Here

    Server[] allServers = ServersManager.getServers();

    if (allServers != null) {
      int size = allServers.length;
      for (int i = 0; i < size; i++) {
        Server server = allServers[i];
        if (name.equals(server.getName()))
          return false;
      }
    }
    return true;
  }
View Full Code Here

    Server[] allServers = ServersManager.getServers();

    if (allServers != null) {
      int size = allServers.length;
      for (int i = 0; i < size; i++) {
        Server server = allServers[i];
        if (url.equals(server.getBaseURL()))
          return false;
      }
    }
    return true;
  }
View Full Code Here

  /**
   * Saves the IServerWorkingCopy.
   */
  public boolean performOk() {
    try {
      Server defaultServer = ServersManager.getDefaultServer(null);
      boolean isDefault = false;
      isDefault = defaultServer != null
          && defaultServer.getName().equals(
              originalValuesCache.serverName);

      Server server = getServer();
      // Save any modification logged into the modified value cache
      // object.
      if (server != null) {
        server.setPort(String.valueOf(modifiedValuesCache.port));
        server.setBaseURL(modifiedValuesCache.url);
      }
      server.setHost(modifiedValuesCache.host);
      server.setName(modifiedValuesCache.serverName);
      server.setDocumentRoot(modifiedValuesCache.webroot);
      server.setDebuggerId(modifiedValuesCache.debuggerId);
      if (originalValuesCache.serverName != null
          && !originalValuesCache.serverName.equals("") && //$NON-NLS-1$
          !originalValuesCache.serverName
              .equals(modifiedValuesCache.serverName)) {
        // Update the ServerManager with the new server name
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.server.core.Server

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.