]> git.argeo.org Git - gpl/argeo-slc.git/blobdiff - eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java
Improve shortcut
[gpl/argeo-slc.git] / eclipse / plugins / org.argeo.slc.ui.launch / src / main / java / org / argeo / slc / ui / launch / script / SlcScriptLaunchDelegate.java
index be9fdb43712484c0610de024facf206f934467a5..a6569b911a582176720ed236dee97115a22f8226 100644 (file)
@@ -3,7 +3,6 @@ package org.argeo.slc.ui.launch.script;
 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
@@ -31,7 +30,6 @@ import org.eclipse.jdt.launching.IVMRunner;
 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
@@ -43,8 +41,8 @@ public class SlcScriptLaunchDelegate extends
        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
@@ -62,7 +60,7 @@ public class SlcScriptLaunchDelegate extends
                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
@@ -73,16 +71,17 @@ public class SlcScriptLaunchDelegate extends
                } 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
@@ -102,10 +101,16 @@ public class SlcScriptLaunchDelegate extends
                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
@@ -221,7 +226,7 @@ public class SlcScriptLaunchDelegate extends
        }\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