import java.io.IOException;\r
import java.io.StringReader;\r
import java.util.List;\r
-import java.util.Map;\r
import java.util.Properties;\r
import java.util.Vector;\r
\r
import org.eclipse.jdt.launching.VMRunnerConfiguration;\r
import org.eclipse.jface.dialogs.ErrorDialog;\r
import org.eclipse.swt.widgets.Shell;\r
-import org.omg.CORBA.VM_CUSTOM;\r
\r
public class SlcScriptLaunchDelegate extends\r
AbstractJavaLaunchConfigurationDelegate {\r
public final static String ATTR_TARGETS = "targets";\r
public final static String ATTR_PRE093 = "pre093";\r
\r
- private final static String ANT_MAIN = "org.apache.tools.ant.Main";\r
- private final static String SLC_MAIN = "org.argeo.slc.cli.SlcMain";\r
+ public final static String ANT_MAIN = "org.apache.tools.ant.Main";\r
+ public final static String SLC_MAIN = "org.argeo.slc.cli.SlcMain";\r
\r
public void launch(ILaunchConfiguration configuration, String mode,\r
ILaunch launch, IProgressMonitor monitor) throws CoreException {\r
boolean pre093 = configuration.getAttribute(ATTR_PRE093, false);\r
\r
// Retrieve SLC Runtime\r
- SlcSystem slcSystem = findSlcSystem(file);\r
+ SlcSystem slcSystem = findSlcSystem(file, pre093);\r
if (slcSystem == null)\r
return;\r
\r
} else {\r
vmConfig = createConfig(slcSystem, file, mode, configuration);\r
}\r
- vmRunner.run(vmConfig, launch, null);\r
+ vmRunner.run(vmConfig, launch, monitor);\r
}\r
\r
- protected SlcSystem findSlcSystem(IFile file) throws CoreException {\r
+ protected SlcSystem findSlcSystem(IFile file, boolean pre093)\r
+ throws CoreException {\r
SlcSystem slcSystem = null;\r
\r
IProject project = file.getProject();\r
if (project.getNature("org.eclipse.jdt.core.javanature") != null) {\r
IJavaProject javaProject = JavaCore.create(project);\r
- if (checkProjectForEmbedded(javaProject)) {\r
+ if (checkProjectForEmbedded(javaProject, pre093)) {\r
slcSystem = new EmbeddedSlcSystem(javaProject);\r
}\r
}\r
return slcSystem;\r
}\r
\r
- protected boolean checkProjectForEmbedded(IJavaProject project) {\r
+ protected boolean checkProjectForEmbedded(IJavaProject project,\r
+ boolean pre093) {\r
try {\r
- IType antmainType = project.findType(ANT_MAIN);\r
- if (antmainType == null)\r
+ IType mainType = null;\r
+ if (pre093)\r
+ mainType = project.findType(ANT_MAIN);\r
+ else\r
+ mainType = project.findType(SLC_MAIN);\r
+\r
+ if (mainType == null)\r
return false;\r
else\r
return true;\r
}\r
\r
// Utilities\r
- private void showError(String message) {\r
+ private static void showError(String message) {\r
Shell shell = SlcUiLaunchPlugin.getDefault().getWorkbench()\r
.getActiveWorkbenchWindow().getShell();\r
\r