[Pydev-cvs] org.python.pydev.debug/src/org/python/pydev/debug/ui/launching PythonRunner.java,1.9,1.1
Brought to you by:
fabioz
|
From: Fabio Z. <fa...@us...> - 2004-10-13 19:49:47
|
Update of /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8185/src/org/python/pydev/debug/ui/launching Modified Files: PythonRunner.java PythonRunnerConfig.java Log Message: Index: PythonRunner.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunner.java,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** PythonRunner.java 8 Oct 2004 16:44:40 -0000 1.9 --- PythonRunner.java 13 Oct 2004 19:49:37 -0000 1.10 *************** *** 6,9 **** --- 6,10 ---- package org.python.pydev.debug.ui.launching; + import java.io.File; import java.io.IOException; import java.net.*; *************** *** 43,50 **** }else if (config.isProfile){ ! runProfile(config, launch, monitor); }else{ //default ! runDefault(config, launch, monitor); } } --- 44,53 ---- }else if (config.isProfile){ ! String[] envp = config.envp; ! envp = PyCoverage.setCoverageFileEnviromentVariable(envp); ! doIt(monitor, envp, config.getCommandLine(), config.workingDirectory, launch); }else{ //default ! doIt(monitor, config.envp, config.getCommandLine(), config.workingDirectory, launch); } } *************** *** 98,135 **** } ! ! /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! protected void runDefault(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { ! if (monitor == null) ! monitor = new NullProgressMonitor(); ! IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 5); ! subMonitor.beginTask("Launching python", 1); ! ! // Launch & connect to the debugger ! subMonitor.subTask("Constructing command_line..."); ! String[] cmdLine = config.getCommandLine(); ! ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, config.workingDirectory, config.envp); ! if (p == null) ! throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! ! // Register the process with the debug plugin ! subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! } ! ! /** ! * @param config ! * @param launch ! * @param monitor ! * @throws CoreException ! */ ! private void runProfile(PythonRunnerConfig config, ILaunch launch, IProgressMonitor monitor) throws CoreException { if (monitor == null) monitor = new NullProgressMonitor(); --- 101,105 ---- } ! public static void doIt(IProgressMonitor monitor, String [] envp, String[] cmdLine, File workingDirectory, ILaunch launch) throws CoreException{ if (monitor == null) monitor = new NullProgressMonitor(); *************** *** 140,149 **** subMonitor.subTask("Constructing command_line..."); ! subMonitor.subTask("Exec..."); ! String[] envp = config.envp; ! ! envp = PyCoverage.setCoverageFileEnviromentVariable(envp); ! Process p = DebugPlugin.exec(config.getCommandLine(), config.workingDirectory, envp); if (p == null) throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); --- 110,116 ---- subMonitor.subTask("Constructing command_line..."); ! subMonitor.subTask("Exec..."); ! Process p = DebugPlugin.exec(cmdLine, workingDirectory, envp); if (p == null) throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); *************** *** 151,175 **** // Register the process with the debug plugin subMonitor.subTask("Done"); ! registerWithDebugPlugin(config, launch, p); ! ! ! // try { ! // p.waitFor(); ! // } catch (InterruptedException e) { ! // e.printStackTrace(); ! // } ! // ! // Process p1 = DebugPlugin.exec(config.getProfileResultsCommandLine(), config.workingDirectory, config.envp); ! // if (p1 == null) ! // throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, "Could not execute python process. Was it cancelled?", null)); ! // registerWithDebugPlugin(config, launch, p1); } /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. */ ! private IProcess registerWithDebugPlugin(PythonRunnerConfig config, ILaunch launch, Process p) { HashMap processAttributes = new HashMap(); processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); --- 118,131 ---- // Register the process with the debug plugin subMonitor.subTask("Done"); ! registerWithDebugPlugin(PythonRunnerConfig.getCommandLineAsString(cmdLine), cmdLine[cmdLine.length-1], launch, p); } + /** * The debug plugin needs to be notified about our process. * It'll then display the appropriate UI. */ ! public static IProcess registerWithDebugPlugin(PythonRunnerConfig config, ILaunch launch, Process p) { HashMap processAttributes = new HashMap(); processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); *************** *** 177,179 **** --- 133,146 ---- return DebugPlugin.newProcess(launch,p, config.file.lastSegment(), processAttributes); } + + /** + * The debug plugin needs to be notified about our process. + * It'll then display the appropriate UI. + */ + public static IProcess registerWithDebugPlugin(String cmdLine, String label, ILaunch launch, Process p) { + HashMap processAttributes = new HashMap(); + processAttributes.put(IProcess.ATTR_PROCESS_TYPE, Constants.PROCESS_TYPE); + processAttributes.put(IProcess.ATTR_CMDLINE, cmdLine); + return DebugPlugin.newProcess(launch,p, label, processAttributes); + } } Index: PythonRunnerConfig.java =================================================================== RCS file: /cvsroot/pydev/org.python.pydev.debug/src/org/python/pydev/debug/ui/launching/PythonRunnerConfig.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** PythonRunnerConfig.java 8 Oct 2004 16:44:40 -0000 1.10 --- PythonRunnerConfig.java 13 Oct 2004 19:49:37 -0000 1.11 *************** *** 183,187 **** public String getCommandLineAsString() { String[] args = getCommandLine(); ! StringBuffer s = new StringBuffer(); for (int i=0; i< args.length; i++) { s.append(args[i]); --- 183,196 ---- public String getCommandLineAsString() { String[] args = getCommandLine(); ! return getCommandLineAsString(args); ! } ! ! ! /** ! * @param args ! * @return ! */ ! public static String getCommandLineAsString(String[] args) { ! StringBuffer s = new StringBuffer(); for (int i=0; i< args.length; i++) { s.append(args[i]); *************** *** 189,192 **** } return s.toString(); ! } } --- 198,201 ---- } return s.toString(); ! } } |