1 11 package org.eclipse.jdt.launching; 12 13 import java.io.File ; 14 import com.ibm.icu.text.MessageFormat; 15 import java.util.Map ; 16 17 import org.eclipse.core.runtime.CoreException; 18 import org.eclipse.core.runtime.IProgressMonitor; 19 import org.eclipse.core.runtime.NullProgressMonitor; 20 import org.eclipse.debug.core.ILaunch; 21 import org.eclipse.debug.core.ILaunchConfiguration; 22 import org.eclipse.jdt.internal.launching.LaunchingMessages; 23 24 31 public class JavaLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate { 32 33 36 public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { 37 38 if (monitor == null) { 39 monitor = new NullProgressMonitor(); 40 } 41 42 monitor.beginTask(MessageFormat.format("{0}...", new String []{configuration.getName()}), 3); if (monitor.isCanceled()) { 45 return; 46 } 47 48 monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1); 49 50 String mainTypeName = verifyMainTypeName(configuration); 51 IVMRunner runner = getVMRunner(configuration, mode); 52 53 File workingDir = verifyWorkingDirectory(configuration); 54 String workingDirName = null; 55 if (workingDir != null) { 56 workingDirName = workingDir.getAbsolutePath(); 57 } 58 59 String [] envp= getEnvironment(configuration); 61 62 String pgmArgs = getProgramArguments(configuration); 64 String vmArgs = getVMArguments(configuration); 65 ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs); 66 67 Map vmAttributesMap = getVMSpecificAttributesMap(configuration); 69 70 String [] classpath = getClasspath(configuration); 72 73 VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath); 75 runConfig.setProgramArguments(execArgs.getProgramArgumentsArray()); 76 runConfig.setEnvironment(envp); 77 runConfig.setVMArguments(execArgs.getVMArgumentsArray()); 78 runConfig.setWorkingDirectory(workingDirName); 79 runConfig.setVMSpecificAttributesMap(vmAttributesMap); 80 81 runConfig.setBootClassPath(getBootpath(configuration)); 83 84 if (monitor.isCanceled()) { 86 return; 87 } 88 89 prepareStopInMain(configuration); 91 92 monitor.worked(1); 94 95 monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Creating_source_locator____2); 96 setDefaultSourceLocator(launch, configuration); 98 monitor.worked(1); 99 100 runner.run(runConfig, launch, monitor); 102 103 if (monitor.isCanceled()) { 105 return; 106 } 107 108 monitor.done(); 109 } 110 111 } 112 | Popular Tags |