Package org.eclipse.php.internal.debug.core.pathmapper

Examples of org.eclipse.php.internal.debug.core.pathmapper.PathMapper


   */
  private void createLaunch(DBGpSession session) throws CoreException {
    boolean stopAtFirstLine = PHPProjectPreferences
        .getStopAtFirstLine(null);
    DBGpTarget target = null;
    PathMapper mapper = null;
    PHPSourceLookupDirector srcLocator = new PHPSourceLookupDirector();
    srcLocator.setSourcePathComputer(DebugPlugin
        .getDefault()
        .getLaunchManager()
        .getSourcePathComputer(
            "org.eclipse.php.debug.core.sourcePathComputer.php")); //$NON-NLS-1$
    ILaunchConfigurationType type = null;
    ILaunchManager lm = DebugPlugin.getDefault().getLaunchManager();

    if (session.getSessionId() == null) {
      // web launch
      type = lm
          .getLaunchConfigurationType(IPHPDebugConstants.PHPServerLaunchType);
    } else {
      // cli launch
      type = lm
          .getLaunchConfigurationType(IPHPDebugConstants.PHPEXELaunchType);
    }

    ILaunchConfiguration launchConfig = type.newInstance(null,
        PHPDebugCoreMessages.XDebugMessage_remoteSessionTitle);
    srcLocator.initializeDefaults(launchConfig);
    srcLocator.initializeParticipants();
    ILaunch remoteLaunch = new Launch(launchConfig,
        ILaunchManager.DEBUG_MODE, srcLocator);
    boolean multiSession = XDebugPreferenceMgr.useMultiSession();

    if (session.getSessionId() == null && !multiSession) {
      // non multisession web launch
      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())) {
          server = servers[i];
          break;
        }
      }
      if (server != null) {
        mapper = PathMapperRegistry.getByServer(server);
      }

      if (mapper == null) {
        // create a temporary path mapper, we may look to holding these
        // via the pathmapper registry in the future
        // but they would be persisted.
        mapper = new PathMapper();
      }
      // need to add ourselves as a session listener for future sessions
      DBGpSessionHandler.getInstance().addSessionListener(
          (IDBGpSessionListener) target);
    } else {
      // cli launch or multisession web launch: create a single shot
      // target
      target = new DBGpTarget(remoteLaunch, null /* no script name */,
          session.getIdeKey(), session.getSessionId(),
          stopAtFirstLine);
      // PathMapper p = PathMapperRegistry.getByPHPExe(null);
      // create a temporary path mapper
      mapper = new PathMapper();
    }

    // set up the target with the relevant connections
    target.setPathMapper(mapper);
    target.setSession(session);
View Full Code Here


    if (pathMapperComposite == null || pathMapperComposite.isDisposed()) {
      return;
    }
    Server server = getServer();
    if (server != null) {
      PathMapper pathMapper = PathMapperRegistry.getByServer(server);
      if (pathMapper != null) {
        pathMapperComposite.setData(pathMapper.getMapping());
      }
    }
  }
View Full Code Here

  }

  public boolean performOk() {
    Server server = getServer();
    if (server != null) {
      PathMapper pathMapper = PathMapperRegistry.getByServer(server);
      pathMapper.setMapping(pathMapperComposite.getMappings());
      PathMapperRegistry.storeToPreferences();
    }
    return true;
  }
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.debug.core.pathmapper.PathMapper

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.