// 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);