|
From: <caw...@us...> - 2007-01-19 21:07:12
|
Revision: 1822
http://svn.sourceforge.net/rubyeclipse/?rev=1822&view=rev
Author: cawilliams
Date: 2007-01-19 13:07:05 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
OK, so this will definitely break the build - but I want to get it checked in before I tackle fixing everything it breaks
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
trunk/org.rubypeople.rdt.launching/plugin.xml
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/runner/TestUnitRunner.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyArgumentsTab.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -20,7 +20,6 @@
import org.rubypeople.rdt.debug.ui.RdtDebugUiImages;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-import org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration;
import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.internal.ui.util.DirectorySelector;
@@ -85,14 +84,14 @@
if (useDefaultWorkingDirectoryButton.getSelection() != useDefault)
useDefaultWorkingDirectoryButton.setSelection(useDefault);
if (useDefault) {
- workingDirectorySelector.setSelectionText(RubyApplicationShortcut.getDefaultWorkingDirectory(this.rubyProject));
+ workingDirectorySelector.setSelectionText((String)null);
}
workingDirectorySelector.setEnabled(!useDefault);
}
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(RubyLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY, true);
- configuration.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, RubyApplicationShortcut.getDefaultWorkingDirectory(this.rubyProject));
+ configuration.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, (String)null);
// set hidden attribute
configuration.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.rubypeople.rdt.debug.ui.rubySourceLocator") ;
}
@@ -105,8 +104,6 @@
interpreterArgs = configuration.getAttribute(RubyLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
programArgs = configuration.getAttribute(RubyLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
useDefaultWorkDir = configuration.getAttribute(RubyLaunchConfigurationAttribute.USE_DEFAULT_WORKING_DIRECTORY, true);
- InterpreterRunnerConfiguration config = new InterpreterRunnerConfiguration(configuration) ;
- rubyProject = config.getProject().getProject() ;
} catch (CoreException e) {
log(e);
}
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 21:07:05 UTC (rev 1822)
@@ -40,7 +40,7 @@
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="%LaunchConfigurationTypeRubyApplication.name"
- delegate="org.rubypeople.rdt.internal.launching.RubyApplicationLaunchConfigurationDelegate"
+ delegate="org.rubypeople.rdt.launching.RubyLaunchDelegate"
modes="run,debug"
id="org.rubypeople.rdt.launching.LaunchConfigurationTypeRubyApplication">
</launchConfigurationType>
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,96 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import java.io.File;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IProcess;
-import org.rubypeople.rdt.core.RubyCore;
-import org.rubypeople.rdt.internal.debug.core.RdtDebugCorePlugin;
-import org.rubypeople.rdt.internal.debug.core.RubyDebuggerProxy;
-import org.rubypeople.rdt.internal.debug.core.model.RubyDebugTarget;
-import org.rubypeople.rdt.launching.IVMInstall;
-
-public class DebuggerRunner extends InterpreterRunner {
-
- private RubyDebugTarget debugTarget;
-
- public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) throws CoreException {
- debugTarget = new RubyDebugTarget(launch);
- IProcess process = super.run(configuration, launch);
- debugTarget.setProcess(process);
- RubyDebuggerProxy proxy = new RubyDebuggerProxy(debugTarget, isUseRubyDebug());
- if (proxy.checkConnection()) {
- try {
- if (isUseRubyDebug()) {
- String pathToRdebugExtension = getDirectoryOfRubyDebuggerFile() + "/rdebugExtension.rb";
- proxy.registerRdebugExtension(pathToRdebugExtension);
- }
- proxy.start();
- launch.addDebugTarget(debugTarget);
- } catch (Exception e) {
- LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
- debugTarget.terminate();
- }
- } else {
- LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, LaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
- debugTarget.terminate();
- }
- return process;
- }
-
- protected void addDebugCommandLineArgument(List<String> commandLine) {
- if (isUseRubyDebug()) {
- commandLine.add("--server");
- commandLine.add("--port");
- commandLine.add(Integer.toString(debugTarget.getPort()));
- commandLine.add("--cport");
- commandLine.add(Integer.toString(debugTarget.getPort() + 1));
- commandLine.add("-w");
- if (isDebuggerVerbose()) {
- commandLine.add("-d");
- }
- commandLine.add("-f");
- commandLine.add("xml");
- } else {
- if (!debugTarget.isUsingDefaultPort()) {
- commandLine.add("-r" + debugTarget.getDebugParameterFile().getAbsolutePath());
- }
-
- if (RdtDebugCorePlugin.isRubyDebuggerVerbose() || isDebuggerVerbose()) {
- commandLine.add("-reclipseDebugVerbose");
- } else {
- commandLine.add("-reclipseDebug");
- }
- commandLine.add("-I");
- commandLine.add(LaunchingPlugin.osDependentPath(DebuggerRunner.getDirectoryOfRubyDebuggerFile().replace('/', File.separatorChar)));
- }
- }
-
- public static String getDirectoryOfRubyDebuggerFile() {
- return RubyCore.getOSDirectory(LaunchingPlugin.getDefault()) + "ruby";
- }
-
- public boolean isUseRubyDebug() {
- return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.USE_RUBY_DEBUG);
- }
-
- public boolean isDebuggerVerbose() {
- return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.VERBOSE_DEBUGGER);
- }
-
- protected IVMInstall convertInterpreter(IVMInstall rubyInterpreter) {
- if (isUseRubyDebug()) {
- IPath rdebugLocation = new Path(rubyInterpreter.getInstallLocation().getAbsolutePath()).removeLastSegments(1);
- rdebugLocation = rdebugLocation.append("rdebug");
- return new RubyInterpreter("rdebug", rdebugLocation.toFile());
- } else {
- return rubyInterpreter;
- }
- }
-}
\ No newline at end of file
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,73 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.IProcess;
-import org.rubypeople.rdt.launching.IVMInstall;
-
-public class InterpreterRunner {
-
- public InterpreterRunner() {}
-
- public IProcess run(InterpreterRunnerConfiguration configuration, ILaunch launch) throws CoreException {
- List commandLine = renderCommandLine(configuration);
- File workingDirectory = configuration.getAbsoluteWorkingDirectory();
-
- IVMInstall interpreter = convertInterpreter(configuration.getInterpreter());
- Process nativeRubyProcess = interpreter.exec(commandLine, workingDirectory);
- Map defaultAttributes = new HashMap();
- defaultAttributes.put(IProcess.ATTR_PROCESS_TYPE, "ruby");
- IProcess process = DebugPlugin.newProcess(launch, nativeRubyProcess, renderLabel(configuration), defaultAttributes);
- process.setAttribute(LaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine.toString());
- return process ;
- }
-
- protected IVMInstall convertInterpreter(IVMInstall rubyInterpreter) {
- return rubyInterpreter;
- }
-
- protected String renderLabel(InterpreterRunnerConfiguration configuration) {
- StringBuffer buffer = new StringBuffer();
-
- try {
- IVMInstall interpreter = configuration.getInterpreter();
- buffer.append("Ruby ");
- buffer.append(interpreter.getCommand());
- buffer.append(" : ");
- buffer.append(configuration.getFileName());
- } catch (IllegalCommandException e) {
- // can't happen because renderLabel assumes that a successful launch has been done
- } catch(CoreException ce) {
-
- }
-
- return buffer.toString();
- }
-
- private List renderCommandLine(InterpreterRunnerConfiguration configuration) {
- List<String> commandLine = new ArrayList<String>();
-
- addDebugCommandLineArgument(commandLine);
- commandLine.addAll(configuration.renderLoadPath());
- commandLine.addAll(ArgumentSplitter.split(configuration.getInterpreterArguments()));
- commandLine.add(RubyInterpreter.END_OF_OPTIONS_DELIMITER);
- commandLine.add(LaunchingPlugin.osDependentPath(configuration.getAbsoluteFileName()));
- commandLine.addAll(ArgumentSplitter.split(configuration.getProgramArguments()));
-
- return commandLine;
- }
-
-
-
-
- protected void addDebugCommandLineArgument(List<String> commandLine) {
- }
-
-}
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,135 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.rubypeople.rdt.core.ILoadpathEntry;
-import org.rubypeople.rdt.core.RubyModelException;
-import org.rubypeople.rdt.internal.core.RubyProject;
-import org.rubypeople.rdt.launching.IVMInstall;
-import org.rubypeople.rdt.launching.RubyRuntime;
-
-public class InterpreterRunnerConfiguration {
- protected ILaunchConfiguration configuration;
-
- public InterpreterRunnerConfiguration(ILaunchConfiguration aConfiguration) {
- configuration = aConfiguration;
- }
-
- public String getAbsoluteFileName() {
- IProject project = getProject().getProject();
-
- return project.getLocation().toOSString() + "/" + getFileName();
- }
-
-
- public String getAbsoluteFileDirectory() {
-
- IPath path = new Path(this.getFileName()) ;
- path = path.removeLastSegments(1) ;
- IProject project = getProject().getProject();
- return project.getLocation().toOSString() + File.separator + path.toOSString();
- }
-
- public String getFileName() {
- String fileName = "";
-
- try {
- fileName = configuration.getAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, "No file specified in configuration");
- } catch(CoreException e) {}
-
- return fileName.replace('\\', '/');
- }
-
- public RubyProject getProject() {
- String projectName = "" ;
-
- try {
- projectName = configuration.getAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, "");
- } catch(CoreException e) {
- LaunchingPlugin.log(e);
- }
-
- RubyProject rubyProject = new RubyProject();
- if (projectName.length() > 0 ) {
- IProject project = LaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
- rubyProject.setProject(project);
- }
-
- return rubyProject;
- }
-
- public File getAbsoluteWorkingDirectory() {
- String file = null;
- try {
- file = configuration.getAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
- } catch(CoreException e) {
- LaunchingPlugin.log(e);
- }
- // it is valid not to specify a working directroy by returning null
- // whereas new File("") would specify an invalid directory
- return file == "" ? null : new File(file);
- }
-
- public String getInterpreterArguments() {
- try {
- return configuration.getAttribute(RubyLaunchConfigurationAttribute.INTERPRETER_ARGUMENTS, "");
- } catch(CoreException e) {}
-
- return "";
- }
-
- public String getProgramArguments() {
- try {
- return configuration.getAttribute(RubyLaunchConfigurationAttribute.PROGRAM_ARGUMENTS, "");
- } catch (CoreException e) {}
-
- return "";
- }
-
- public IVMInstall getInterpreter() {
- String selectedInterpreter = null;
- try {
- selectedInterpreter = configuration.getAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
- } catch(CoreException e) {}
-
- return RubyRuntime.getVMFromCompositeId(selectedInterpreter);
- }
-
- protected void addToLoadPath(List<String> loadPath, IProject project) {
- if (!project.isAccessible()) {
- return ;
- }
- addToLoadPath(loadPath, project.getLocation().toOSString());
- }
-
- private void addToLoadPath(List<String> loadPath, String pathDirectory) {
- loadPath.add("-I");
- loadPath.add(LaunchingPlugin.osDependentPath(pathDirectory));
- }
-
- protected List<String> renderLoadPath() {
- List<String> loadPath = new ArrayList<String>();
- RubyProject project = this.getProject();
-// addToLoadPath(loadPath, project.getProject());
-
- try {
- ILoadpathEntry[] entries = project.getResolvedLoadpath(true, false);
- for (int i = 0; i < entries.length; i++) {
- addToLoadPath(loadPath, entries[i].getPath().makeAbsolute().toFile().getAbsolutePath());
- }
- } catch (RubyModelException e) {
- e.printStackTrace();
- }
- if (new Path(this.getFileName()).segmentCount() > 1) { ;
- addToLoadPath(loadPath, this.getAbsoluteFileDirectory());
- }
- return loadPath;
- }
-}
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,38 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.rubypeople.rdt.launching.RubyRuntime;
-
-public class RubyApplicationLaunchConfigurationDelegate implements ILaunchConfigurationDelegate {
- protected static final InterpreterRunner interpreterRunner = new InterpreterRunner();
- protected static final DebuggerRunner debuggerRunner = new DebuggerRunner();
-
- public RubyApplicationLaunchConfigurationDelegate() {
- super();
- }
-
- /**
- * @see ILaunchConfigurationDelegate#launch(ILaunchConfiguration, String, ILaunch, IProgressMonitor)
- */
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- if (RubyRuntime.getDefaultVMInstall() == null) {
- throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, LaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
- }
-
- if (mode.equals("debug")) {
- debuggerRunner.run( this.wrapConfigurationAndHandleLaunch(configuration, launch), launch);
- } else {
- interpreterRunner.run( this.wrapConfigurationAndHandleLaunch(configuration, launch), launch);
- }
- }
-
- protected InterpreterRunnerConfiguration wrapConfigurationAndHandleLaunch(ILaunchConfiguration configuration, ILaunch launch) {
- return new InterpreterRunnerConfiguration(configuration) ;
- }
-}
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,132 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.rubypeople.rdt.launching.IVMInstall;
-import org.rubypeople.rdt.launching.IVMInstallType;
-import org.rubypeople.rdt.launching.IVMRunner;
-
-public class RubyInterpreter implements IVMInstall {
- public static final String END_OF_OPTIONS_DELIMITER = "--";
-
- protected File installLocation;
- protected String name;
-
- private final CommandExecutor commandExecutor;
-
- public RubyInterpreter(String aName, File validInstallLocation) {
- this(aName, validInstallLocation, new StandardCommandExecutor());
- }
-
- public RubyInterpreter(String aName, File validInstallLocation, CommandExecutor commandExecutor) {
- name = aName;
- installLocation = validInstallLocation;
- this.commandExecutor = commandExecutor;
- }
-
- /* (non-Javadoc)
- * @see org.rubypeople.rdt.internal.launching.IInterpreter#getInstallLocation()
- */
- public File getInstallLocation() {
- return installLocation;
- }
-
- /* (non-Javadoc)
- * @see org.rubypeople.rdt.internal.launching.IInterpreter#getName()
- */
- public String getName() {
- return name;
- }
-
- /* (non-Javadoc)
- * @see org.rubypeople.rdt.internal.launching.IInterpreter#setName(java.lang.String)
- */
- public void setName(String newName) {
- name = newName;
- }
-
- public String getCommand() throws IllegalCommandException {
- if( installLocation.isFile() ){
- return installLocation.getAbsolutePath();
- }
- String errorMessage = MessageFormat.format(LaunchingMessages.RdtLaunchingPlugin_interpreterNotFound, new Object[] {this.getName()}) ;
- throw new IllegalCommandException(errorMessage) ;
- }
-
- public Process exec(List args, File workingDirectory) throws CoreException {
- try {
- LaunchingPlugin.debug("Launching: " + args) ;
- LaunchingPlugin.debug("Working Dir: " + workingDirectory) ;
- List rubyCmd = new ArrayList();
- rubyCmd.add(this.getCommand());
- rubyCmd.addAll(args);
- return commandExecutor.exec((String[]) rubyCmd.toArray(new String[] {}), workingDirectory);
- } catch (IOException e) {
- IStatus errorStatus = new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK,
- "Unable to execute interpreter: " + args + workingDirectory, e);
- throw new CoreException(errorStatus) ;
- }
- catch (IllegalCommandException e) {
- IStatus errorStatus = new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
- throw new CoreException(errorStatus) ;
- }
-
- }
-
- public boolean equals(Object other) {
- if (other instanceof RubyInterpreter) {
- IVMInstall otherInterpreter = (IVMInstall) other;
- if (name.equals(otherInterpreter.getName()))
- return installLocation.equals(otherInterpreter.getInstallLocation());
- }
-
- return false;
- }
-
- public String getId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public String[] getVMArguments() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IVMInstallType getVMInstallType() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IVMRunner getVMRunner(String mode) {
- // TODO Auto-generated method stub
- return null;
- }
-
- public IPath[] getLibraryLocations() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setInstallLocation(File validInstallLocation) {
- this.installLocation = validInstallLocation;
- }
-
- public void setVMArguments(String[] vmArgs) {
- // TODO Auto-generated method stub
-
- }
-
- public void setLibraryLocations(IPath[] paths) {
- // TODO Auto-generated method stub
-
- }
-}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,82 +1,28 @@
package org.rubypeople.rdt.internal.launching;
import java.io.File;
-import java.io.IOException;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.ILaunchManager;
import org.rubypeople.rdt.launching.AbstractVMInstall;
-import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstallType;
+import org.rubypeople.rdt.launching.IVMRunner;
public class StandardVM extends AbstractVMInstall {
- private CommandExecutor fCommandExecutor;
-
public StandardVM(IVMInstallType type, String id) {
super(type, id);
- fCommandExecutor = new StandardCommandExecutor();
}
-
- public Process exec(List args, File workingDirectory)
- throws CoreException {
- try {
- LaunchingPlugin.debug("Launching: " + args) ;
- LaunchingPlugin.debug("Working Dir: " + workingDirectory) ;
- List rubyCmd = new ArrayList();
- rubyCmd.add(getCommand());
- rubyCmd.addAll(args);
- return fCommandExecutor.exec((String[]) rubyCmd.toArray(new String[] {}), workingDirectory);
- } catch (IOException e) {
- IStatus errorStatus = new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK,
- "Unable to execute interpreter: " + args + workingDirectory, e);
- throw new CoreException(errorStatus) ;
+
+ @Override
+ public IVMRunner getVMRunner(String mode) {
+ if (ILaunchManager.RUN_MODE.equals(mode)) {
+ return new StandardVMRunner(this);
+ } else if (ILaunchManager.DEBUG_MODE.equals(mode)) {
+ return new StandardVMDebugger(this);
}
+ return null;
}
- // FIXME This stuff should be in the VMRunner like in JDT!
- public String getCommand() throws CoreException {
-// Look for the user-specified ruby executable command
- String command= null;
-// Map map= config.getVMSpecificAttributesMap();
-// if (map != null) {
-// command = (String)map.get(IRubyLaunchConfigurationConstants.ATTR_RUBY_COMMAND);
-// }
-
- // If no ruby command was specified, use default executable
- if (command == null) {
- File exe = StandardVMType.findRubyExecutable(getInstallLocation());
- if (exe == null) {
- abort(MessageFormat.format(LaunchingMessages.StandardVMRunner_Unable_to_locate_executable_for__0__1, new String[]{getName()}), null, IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- }
- return exe.getAbsolutePath();
- }
-
- // Build the path to the ruby executable. First try 'bin'
- String installLocation = getInstallLocation().getAbsolutePath() + File.separatorChar;
- File exe = new File(installLocation + "bin" + File.separatorChar + command); //$NON-NLS-1$
- if (fileExists(exe)){
- return exe.getAbsolutePath();
- }
- exe = new File(exe.getAbsolutePath() + ".exe"); //$NON-NLS-1$
- if (fileExists(exe)){
- return exe.getAbsolutePath();
- }
-
- // not found
- abort(MessageFormat.format(LaunchingMessages.StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4, new String[]{command, getName()}), null, IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
- // NOTE: an exception will be thrown - null cannot be returned
- return null;
- }
-
- protected boolean fileExists(File file) {
- return file.exists() && file.isFile();
- }
-
public String getRubyVersion() {
StandardVMType installType = (StandardVMType) getVMInstallType();
File installLocation = getInstallLocation();
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMDebugger.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -0,0 +1,13 @@
+package org.rubypeople.rdt.internal.launching;
+
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMRunner;
+
+public class StandardVMDebugger extends StandardVMRunner implements IVMRunner {
+
+ public StandardVMDebugger(IVMInstall vmInstance) {
+ super(vmInstance);
+ // TODO Auto-generated constructor stub
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,11 +1,8 @@
package org.rubypeople.rdt.launching;
import java.io.File;
-import java.util.List;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
-import org.rubypeople.rdt.internal.launching.IllegalCommandException;
public interface IVMInstall {
@@ -17,24 +14,6 @@
public void setName(String newName);
- /**
- *
- * @return
- * @throws CoreException
- * @deprecated
- */
- public String getCommand() throws CoreException, IllegalCommandException;
-
- /**
- *
- * @param commandLine
- * @param workingDirectory
- * @return
- * @throws CoreException
- * @deprecated This doesn't match JDT behavior. We'll need to work on a better solution.
- */
- public Process exec(List commandLine, File workingDirectory) throws CoreException;
-
public IPath[] getLibraryLocations();
public String getId();
Deleted: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/runner/TestUnitRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/runner/TestUnitRunner.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/internal/testunit/runner/TestUnitRunner.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -1,39 +0,0 @@
-/*
- * Author: C.Williams
- *
- * Copyright (c) 2004 RubyPeople.
- *
- * This file is part of the Ruby Development Tools (RDT) plugin for eclipse. You
- * can get copy of the GPL along with further information about RubyPeople and
- * third party software bundled with RDT in the file
- * org.rubypeople.rdt.core_x.x.x/RDT.license or otherwise at
- * http://www.rubypeople.org/RDT.license.
- *
- * RDT is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * RDT is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * RDT; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
- * Suite 330, Boston, MA 02111-1307 USA
- */
-package org.rubypeople.rdt.internal.testunit.runner;
-
-import org.rubypeople.rdt.internal.launching.InterpreterRunner;
-
-/**
- * @author Chris
- *
- */
-public class TestUnitRunner extends InterpreterRunner {
-
- public TestUnitRunner() {
- super();
- }
-
-}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java
===================================================================
--- trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java 2007-01-19 20:35:22 UTC (rev 1821)
+++ trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitMainTab.java 2007-01-19 21:07:05 UTC (rev 1822)
@@ -25,7 +25,6 @@
package org.rubypeople.rdt.testunit.launcher;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -46,13 +45,13 @@
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
import org.rubypeople.rdt.core.IRubyElement;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
-import org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration;
import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.internal.testunit.ui.TestUnitMessages;
import org.rubypeople.rdt.internal.testunit.ui.TestunitPlugin;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.util.RubyFileSelector;
import org.rubypeople.rdt.internal.ui.util.RubyProjectSelector;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
/**
* @author Chris
@@ -228,15 +227,10 @@
*/
public void initializeFrom(ILaunchConfiguration configuration) {
try {
- // Have to set the project selection first! Otherwise when launch
- // container ise set it will use null for project when trying to
- // validate the file exists and will eventually set the launch
- // container to ""
- InterpreterRunnerConfiguration config = new InterpreterRunnerConfiguration(configuration);
- String projectName = "";
- IProject project = config.getProject().getProject();
- if (project != null) {
- projectName = project.getName();
+ String projectName= ""; //$NON-NLS-1$
+ try {
+ projectName = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME, ""); //$NON-NLS-1$
+ } catch (CoreException ce) {
}
projectSelector.setSelectionText(projectName);
fileSelector.setSelectionText(configuration.getAttribute(TestUnitLaunchConfigurationDelegate.LAUNCH_CONTAINER_ATTR, ""));
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|