From: Mathieu Baudier Date: Sun, 29 Jun 2008 10:25:39 +0000 (+0000) Subject: Adapt SLC plugin to new runtime X-Git-Tag: argeo-slc-2.1.7~2720 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=f6d736c058ddb7a59164295c138c2e9c38363b36;p=gpl%2Fargeo-slc.git Adapt SLC plugin to new runtime git-svn-id: https://svn.argeo.org/slc/trunk@1322 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/META-INF/MANIFEST.MF b/eclipse/plugins/org.argeo.slc.ui.launch/META-INF/MANIFEST.MF index 513685b55..54b67af0d 100644 --- a/eclipse/plugins/org.argeo.slc.ui.launch/META-INF/MANIFEST.MF +++ b/eclipse/plugins/org.argeo.slc.ui.launch/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: SLC UI Launch Bundle-SymbolicName: org.argeo.slc.ui.launch;singleton:=true -Bundle-Version: 0.9.1 +Bundle-Version: 0.9.3 Bundle-Activator: org.argeo.slc.ui.launch.SlcUiLaunchPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, @@ -10,5 +10,6 @@ Require-Bundle: org.eclipse.ui, org.eclipse.jdt.launching, org.eclipse.debug.ui, org.eclipse.jdt.core, - org.eclipse.ui.console + org.eclipse.ui.console, + org.eclipse.jdt.debug.ui Eclipse-LazyStart: true diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java deleted file mode 100644 index bca1113df..000000000 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcRuntime.java +++ /dev/null @@ -1,50 +0,0 @@ -package org.argeo.slc.ui.launch; - -import java.io.File; -import java.io.IOException; -import java.util.List; -import java.util.Vector; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.JavaRuntime; - -public class DeployedSlcRuntime implements SlcRuntime { - private File baseDir; - private String relLibDir = "lib"; - - public DeployedSlcRuntime(String baseDirPath) { - try { - this.baseDir = new File(baseDirPath).getCanonicalFile(); - } catch (IOException e) { - throw new RuntimeException("Cannot get path for " + baseDirPath, e); - } - } - - public String[] getClasspath() throws CoreException { - List classpath = new Vector(); - File libDir = new File(baseDir.getPath() + File.separator + relLibDir); - File[] files = libDir.listFiles(); - for (File file : files) { - try { - classpath.add(file.getCanonicalPath()); - } catch (IOException e) { - throw new RuntimeException("Cannot get path for " + file, e); - } - } - return classpath.toArray(new String[classpath.size()]); - } - - public IVMInstall getVmInstall() throws CoreException { - return JavaRuntime.getDefaultVMInstall(); - } - - public String getAntHome() { - return baseDir.getPath(); - } - - public String getJavaLibraryPath() { - return baseDir.getPath() + File.separator + "bin"; - } - -} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcSystem.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcSystem.java new file mode 100644 index 000000000..3ae050295 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/DeployedSlcSystem.java @@ -0,0 +1,50 @@ +package org.argeo.slc.ui.launch; + +import java.io.File; +import java.io.IOException; +import java.util.List; +import java.util.Vector; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; + +public class DeployedSlcSystem implements SlcSystem { + private File baseDir; + private String relLibDir = "lib"; + + public DeployedSlcSystem(String baseDirPath) { + try { + this.baseDir = new File(baseDirPath).getCanonicalFile(); + } catch (IOException e) { + throw new RuntimeException("Cannot get path for " + baseDirPath, e); + } + } + + public String[] getClasspath() throws CoreException { + List classpath = new Vector(); + File libDir = new File(baseDir.getPath() + File.separator + relLibDir); + File[] files = libDir.listFiles(); + for (File file : files) { + try { + classpath.add(file.getCanonicalPath()); + } catch (IOException e) { + throw new RuntimeException("Cannot get path for " + file, e); + } + } + return classpath.toArray(new String[classpath.size()]); + } + + public IVMInstall getVmInstall() throws CoreException { + return JavaRuntime.getDefaultVMInstall(); + } + + public String getAntHome() { + return baseDir.getPath(); + } + + public String getJavaLibraryPath() { + return baseDir.getPath() + File.separator + "bin"; + } + +} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcRuntime.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcRuntime.java deleted file mode 100644 index 7e07242fc..000000000 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcRuntime.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.argeo.slc.ui.launch; - -import org.argeo.slc.ui.launch.preferences.SlcPreferencePage; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.JavaRuntime; - -public class EmbeddedSlcRuntime implements SlcRuntime { - private final IJavaProject project; - - public EmbeddedSlcRuntime(IJavaProject project) { - this.project = project; - } - - public String[] getClasspath() throws CoreException { - return JavaRuntime.computeDefaultRuntimeClassPath(project); - } - - public String getJavaLibraryPath() { - String javaLibPath = SlcUiLaunchPlugin.getDefault() - .getPreferenceStore().getString( - SlcPreferencePage.PREF_SLC_RUNTIME_LOCATION); - if (javaLibPath == null || javaLibPath.equals("")) - return null; - else - return javaLibPath; - } - - public IVMInstall getVmInstall() throws CoreException { - return JavaRuntime.getVMInstall(project); - } - -} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcSystem.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcSystem.java new file mode 100644 index 000000000..1df0c0559 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/EmbeddedSlcSystem.java @@ -0,0 +1,34 @@ +package org.argeo.slc.ui.launch; + +import org.argeo.slc.ui.launch.preferences.SlcPreferencePage; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.core.IJavaProject; +import org.eclipse.jdt.launching.IVMInstall; +import org.eclipse.jdt.launching.JavaRuntime; + +public class EmbeddedSlcSystem implements SlcSystem { + private final IJavaProject project; + + public EmbeddedSlcSystem(IJavaProject project) { + this.project = project; + } + + public String[] getClasspath() throws CoreException { + return JavaRuntime.computeDefaultRuntimeClassPath(project); + } + + public String getJavaLibraryPath() { + String javaLibPath = SlcUiLaunchPlugin.getDefault() + .getPreferenceStore().getString( + SlcPreferencePage.PREF_SLC_RUNTIME_LOCATION); + if (javaLibPath == null || javaLibPath.equals("")) + return null; + else + return javaLibPath; + } + + public IVMInstall getVmInstall() throws CoreException { + return JavaRuntime.getVMInstall(project); + } + +} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcRuntime.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcRuntime.java deleted file mode 100644 index b1cbef67c..000000000 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcRuntime.java +++ /dev/null @@ -1,10 +0,0 @@ -package org.argeo.slc.ui.launch; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.launching.IVMInstall; - -public interface SlcRuntime { - public String[] getClasspath() throws CoreException; - public String getJavaLibraryPath(); - public IVMInstall getVmInstall() throws CoreException; -} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcSystem.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcSystem.java new file mode 100644 index 000000000..0a765ffd7 --- /dev/null +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/SlcSystem.java @@ -0,0 +1,10 @@ +package org.argeo.slc.ui.launch; + +import org.eclipse.core.runtime.CoreException; +import org.eclipse.jdt.launching.IVMInstall; + +public interface SlcSystem { + public String[] getClasspath() throws CoreException; + public String getJavaLibraryPath(); + public IVMInstall getVmInstall() throws CoreException; +} diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchConfigurationTab.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchConfigurationTab.java index ce1c2f140..08e4ca52f 100644 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchConfigurationTab.java +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchConfigurationTab.java @@ -1,27 +1,60 @@ package org.argeo.slc.ui.launch.script; +import java.io.IOException; +import java.io.StringReader; +import java.io.StringWriter; +import java.util.HashMap; +import java.util.Map; +import java.util.Properties; + import org.eclipse.core.resources.IFile; import org.eclipse.core.runtime.CoreException; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; +import org.eclipse.debug.internal.ui.SWTFactory; import org.eclipse.debug.ui.AbstractLaunchConfigurationTab; import org.eclipse.swt.SWT; +import org.eclipse.swt.events.ModifyEvent; +import org.eclipse.swt.events.ModifyListener; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.events.SelectionListener; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.layout.GridLayout; +import org.eclipse.swt.widgets.Button; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Text; public class SlcScriptLaunchConfigurationTab extends AbstractLaunchConfigurationTab { - private IFile script; - + private Text scriptL; + private Text propertiesTF; + private Text runtimeTF; + private Text targetsTF; + private Button pre093B; + public void createControl(Composite parent) { - Composite body = new Composite(parent,SWT.NONE); - new Label(parent, SWT.LEAD).setText("Script location"); - if (script != null) { - new Label(parent, SWT.LEAD).setText(script.getLocation().toFile() - .getAbsolutePath()); - } + Composite body = new Composite(parent, SWT.NONE); setControl(body); + body.setLayout(new GridLayout(1, false)); + body.setFont(parent.getFont()); + + createLabel(body, "Script location"); + scriptL = createSingleText(body); + scriptL.setEditable(false); + scriptL.setBackground(body.getBackground()); + + createLabel(body, "Runtime"); + runtimeTF = createSingleText(body); + + createLabel(body, "Targets"); + targetsTF = createSingleText(body); + + createLabel(body, "Properties"); + propertiesTF = createMultipleText(body, 10); + + pre093B = createCheckBox(body, "Pre SLC v0.9.3"); } public String getName() { @@ -30,7 +63,19 @@ public class SlcScriptLaunchConfigurationTab extends public void initializeFrom(ILaunchConfiguration configuration) { try { - script = (IFile) configuration.getMappedResources()[0]; + IFile script = (IFile) configuration.getMappedResources()[0]; + scriptL.setText(script.getLocation().toFile().getAbsolutePath()); + + boolean pre093 = configuration.getAttribute( + SlcScriptLaunchDelegate.ATTR_PRE093, false); + + propertiesTF.setText(configuration.getAttribute( + SlcScriptLaunchDelegate.ATTR_PROPERTIES, "")); + runtimeTF.setText(configuration.getAttribute( + SlcScriptLaunchDelegate.ATTR_RUNTIME, "")); + targetsTF.setText(configuration.getAttribute( + SlcScriptLaunchDelegate.ATTR_TARGETS, "")); + pre093B.setSelection(pre093); } catch (CoreException e) { throw new RuntimeException("Cannot initialize tab", e); } @@ -38,9 +83,77 @@ public class SlcScriptLaunchConfigurationTab extends } public void performApply(ILaunchConfigurationWorkingCopy configuration) { + configuration.setAttribute(SlcScriptLaunchDelegate.ATTR_PROPERTIES, + propertiesTF.getText()); + configuration.setAttribute(SlcScriptLaunchDelegate.ATTR_RUNTIME, + runtimeTF.getText()); + configuration.setAttribute(SlcScriptLaunchDelegate.ATTR_TARGETS, + targetsTF.getText()); + configuration.setAttribute(SlcScriptLaunchDelegate.ATTR_PRE093, pre093B + .getSelection()); } public void setDefaults(ILaunchConfigurationWorkingCopy configuration) { } + // UI Utils + protected Label createLabel(Composite parent, String text) { + Label t = new Label(parent, SWT.NONE | SWT.WRAP); + t.setText(text); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 1; + t.setLayoutData(gd); + return t; + } + + protected Text createSingleText(Composite parent) { + Text t = new Text(parent, SWT.SINGLE | SWT.BORDER); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL_HORIZONTAL); + gd.horizontalSpan = 1; + t.setLayoutData(gd); + t.addModifyListener(modifyListener); + return t; + } + + protected Text createMultipleText(Composite parent, int verticalSpan) { + Text t = new Text(parent, SWT.MULTI | SWT.BORDER); + t.setFont(parent.getFont()); + GridData gd = new GridData(GridData.FILL, GridData.FILL, true, true); + gd.horizontalSpan = 1; + gd.verticalSpan = verticalSpan; + t.setLayoutData(gd); + t.addModifyListener(modifyListener); + return t; + } + + protected Button createCheckBox(Composite parent, String label) { + Button b = new Button(parent, SWT.CHECK); + b.setFont(parent.getFont()); + b.setText(label); + b.addSelectionListener(selectionListener); + return b; + + } + + // LISTENERS + /** + * Modify listener that simply updates the owning launch configuration + * dialog. + */ + private ModifyListener modifyListener = new ModifyListener() { + public void modifyText(ModifyEvent evt) { + updateLaunchConfigurationDialog(); + } + }; + private SelectionListener selectionListener = new SelectionListener() { + public void widgetDefaultSelected(SelectionEvent e) { + } + + public void widgetSelected(SelectionEvent e) { + updateLaunchConfigurationDialog(); + } + }; + } diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java index 7acbb2920..be9fdb437 100644 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchDelegate.java @@ -1,11 +1,15 @@ package org.argeo.slc.ui.launch.script; +import java.io.IOException; +import java.io.StringReader; import java.util.List; +import java.util.Map; +import java.util.Properties; import java.util.Vector; -import org.argeo.slc.ui.launch.DeployedSlcRuntime; -import org.argeo.slc.ui.launch.EmbeddedSlcRuntime; -import org.argeo.slc.ui.launch.SlcRuntime; +import org.argeo.slc.ui.launch.DeployedSlcSystem; +import org.argeo.slc.ui.launch.EmbeddedSlcSystem; +import org.argeo.slc.ui.launch.SlcSystem; import org.argeo.slc.ui.launch.SlcUiLaunchPlugin; import org.argeo.slc.ui.launch.preferences.SlcPreferencePage; import org.eclipse.core.resources.IFile; @@ -27,16 +31,25 @@ import org.eclipse.jdt.launching.IVMRunner; import org.eclipse.jdt.launching.VMRunnerConfiguration; import org.eclipse.jface.dialogs.ErrorDialog; import org.eclipse.swt.widgets.Shell; +import org.omg.CORBA.VM_CUSTOM; public class SlcScriptLaunchDelegate extends AbstractJavaLaunchConfigurationDelegate { public static final String ID = "org.argeo.slc.launch.slcScriptLaunchType"; + public final static String ATTR_SCRIPT = "script"; + public final static String ATTR_PROPERTIES = "properties"; + public final static String ATTR_RUNTIME = "runtime"; + public final static String ATTR_TARGETS = "targets"; + public final static String ATTR_PRE093 = "pre093"; + private final static String ANT_MAIN = "org.apache.tools.ant.Main"; + private final static String SLC_MAIN = "org.argeo.slc.cli.SlcMain"; public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException { IResource[] resources = configuration.getMappedResources(); + if (resources.length != 1) { throw new RuntimeException("Can only launch one script."); } @@ -46,40 +59,149 @@ public class SlcScriptLaunchDelegate extends IFile file = (IFile) resources[0]; System.out.println("Launched " + file.getLocation().toFile()); + boolean pre093 = configuration.getAttribute(ATTR_PRE093, false); + // Retrieve SLC Runtime - SlcRuntime deployedSlc = null; + SlcSystem slcSystem = findSlcSystem(file); + if (slcSystem == null) + return; + + IVMRunner vmRunner = slcSystem.getVmInstall().getVMRunner(mode); + final VMRunnerConfiguration vmConfig; + if (pre093) { + vmConfig = createPre093Config(slcSystem, file, mode); + } else { + vmConfig = createConfig(slcSystem, file, mode, configuration); + } + vmRunner.run(vmConfig, launch, null); + } + + protected SlcSystem findSlcSystem(IFile file) throws CoreException { + SlcSystem slcSystem = null; IProject project = file.getProject(); if (project.getNature("org.eclipse.jdt.core.javanature") != null) { IJavaProject javaProject = JavaCore.create(project); if (checkProjectForEmbedded(javaProject)) { - deployedSlc = new EmbeddedSlcRuntime(javaProject); + slcSystem = new EmbeddedSlcSystem(javaProject); } } - if (deployedSlc == null) { + if (slcSystem == null) { String slcRuntimePath = SlcUiLaunchPlugin.getDefault() .getPreferenceStore().getString( SlcPreferencePage.PREF_SLC_RUNTIME_LOCATION); if (slcRuntimePath == null || slcRuntimePath.equals("")) { showError("SLC Runtime path is not set. Set it in Windows > Preferences > SLC"); - return; + return null; } - deployedSlc = new DeployedSlcRuntime(slcRuntimePath); + slcSystem = new DeployedSlcSystem(slcRuntimePath); } - IVMRunner vmRunner = deployedSlc.getVmInstall().getVMRunner(mode); - VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(ANT_MAIN, + return slcSystem; + } + + protected boolean checkProjectForEmbedded(IJavaProject project) { + try { + IType antmainType = project.findType(ANT_MAIN); + if (antmainType == null) + return false; + else + return true; + } catch (JavaModelException e) { + e.printStackTrace(); + return false; + } + } + + // Regular SLC + protected VMRunnerConfiguration createConfig(SlcSystem deployedSlc, + IFile file, String mode, ILaunchConfiguration configuration) + throws CoreException { + VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(SLC_MAIN, deployedSlc.getClasspath()); vmConfig.setVMArguments(getVmArguments(deployedSlc)); vmConfig.setWorkingDirectory(file.getLocation().toFile().getParent()); vmConfig.setProgramArguments(getProgramArguments(deployedSlc, file, - mode)); - vmRunner.run(vmConfig, launch, null); + mode, configuration)); + return vmConfig; } - private String[] getVmArguments(SlcRuntime deployedSlc) { + protected String[] getVmArguments(SlcSystem deployedSlc) { + List list = new Vector(); + if (deployedSlc.getJavaLibraryPath() != null) + list.add("-Djava.library.path=" + deployedSlc.getJavaLibraryPath()); + return list.toArray(new String[list.size()]); + } + + protected String[] getProgramArguments(SlcSystem deployedSlc, IFile file, + String mode, ILaunchConfiguration configuration) + throws CoreException { + List list = new Vector(); + + list.add("--mode"); + list.add("single"); + + // Script + list.add("--script"); + list.add(file.getLocation().toFile().getAbsolutePath()); + + // Runtime + String runtime = configuration.getAttribute(ATTR_RUNTIME, ""); + if (!runtime.equals("")) { + list.add("--runtime"); + list.add(runtime); + } + + // Targets + String targets = configuration.getAttribute(ATTR_RUNTIME, ""); + if (!runtime.equals("")) { + list.add("--targets"); + list.add(targets); + } + + // Properties + Properties properties = new Properties(); + StringReader reader = new StringReader(configuration.getAttribute( + ATTR_PROPERTIES, "")); + try { + properties.load(reader); + } catch (IOException e) { + throw new RuntimeException("Cannot read properties", e); + } finally { + if (reader != null) + reader.close(); + } + + for (Object key : properties.keySet()) { + list.add("-p"); + StringBuffer buf = new StringBuffer(""); + buf.append(key).append('=').append(properties.get(key)); + list.add(buf.toString()); + } + + // Debug mode + if (mode.equals(ILaunchManager.DEBUG_MODE)) { + list.add("--property"); + list.add("log4j.logger.org.argeo.slc=DEBUG"); + } + return list.toArray(new String[list.size()]); + } + + // Pre SLC v0.9.3 + protected VMRunnerConfiguration createPre093Config(SlcSystem deployedSlc, + IFile file, String mode) throws CoreException { + VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(ANT_MAIN, + deployedSlc.getClasspath()); + vmConfig.setVMArguments(getPre093VmArguments(deployedSlc)); + vmConfig.setWorkingDirectory(file.getLocation().toFile().getParent()); + vmConfig.setProgramArguments(getPre093ProgramArguments(deployedSlc, + file, mode)); + return vmConfig; + } + + protected String[] getPre093VmArguments(SlcSystem deployedSlc) { List list = new Vector(); // list.add("-Dant.home=" + deployedSlc.getAntHome()); if (deployedSlc.getJavaLibraryPath() != null) @@ -87,8 +209,8 @@ public class SlcScriptLaunchDelegate extends return list.toArray(new String[list.size()]); } - private String[] getProgramArguments(SlcRuntime deployedSlc, IFile file, - String mode) { + protected String[] getPre093ProgramArguments(SlcSystem deployedSlc, + IFile file, String mode) { List list = new Vector(); list.add("-f"); list.add(file.getLocation().toFile().getAbsolutePath()); @@ -98,6 +220,7 @@ public class SlcScriptLaunchDelegate extends return list.toArray(new String[list.size()]); } + // Utilities private void showError(String message) { Shell shell = SlcUiLaunchPlugin.getDefault().getWorkbench() .getActiveWorkbenchWindow().getShell(); @@ -108,16 +231,4 @@ public class SlcScriptLaunchDelegate extends status); } - protected boolean checkProjectForEmbedded(IJavaProject project) { - try { - IType antmainType = project.findType(ANT_MAIN); - if (antmainType == null) - return false; - else - return true; - } catch (JavaModelException e) { - e.printStackTrace(); - return false; - } - } } diff --git a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchShortcut.java b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchShortcut.java index b25d30346..ccc29b4f9 100644 --- a/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchShortcut.java +++ b/eclipse/plugins/org.argeo.slc.ui.launch/src/main/java/org/argeo/slc/ui/launch/script/SlcScriptLaunchShortcut.java @@ -33,7 +33,8 @@ public class SlcScriptLaunchShortcut implements ILaunchShortcut { IFile file = ((IFile) obj); IProject project = file.getProject(); IPath relativePath = file.getProjectRelativePath(); - String name = "["+project.getName() + "] - " + relativePath.toString(); + String name = "[" + project.getName() + "] - " + + relativePath.toString(); name = name.replace('/', '_');// otherwise not properly saved System.out.println(name);