Examples of IDBGpDebugTarget


Examples of org.eclipse.php.internal.debug.core.xdebug.dbgp.model.IDBGpDebugTarget

    // Generate a session id for this launch and start the listener
    // then create the start and stop debug URLs
    String[] startStopURLs;
    String baseURL = new String(configuration.getAttribute(Server.BASE_URL,
        "").getBytes()); //$NON-NLS-1$
    IDBGpDebugTarget target = null;
    SSHTunnel tunnel = null;

    if (mode.equals(ILaunchManager.DEBUG_MODE)) {
      String sessionId = DBGpSessionHandler.getInstance()
          .generateSessionId();
      String ideKey = null;
      if (DBGpProxyHandler.instance.useProxy()) {
        ideKey = DBGpProxyHandler.instance.getCurrentIdeKey();
        if (DBGpProxyHandler.instance.registerWithProxy() == false) {
          displayErrorMessage(PHPDebugCoreMessages.XDebug_WebLaunchConfigurationDelegate_2
              + DBGpProxyHandler.instance.getErrorMsg());
          DebugPlugin.getDefault().getLaunchManager()
              .removeLaunch(launch);
          return;
        }
      } else {
        ideKey = DBGpSessionHandler.getInstance().getIDEKey();
      }
      startStopURLs = generateStartStopDebugURLs(baseURL, sessionId,
          ideKey);
      String launchScript = configuration.getAttribute(Server.FILE_NAME,
          (String) null);

      // Check if a tunneled connection is needed and create request for a
      // tunnel if needed.
      tunnel = PHPLaunchUtilities.getSSHTunnel(configuration);

      // determine if we should use the multisession manager or the single
      // session manager
      if (XDebugPreferenceMgr.useMultiSession() == true) {
        target = new DBGpMultiSessionTarget(launch, launchScript,
            startStopURLs[1], ideKey, stopAtFirstLine, browser[0]);
        target.setPathMapper(PathMapperRegistry.getByServer(server));
        launch.addDebugTarget(target); // has to be added now, not
                        // later.
      } else {
        target = new DBGpTarget(launch, launchScript, startStopURLs[1],
            ideKey, stopAtFirstLine, browser[0]);
        target.setPathMapper(PathMapperRegistry.getByServer(server));
      }
      DBGpSessionHandler.getInstance().addSessionListener(
          (IDBGpSessionListener) target);
    } else {
      startStopURLs = new String[] { baseURL, null };
    }
    final String startURL = startStopURLs[0];
    final SSHTunnel sshTunnel = tunnel;

    // load the URL into the appropriate web browser
    IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 30);
    subMonitor.beginTask(
        PHPDebugCoreMessages.XDebug_WebLaunchConfigurationDelegate_3,
        10);

    Display.getDefault().syncExec(new Runnable() {
      public void run() {
        try {
          // establish a secured tunnel connection in case it's
          // defined in the configuration dialog
          if (sshTunnel != null) {
            sshTunnel.connect();
          }
          if (openExternal) {
            browser[0].openURL(new URL(startURL));
          } else {
            DBGpUtils.openInternalBrowserView(startURL);
          }
        } catch (Exception t) {
          Logger.logException(
              "Error initializing the web browser.", t); //$NON-NLS-1$
          exception[0] = t;
        }
      }
    });

    subMonitor.worked(10);

    // did the external browser start ok ?
    if (exception[0] == null) {
      if (mode.equals(ILaunchManager.DEBUG_MODE)) {
        launch.addDebugTarget(target);
        subMonitor
            .subTask(PHPDebugCoreMessages.XDebug_WebLaunchConfigurationDelegate_4);
        target.waitForInitialSession(
            (DBGpBreakpointFacade) IDELayerFactory.getIDELayer(),
            XDebugPreferenceMgr.createSessionPreferences(), monitor);
      } else {
        // launched ok, so remove the launch from the debug view as we
        // are not debugging.
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.