Start the debugger through setting the url with "?DBGSESSID=1@clienthost:10001" in...
[phpeclipse.git] / net.sourceforge.phpeclipse.launching / src / net / sourceforge / phpdt / internal / launching / PHPLaunchConfigurationDelegate.java
1 /**********************************************************************
2 Copyright (c) 2000, 2002 IBM Corp. and others.
3 All rights reserved. This program and the accompanying materials
4 are made available under the terms of the Common Public License v1.0
5 which accompanies this distribution, and is available at
6 http://www.eclipse.org/legal/cpl-v10.html
7
8 Contributors:
9         IBM Corporation - Initial implementation
10         Vicente Fernando - www.alfersoft.com.ar
11 **********************************************************************/
12 package net.sourceforge.phpdt.internal.launching;
13
14 //import java.io.OutputStream;
15
16
17 import net.sourceforge.phpdt.internal.core.JavaProject;
18 import net.sourceforge.phpeclipse.ui.editor.BrowserUtil;
19
20 import org.eclipse.core.resources.IFile;
21 import org.eclipse.core.resources.IProject;
22 import org.eclipse.core.runtime.CoreException;
23 import org.eclipse.core.runtime.IProgressMonitor;
24 import org.eclipse.core.runtime.IStatus;
25 import org.eclipse.core.runtime.Status;
26 import org.eclipse.debug.core.DebugPlugin;
27 import org.eclipse.debug.core.ILaunch;
28 import org.eclipse.debug.core.ILaunchConfiguration;
29 import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
30 //import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
31
32
33 public class PHPLaunchConfigurationDelegate extends LaunchConfigurationDelegate {
34         protected static final InterpreterRunner interpreterRunner = new InterpreterRunner();
35         protected static final DebuggerRunner debuggerRunner = new DebuggerRunner();
36
37 /*      public PHPLaunchConfigurationDelegate() {
38                 super();
39         }
40 */
41         /**
42          * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)
43          */
44         public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
45                 if (PHPRuntime.getDefault().getSelectedInterpreter() == null)
46                         throw new CoreException(new Status(IStatus.ERROR, PHPLaunchingPlugin.PLUGIN_ID, IStatus.OK, "You must define an interpreter before running PHP.", null));
47                 
48                 InterpreterRunnerConfiguration conf=new InterpreterRunnerConfiguration(configuration);
49                 conf.setEnvironment(DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration));
50                 if (mode.equals("debug")) {
51                         debuggerRunner.run(conf, launch);
52                 } else {
53                         interpreterRunner.run(conf, launch);
54                 }               
55         }
56 }