You can subscribe to this list here.
| 2005 |
Jan
|
Feb
|
Mar
(41) |
Apr
(9) |
May
|
Jun
|
Jul
(39) |
Aug
(38) |
Sep
(135) |
Oct
(220) |
Nov
(75) |
Dec
(74) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2006 |
Jan
(44) |
Feb
(160) |
Mar
(49) |
Apr
(69) |
May
(40) |
Jun
(52) |
Jul
(47) |
Aug
(51) |
Sep
(19) |
Oct
(22) |
Nov
(36) |
Dec
(76) |
| 2007 |
Jan
(154) |
Feb
(165) |
Mar
(186) |
Apr
(143) |
May
(175) |
Jun
(133) |
Jul
(203) |
Aug
(177) |
Sep
(136) |
Oct
|
Nov
|
Dec
|
|
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.
|
|
From: <caw...@us...> - 2007-01-19 20:35:24
|
Revision: 1821
http://svn.sourceforge.net/rubyeclipse/?rev=1821&view=rev
Author: cawilliams
Date: 2007-01-19 12:35:22 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-19 20:27:55 UTC (rev 1820)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-19 20:35:22 UTC (rev 1821)
@@ -118,23 +118,22 @@
}
/**
- * Construct and return a String containing the full path of a java executable
- * command such as 'java' or 'javaw.exe'. If the configuration specifies an
+ * Construct and return a String containing the full path of a ruby executable
+ * command such as 'ruby' or 'rubyw.exe'. If the configuration specifies an
* explicit executable, that is used.
*
- * @return full path to java executable
+ * @return full path to ruby executable
* @exception CoreException if unable to locate an executeable
*/
protected String constructProgramString(VMRunnerConfiguration config) throws CoreException {
-
- // Look for the user-specified java executable command
+ // 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 java command was specified, use default executable
+ // If no ruby command was specified, use default executable
if (command == null) {
File exe = StandardVMType.findRubyExecutable(fVMInstance.getInstallLocation());
if (exe == null) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 20:28:00
|
Revision: 1820
http://svn.sourceforge.net/rubyeclipse/?rev=1820&view=rev
Author: cawilliams
Date: 2007-01-19 12:27:55 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
don't need it anymore!
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-19 20:27:08 UTC (rev 1819)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-19 20:27:55 UTC (rev 1820)
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.rubypeople.rdt.launching;
-
-
-import java.io.File;
-
-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.internal.launching.LaunchingMessages;
-import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
-/**
- * Abstract implementation of a Interpreter install.
- * <p>
- * Clients implementing Interpreter installs must subclass this class.
- * </p>
- */
-public abstract class AbstractInterpreter implements IVMInstall, IVMInstall2 {
-
- private IVMInstallType fType;
- private String fId;
- private String fName;
- private File fInstallLocation;
- private IPath[] fSystemLibraryDescriptions;
- private String fInterpreterArgs;
- // system properties are cached in user preferences prefixed with this key, followed
- // by vm type, vm id, and system property name
- private static final String PREF_Interpreter_INSTALL_SYSTEM_PROPERTY = "PREF_Interpreter_INSTALL_SYSTEM_PROPERTY"; //$NON-NLS-1$
- // whether change events should be fired
- private boolean fNotify = true;
-
- /**
- * Constructs a new Interpreter install.
- *
- * @param type The type of this Interpreter install.
- * Must not be <code>null</code>
- * @param id The unique identifier of this Interpreter instance
- * Must not be <code>null</code>.
- * @throws IllegalArgumentException if any of the required
- * parameters are <code>null</code>.
- */
- public AbstractInterpreter(IVMInstallType type, String id) {
- if (type == null)
- throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_typeNotNull);
- if (id == null)
- throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_idNotNull);
- fType= type;
- fId= id;
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#getId()
- */
- public String getId() {
- return fId;
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#getName()
- */
- public String getName() {
- return fName;
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#setName(String)
- */
- public void setName(String name) {
- if (!name.equals(fName)) {
- PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_NAME, fName, name);
- fName= name;
- if (fNotify) {
- RubyRuntime.fireVMChanged(event);
- }
- }
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#getInstallLocation()
- */
- public File getInstallLocation() {
- return fInstallLocation;
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#setInstallLocation(File)
- */
- public void setInstallLocation(File installLocation) {
- if (!installLocation.equals(fInstallLocation)) {
- PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_INSTALL_LOCATION, fInstallLocation, installLocation);
- fInstallLocation= installLocation;
- if (fNotify) {
- RubyRuntime.fireVMChanged(event);
- }
- }
- }
-
- /* (non-Rubydoc)
- * Subclasses should not override this method.
- * @see IInterpreterInstall#getInterpreterInstallType()
- */
- public IVMInstallType getVMInstallType() {
- return fType;
- }
-
- /* (non-Rubydoc)
- * @see IInterpreter#getInterpreterRunner(String)
- */
- public IVMRunner getVMRunner(String mode) {
- return null;
- }
-
- /* (non-Rubydoc)
- * @see org.rubypeople.rdt.launching.IInterpreter#getLibraryLocations()
- */
- public IPath[] getLibraryLocations() {
- return fSystemLibraryDescriptions;
- }
-
- /* (non-Rubydoc)
- * @see org.eclipse.jdt.launching.IInterpreterInstall#setLibraryLocations(org.eclipse.jdt.launching.LibraryLocation[])
- */
- public void setLibraryLocations(IPath[] locations) {
- if (locations == fSystemLibraryDescriptions) {
- return;
- }
- IPath[] newLocations = locations;
- if (newLocations == null) {
- newLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation());
- }
- IPath[] prevLocations = fSystemLibraryDescriptions;
- if (prevLocations == null) {
- prevLocations = getVMInstallType().getDefaultLibraryLocations(getInstallLocation());
- }
-
- if (newLocations.length == prevLocations.length) {
- int i = 0;
- boolean equal = true;
- while (i < newLocations.length && equal) {
- equal = newLocations[i].equals(prevLocations[i]);
- i++;
- }
- if (equal) {
- // no change
- return;
- }
- }
-
- PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS, prevLocations, newLocations);
- fSystemLibraryDescriptions = locations;
- if (fNotify) {
- RubyRuntime.fireVMChanged(event);
- }
- }
-
- /**
- * Whether this Interpreter should fire property change notifications.
- *
- * @param notify
- * @since 2.1
- */
- protected void setNotify(boolean notify) {
- fNotify = notify;
- }
-
- /* (non-Rubydoc)
- * @see java.lang.Object#equals(java.lang.Object)
- * @since 2.1
- */
- public boolean equals(Object object) {
- if (object instanceof IVMInstall) {
- IVMInstall vm = (IVMInstall)object;
- return getVMInstallType().equals(vm.getVMInstallType()) &&
- getId().equals(vm.getId());
- }
- return false;
- }
-
- /* (non-Rubydoc)
- * @see java.lang.Object#hashCode()
- * @since 2.1
- */
- public int hashCode() {
- return getVMInstallType().hashCode() + getId().hashCode();
- }
-
- /* (non-Rubydoc)
- * @see org.rubypeople.rdt.launching.IInterpreter#getDefaultInterpreterArguments()
- * @since 3.0
- */
- public String[] getVMArguments() {
- String args = getInterpreterArgs();
- if (args == null) {
- return null;
- }
- ExecutionArguments ex = new ExecutionArguments(args, ""); //$NON-NLS-1$
- return ex.getVMArgumentsArray();
- }
-
- /* (non-Rubydoc)
- * @see org.rubypeople.rdt.launching.IInterpreter#setDefaultInterpreterArguments(java.lang.String[])
- * @since 3.0
- */
- public void setVMArguments(String[] vmArgs) {
- if (vmArgs == null) {
- setVMArgs(null);
- } else {
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < vmArgs.length; i++) {
- String string = vmArgs[i];
- buf.append(string);
- buf.append(" "); //$NON-NLS-1$
- }
- setVMArgs(buf.toString().trim());
- }
- }
-
- /* (non-Rubydoc)
- * @see org.eclipse.jdt.launching.IInterpreterInstall2#getInterpreterArgs()
- */
- public String getInterpreterArgs() {
- return fInterpreterArgs;
- }
-
- /* (non-Rubydoc)
- * @see org.rubypeople.rdt.launching.IInterpreter2#setInterpreterArgs(java.lang.String)
- */
- public void setVMArgs(String vmArgs) {
- if (fInterpreterArgs == null) {
- if (vmArgs == null) {
- // No change
- return;
- }
- } else if (fInterpreterArgs.equals(vmArgs)) {
- // No change
- return;
- }
- PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_VM_ARGUMENTS, fInterpreterArgs, vmArgs);
- fInterpreterArgs = vmArgs;
- if (fNotify) {
- RubyRuntime.fireVMChanged(event);
- }
- }
-
- /* (non-Rubydoc)
- * Subclasses should override.
- * @see org.rubypeople.rdt.launching.IInterpreter2#getRubyVersion()
- */
- public String getRubyVersion() {
- return null;
- }
-
- /**
- * Throws a core exception with an error status object built from the given
- * message, lower level exception, and error code.
- *
- * @param message the status message
- * @param exception lower level exception associated with the error, or
- * <code>null</code> if none
- * @param code error code
- * @throws CoreException the "abort" core exception
- * @since 3.2
- */
- protected void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin
- .getUniqueIdentifier(), code, message, exception));
- }
-
-}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 20:27:10
|
Revision: 1819
http://svn.sourceforge.net/rubyeclipse/?rev=1819&view=rev
Author: cawilliams
Date: 2007-01-19 12:27:08 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
some renaming
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/StandardLoadpathProvider.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 20:24:00 UTC (rev 1818)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 20:27:08 UTC (rev 1819)
@@ -77,17 +77,17 @@
/**
* Launch configuration attribute key. The value is a path identifying the JRE used
- * when launching a local VM. The path is a classpath container corresponding
- * to the <code>JavaRuntime.JRE_CONTAINER</code> classpath container.
+ * when launching a local VM. The path is a loadpath container corresponding
+ * to the <code>RubyRuntime.RUBY_CONTAINER</code> loadpath container.
* <p>
* When unspecified the default JRE for a launch configuration is used (which is the
* JRE associated with the project being launched, or the workspace default JRE when
- * no project is associated with a configuration). The default JRE classpath container
+ * no project is associated with a configuration). The default JRE loadpath container
* refers explicitly to the workspace default JRE.
* </p>
- * @since 3.2
+ * @since 0.9.0
*/
- public static final String ATTR_JRE_CONTAINER_PATH = RubyRuntime.RUBY_CONTAINER;
+ public static final String ATTR_RUBY_CONTAINER_PATH = RubyRuntime.RUBY_CONTAINER;
/**
* Launch configuration attribute key. The value is a name of a VM install
@@ -95,7 +95,7 @@
* by a VM install type, via the <code>ATTR_VM_INSTALL_TYPE</code>
* attribute. When unspecified, the default VM is used.
*
- * @deprecated use <code>ATTR_JRE_CONTAINER_PATH</code>
+ * @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_NAME"; //$NON-NLS-1$
@@ -106,7 +106,7 @@
* The associated VM install name is specified via the attribute
* <code>ATTR_VM_INSTALL_NAME</code>.
*
- * @deprecated use <code>ATTR_JRE_CONTAINER_PATH</code>
+ * @deprecated use <code>ATTR_RUBY_CONTAINER_PATH</code>
*/
public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
@@ -153,29 +153,29 @@
/**
* Launch configuration attribute key. The value is an identifier of a
- * classpath provider extension used to compute the classpath
- * for a launch configuration. When unspecified, the default classpath
- * provider is used - <code>StandardClasspathProvider</code>.
+ * loadpath provider extension used to compute the loadpath
+ * for a launch configuration. When unspecified, the default loadpath
+ * provider is used - <code>StandardLoadpathProvider</code>.
*/
- public static final String ATTR_CLASSPATH_PROVIDER = LaunchingPlugin.getUniqueIdentifier() + ".CLASSPATH_PROVIDER"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH_PROVIDER = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH_PROVIDER"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The value is a boolean specifying
- * whether a default classpath should be used when launching a local
- * Java application. When <code>false</code>, a classpath must be specified
+ * whether a default loadpath should be used when launching a local
+ * Java application. When <code>false</code>, a loadpath must be specified
* via the <code>ATTR_CLASSPATH</code> attribute. When <code>true</code> or
- * unspecified, a classpath is computed by the classpath provider associated
+ * unspecified, a loadpath is computed by the loadpath provider associated
* with a launch configuration.
*/
- public static final String ATTR_DEFAULT_CLASSPATH = LaunchingPlugin.getUniqueIdentifier() + ".DEFAULT_CLASSPATH"; //$NON-NLS-1$
+ public static final String ATTR_DEFAULT_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".DEFAULT_LOADPATH"; //$NON-NLS-1$
/**
* Launch configuration attribute key. The attribute value is an ordered list of strings
* which are mementos for runtime class path entries. When unspecified, a default
- * classpath is generated by the classpath provider associated with a launch
- * configuration (via the <code>ATTR_CLASSPATH_PROVIDER</code> attribute).
+ * loadpath is generated by the loadpath provider associated with a launch
+ * configuration (via the <code>ATTR_LOADPATH_PROVIDER</code> attribute).
*/
- public static final String ATTR_CLASSPATH = LaunchingPlugin.getUniqueIdentifier() + ".CLASSPATH"; //$NON-NLS-1$
+ public static final String ATTR_LOADPATH = LaunchingPlugin.getUniqueIdentifier() + ".LOADPATH"; //$NON-NLS-1$
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 20:24:00 UTC (rev 1818)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 20:27:08 UTC (rev 1819)
@@ -125,7 +125,7 @@
/**
* Cache of already resolved projects in container entries. Used to avoid
- * cycles in project dependencies when resolving classpath container entries.
+ * cycles in project dependencies when resolving loadpath container entries.
* Counters used to know when entering/exiting to clear cache
*/
private static ThreadLocal fgProjects = new ThreadLocal(); // Lists
@@ -134,7 +134,7 @@
/**
* Default loadpath provider.
*/
- private static IRuntimeLoadpathProvider fgDefaultClasspathProvider = new StandardLoadpathProvider();
+ private static IRuntimeLoadpathProvider fgDefaultLoadpathProvider = new StandardLoadpathProvider();
/**
* Path providers keyed by id
@@ -148,11 +148,11 @@
/**
* Resolvers keyed by variable name, container id,
- * and runtime classpath entry id.
+ * and runtime loadpath entry id.
*/
private static Map fgVariableResolvers = null;
private static Map fgContainerResolvers = null;
- private static Map fgRuntimeClasspathEntryResolvers = null;
+ private static Map fgRuntimeLoadpathEntryResolvers = null;
protected RubyRuntime() {
super();
@@ -727,7 +727,7 @@
* @since 0.9.0
*/
public static IVMInstall computeVMInstall(ILaunchConfiguration configuration) throws CoreException {
- String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null);
+ String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_RUBY_CONTAINER_PATH, (String)null);
if (jreAttr == null) {
String type = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null);
if (type == null) {
@@ -840,7 +840,7 @@
IConfigurationElement[] extensions = point.getConfigurationElements();
fgVariableResolvers = new HashMap(extensions.length);
fgContainerResolvers = new HashMap(extensions.length);
- fgRuntimeClasspathEntryResolvers = new HashMap(extensions.length);
+ fgRuntimeLoadpathEntryResolvers = new HashMap(extensions.length);
for (int i = 0; i < extensions.length; i++) {
RuntimeLoadpathEntryResolver res = new RuntimeLoadpathEntryResolver(extensions[i]);
String variable = res.getVariableName();
@@ -853,7 +853,7 @@
fgContainerResolvers.put(container, res);
}
if (entryId != null) {
- fgRuntimeClasspathEntryResolvers.put(entryId, res);
+ fgRuntimeLoadpathEntryResolvers.put(entryId, res);
}
}
}
@@ -869,12 +869,12 @@
* @throws CoreException if unable to determine the project's VM install
*/
public static IVMInstall getVMInstall(IRubyProject project) throws CoreException {
- // check the classpath
+ // check the loadpath
IVMInstall vm = null;
- ILoadpathEntry[] classpath = project.getRawLoadpath();
+ ILoadpathEntry[] loadpath = project.getRawLoadpath();
IRuntimeLoadpathEntryResolver resolver = null;
- for (int i = 0; i < classpath.length; i++) {
- ILoadpathEntry entry = classpath[i];
+ for (int i = 0; i < loadpath.length; i++) {
+ ILoadpathEntry entry = loadpath[i];
switch (entry.getEntryKind()) {
case ILoadpathEntry.CPE_VARIABLE:
resolver = getVariableResolver(entry.getPath().segment(0));
@@ -926,11 +926,11 @@
}
/**
- * Returns a new runtime classpath entry for the given archive (possibly
+ * Returns a new runtime loadpath entry for the given archive (possibly
* external).
*
* @param path absolute path to an archive
- * @return runtime classpath entry
+ * @return runtime loadpath entry
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry newArchiveRuntimeLoadpathEntry(IPath path) {
@@ -939,12 +939,12 @@
}
/**
- * Returns a runtime classpath entry that corresponds to the given
- * classpath entry. The classpath entry may not be of type <code>CPE_SOURCE</code>
+ * Returns a runtime loadpath entry that corresponds to the given
+ * loadpath entry. The loadpath entry may not be of type <code>CPE_SOURCE</code>
* or <code>CPE_CONTAINER</code>.
*
- * @param entry a classpath entry
- * @return runtime classpath entry
+ * @param entry a loadpath entry
+ * @return runtime loadpath entry
* @since 0.9.0
*/
private static IRuntimeLoadpathEntry newRuntimeLoadpathEntry(ILoadpathEntry entry) {
@@ -952,28 +952,28 @@
}
/**
- * Returns a runtime classpath entry for the given container path with the given
- * classpath property to be resolved in the context of the given Java project.
+ * Returns a runtime loadpath entry for the given container path with the given
+ * loadpath property to be resolved in the context of the given Java project.
*
* @param path container path
- * @param classpathProperty the type of entry - one of <code>USER_CLASSES</code>,
+ * @param loadpathProperty the type of entry - one of <code>USER_CLASSES</code>,
* <code>BOOTSTRAP_CLASSES</code>, or <code>STANDARD_CLASSES</code>
* @param project Java project context used for resolution, or <code>null</code>
* if to be resolved in the context of the launch configuration this entry
* is referenced in
- * @return runtime classpath entry
- * @exception CoreException if unable to construct a runtime classpath entry
+ * @return runtime loadpath entry
+ * @exception CoreException if unable to construct a runtime loadpath entry
* @since 0.9.0
*/
- public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int classpathProperty, IRubyProject project) throws CoreException {
+ public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int loadpathProperty, IRubyProject project) throws CoreException {
ILoadpathEntry cpe = RubyCore.newContainerEntry(path);
- RuntimeLoadpathEntry entry = new RuntimeLoadpathEntry(cpe, classpathProperty);
+ RuntimeLoadpathEntry entry = new RuntimeLoadpathEntry(cpe, loadpathProperty);
entry.setRubyProject(project);
return entry;
}
/**
- * Returns a new runtime classpath entry for the classpath
+ * Returns a new runtime loadpath entry for the loadpath
* variable with the given path.
*
* @param path variable path; first segment is the name of the variable;
@@ -992,9 +992,9 @@
* Variable and container entries are unresolved.
*
* @param configuration launch configuration
- * @return unresolved runtime classpath entries
+ * @return unresolved runtime loadpath entries
* @throws CoreException
- * @exception CoreException if unable to compute the classpath
+ * @exception CoreException if unable to compute the loadpath
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry[] computeUnresolvedRuntimeLoadpath(
@@ -1003,18 +1003,18 @@
}
/**
- * Returns the classpath provider for the given launch configuration.
+ * Returns the loadpath provider for the given launch configuration.
*
* @param configuration launch configuration
- * @return classpath provider
+ * @return loadpath provider
* @exception CoreException if unable to resolve the path provider
* @since 0.9.0
*/
public static IRuntimeLoadpathProvider getLoadpathProvider(ILaunchConfiguration configuration) throws CoreException {
- String providerId = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, (String)null);
+ String providerId = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_LOADPATH_PROVIDER, (String)null);
IRuntimeLoadpathProvider provider = null;
if (providerId == null) {
- provider = fgDefaultClasspathProvider;
+ provider = fgDefaultLoadpathProvider;
} else {
provider = (IRuntimeLoadpathProvider)getLoadpathProviders().get(providerId);
if (provider == null) {
@@ -1025,7 +1025,7 @@
}
/**
- * Returns all registered classpath providers.
+ * Returns all registered loadpath providers.
*/
private static Map getLoadpathProviders() {
if (fgPathProviders == null) {
@@ -1045,11 +1045,11 @@
}
/**
- * Returns a runtime classpath entry constructed from the given memento.
+ * Returns a runtime loadpath entry constructed from the given memento.
*
- * @param memento a memento for a runtime classpath entry
- * @return runtime classpath entry
- * @exception CoreException if unable to construct a runtime classpath entry
+ * @param memento a memento for a runtime loadpath entry
+ * @return runtime loadpath entry
+ * @exception CoreException if unable to construct a runtime loadpath entry
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry newRuntimeLoadpathEntry(String memento) throws CoreException {
@@ -1087,31 +1087,31 @@
}
/**
- * Returns a runtime classpath entry identifying the JRE to use when launching the specified
+ * Returns a runtime loadpath entry identifying the JRE to use when launching the specified
* configuration or <code>null</code> if none is specified. The entry returned represents a
- * either a classpath variable or classpath container that resolves to a JRE.
+ * either a loadpath variable or loadpath container that resolves to a JRE.
* <p>
* The entry is resolved as follows:
* <ol>
* <li>If the <code>ATTR_JRE_CONTAINER_PATH</code> is present, it is used to create
- * a classpath container referring to a JRE.</li>
+ * a loadpath container referring to a JRE.</li>
* <li>Next, if the <code>ATTR_VM_INSTALL_TYPE</code> and <code>ATTR_VM_INSTALL_NAME</code>
- * attributes are present, they are used to create a classpath container.</li>
+ * attributes are present, they are used to create a loadpath container.</li>
* <li>When none of the above attributes are specified, a default entry is
* created which refers to the JRE referenced by the build path of the configuration's
- * associated Java project. This could be a classpath variable or classpath container.</li>
+ * associated Java project. This could be a loadpath variable or loadpath container.</li>
* <li>When there is no Java project associated with a configuration, the workspace
* default JRE is used to create a container path.</li>
* </ol>
* </p>
* @param configuration
- * @return classpath container path identifying a JRE or <code>null</code>
+ * @return loadpath container path identifying a JRE or <code>null</code>
* @exception org.eclipse.core.runtime.CoreException if an exception occurs retrieving
* attributes from the specified launch configuration
* @since 0.9.0
*/
- public static IRuntimeLoadpathEntry computeJREEntry(ILaunchConfiguration configuration) throws CoreException {
- String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null);
+ public static IRuntimeLoadpathEntry computeRubyVMEntry(ILaunchConfiguration configuration) throws CoreException {
+ String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_RUBY_CONTAINER_PATH, (String)null);
IPath containerPath = null;
if (jreAttr == null) {
String type = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null);
@@ -1121,7 +1121,7 @@
if (proj == null) {
containerPath = newDefaultJREContainerPath();
} else {
- return computeJREEntry(proj);
+ return computeRubyVMEntry(proj);
}
} else {
String name = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String)null);
@@ -1139,17 +1139,17 @@
}
/**
- * Returns a runtime classpath entry identifying the JRE referenced by the specified
+ * Returns a runtime loadpath entry identifying the JRE referenced by the specified
* project, or <code>null</code> if none. The entry returned represents a either a
- * classpath variable or classpath container that resolves to a JRE.
+ * loadpath variable or loadpath container that resolves to a JRE.
*
* @param project Java project
- * @return JRE runtime classpath entry or <code>null</code>
+ * @return Ruby VM runtime loadpath entry or <code>null</code>
* @exception org.eclipse.core.runtime.CoreException if an exception occurs
- * accessing the project's classpath
+ * accessing the project's loadpath
* @since 0.9.0
*/
- public static IRuntimeLoadpathEntry computeJREEntry(IRubyProject project) throws CoreException {
+ public static IRuntimeLoadpathEntry computeRubyVMEntry(IRubyProject project) throws CoreException {
ILoadpathEntry[] rawClasspath = project.getRawLoadpath();
IRuntimeLoadpathEntryResolver2 resolver = null;
for (int i = 0; i < rawClasspath.length; i++) {
@@ -1188,10 +1188,10 @@
}
/**
- * Returns a path for the JRE classpath container identifying the
+ * Returns a path for the JRE loadpath container identifying the
* default VM install.
*
- * @return classpath container path
+ * @return loadpath container path
* @since 0.9.0
*/
public static IPath newDefaultJREContainerPath() {
@@ -1199,32 +1199,32 @@
}
/**
- * Returns a runtime classpath entry for the given container path with the given
- * classpath property.
+ * Returns a runtime loadpath entry for the given container path with the given
+ * loadpath property.
*
* @param path container path
- * @param classpathProperty the type of entry - one of <code>USER_CLASSES</code>,
+ * @param loadpathProperty the type of entry - one of <code>USER_CLASSES</code>,
* <code>BOOTSTRAP_CLASSES</code>, or <code>STANDARD_CLASSES</code>
- * @return runtime classpath entry
- * @exception CoreException if unable to construct a runtime classpath entry
+ * @return runtime loadpath entry
+ * @exception CoreException if unable to construct a runtime loadpath entry
* @since 0.9.0
*/
- public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int classpathProperty) throws CoreException {
- return newRuntimeContainerLoadpathEntry(path, classpathProperty, null);
+ public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int loadpathProperty) throws CoreException {
+ return newRuntimeContainerLoadpathEntry(path, loadpathProperty, null);
}
/**
- * Computes and returns the default unresolved runtime classpath for the
+ * Computes and returns the default unresolved runtime loadpath for the
* given project.
*
- * @return runtime classpath entries
- * @exception CoreException if unable to compute the runtime classpath
+ * @return runtime loadpath entries
+ * @exception CoreException if unable to compute the runtime loadpath
* @see IRuntimeClasspathEntry
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry[] computeUnresolvedRuntimeLoadpath(IRubyProject project) throws CoreException {
ILoadpathEntry[] entries = project.getRawLoadpath();
- List classpathEntries = new ArrayList(3);
+ List loadpathEntries = new ArrayList(3);
for (int i = 0; i < entries.length; i++) {
ILoadpathEntry entry = entries[i];
switch (entry.getEntryKind()) {
@@ -1236,10 +1236,10 @@
// don't look at application entries
break;
case ILoadpathContainer.K_DEFAULT_SYSTEM:
- classpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.STANDARD_CLASSES, project));
+ loadpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.STANDARD_CLASSES, project));
break;
case ILoadpathContainer.K_SYSTEM:
- classpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES, project));
+ loadpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES, project));
break;
}
}
@@ -1248,23 +1248,23 @@
if (RUBYLIB_VARIABLE.equals(entry.getPath().segment(0))) {
IRuntimeLoadpathEntry jre = newVariableRuntimeLoadpathEntry(entry.getPath());
jre.setLoadpathProperty(IRuntimeLoadpathEntry.STANDARD_CLASSES);
- classpathEntries.add(jre);
+ loadpathEntries.add(jre);
}
break;
default:
break;
}
}
- classpathEntries.add(newDefaultProjectLoadpathEntry(project));
- return (IRuntimeLoadpathEntry[]) classpathEntries.toArray(new IRuntimeLoadpathEntry[classpathEntries.size()]);
+ loadpathEntries.add(newDefaultProjectLoadpathEntry(project));
+ return (IRuntimeLoadpathEntry[]) loadpathEntries.toArray(new IRuntimeLoadpathEntry[loadpathEntries.size()]);
}
/**
- * Returns a new runtime classpath entry containing the default classpath
+ * Returns a new runtime loadpath entry containing the default loadpath
* for the specified Ruby project.
*
* @param project Ruby project
- * @return runtime classpath entry
+ * @return runtime loadpath entry
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry newDefaultProjectLoadpathEntry(IRubyProject project) {
@@ -1282,13 +1282,13 @@
* <p>
* If the given entry is a variable entry, and a resolver is not registered,
* the entry itself is returned. If the given entry is a container, and a
- * resolver is not registered, resolved runtime classpath entries are calculated
- * from the associated container classpath entries, in the context of the project
+ * resolver is not registered, resolved runtime loadpath entries are calculated
+ * from the associated container loadpath entries, in the context of the project
* associated with the given launch configuration.
* </p>
- * @param entry runtime classpath entry
+ * @param entry runtime loadpath entry
* @param configuration launch configuration
- * @return resolved runtime classpath entry
+ * @return resolved runtime loadpath entry
* @exception CoreException if unable to resolve
* @see IRuntimeClasspathEntryResolver
* @since 2.0
@@ -1408,8 +1408,8 @@
IRubyProject jp = RubyCore.create(p);
if (!projects.contains(jp)) {
projects.add(jp);
- IRuntimeLoadpathEntry classpath = newDefaultProjectLoadpathEntry(jp);
- IRuntimeLoadpathEntry[] entries = resolveRuntimeLoadpathEntry(classpath, jp);
+ IRuntimeLoadpathEntry loadpath = newDefaultProjectLoadpathEntry(jp);
+ IRuntimeLoadpathEntry[] entries = resolveRuntimeLoadpathEntry(loadpath, jp);
for (int j = 0; j < entries.length; j++) {
IRuntimeLoadpathEntry e = entries[j];
if (!resolved.contains(e)) {
@@ -1433,7 +1433,7 @@
fgEntryCount.set(new Integer(intCount));
}
}
- // set classpath property
+ // set loadpath property
IRuntimeLoadpathEntry[] result = new IRuntimeLoadpathEntry[resolved.size()];
for (int i = 0; i < result.length; i++) {
result[i] = (IRuntimeLoadpathEntry) resolved.get(i);
@@ -1443,7 +1443,7 @@
}
/**
- * Default resolution for a classpath variable - resolve to an archive. Only
+ * Default resolution for a loadpath variable - resolve to an archive. Only
* one of project/configuration can be non-null.
*
* @param entry
@@ -1484,13 +1484,13 @@
* <p>
* If the given entry is a variable entry, and a resolver is not registered,
* the entry itself is returned. If the given entry is a container, and a
- * resolver is not registered, resolved runtime classpath entries are calculated
- * from the associated container classpath entries, in the context of the
+ * resolver is not registered, resolved runtime loadpath entries are calculated
+ * from the associated container loadpath entries, in the context of the
* given project.
* </p>
- * @param entry runtime classpath entry
+ * @param entry runtime loadpath entry
* @param project Java project context
- * @return resolved runtime classpath entry
+ * @return resolved runtime loadpath entry
* @exception CoreException if unable to resolve
* @see IRuntimeClasspathEntryResolver
* @since 0.9.0
@@ -1539,11 +1539,11 @@
}
/**
- * Returns the resolver registered for the given contributed classpath
+ * Returns the resolver registered for the given contributed loadpath
* entry type.
*
- * @param typeId the id of the contributed classpath entry
- * @return the resolver registered for the given classpath entry
+ * @param typeId the id of the contributed loadpath entry
+ * @return the resolver registered for the given loadpath entry
*/
private static IRuntimeLoadpathEntryResolver getContributedResolver(String typeId) {
IRuntimeLoadpathEntryResolver resolver = (IRuntimeLoadpathEntryResolver)getEntryResolvers().get(typeId);
@@ -1554,39 +1554,39 @@
}
/**
- * Returns runtime classpath entries corresponding to the output locations
+ * Returns runtime loadpath entries corresponding to the output locations
* of the given project, or null if the project only uses the default
* output location.
*
* @param project
- * @param classpathProperty the type of classpath entries to create
+ * @param loadpathProperty the type of loadpath entries to create
* @return IRuntimeClasspathEntry[] or <code>null</code>
* @throws CoreException
*/
- private static IRuntimeLoadpathEntry[] resolveOutputLocations(IRubyProject project, int classpathProperty) throws CoreException {
+ private static IRuntimeLoadpathEntry[] resolveOutputLocations(IRubyProject project, int loadpathProperty) throws CoreException {
// FIXME Investigate all calls to this and assume null gets retruned so we can drop this method!
return null;
}
/**
- * Returns all registered runtime classpath entry resolvers.
+ * Returns all registered runtime loadpath entry resolvers.
*/
private static Map getEntryResolvers() {
- if (fgRuntimeClasspathEntryResolvers == null) {
+ if (fgRuntimeLoadpathEntryResolvers == null) {
initializeResolvers();
}
- return fgRuntimeClasspathEntryResolvers;
+ return fgRuntimeLoadpathEntryResolvers;
}
/**
- * Resolves the given classpath, returning the resolved classpath
+ * Resolves the given loadpath, returning the resolved loadpath
* in the context of the given launch configuration.
*
- * @param entries unresolved classpath
+ * @param entries unresolved loadpath
* @param configuration launch configuration
- * @return resolved runtime classpath entries
+ * @return resolved runtime loadpath entries
* @throws CoreException
- * @exception CoreException if unable to compute the classpath
+ * @exception CoreException if unable to compute the loadpath
* @since 0.9.0
*/
public static IRuntimeLoadpathEntry[] resolveRuntimeLoadpath(
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/StandardLoadpathProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/StandardLoadpathProvider.java 2007-01-19 20:24:00 UTC (rev 1818)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/StandardLoadpathProvider.java 2007-01-19 20:27:08 UTC (rev 1819)
@@ -33,10 +33,10 @@
* @see org.eclipse.jdt.launching.IRuntimeLoadpathProvider#computeUnresolvedLoadpath(org.eclipse.debug.core.ILaunchConfiguration)
*/
public IRuntimeLoadpathEntry[] computeUnresolvedLoadpath(ILaunchConfiguration configuration) throws CoreException {
- boolean useDefault = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, true);
+ boolean useDefault = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_DEFAULT_LOADPATH, true);
if (useDefault) {
IRubyProject proj = RubyRuntime.getRubyProject(configuration);
- IRuntimeLoadpathEntry jreEntry = RubyRuntime.computeJREEntry(configuration);
+ IRuntimeLoadpathEntry jreEntry = RubyRuntime.computeRubyVMEntry(configuration);
if (proj == null) {
//no project - use default libraries
if (jreEntry == null) {
@@ -46,7 +46,7 @@
}
IRuntimeLoadpathEntry[] entries = RubyRuntime.computeUnresolvedRuntimeLoadpath(proj);
// replace project JRE with config's JRE
- IRuntimeLoadpathEntry projEntry = RubyRuntime.computeJREEntry(proj);
+ IRuntimeLoadpathEntry projEntry = RubyRuntime.computeRubyVMEntry(proj);
if (jreEntry != null && projEntry != null) {
if (!jreEntry.equals(projEntry)) {
for (int i = 0; i < entries.length; i++) {
@@ -61,7 +61,7 @@
return entries;
}
// recover persisted classpath
- return recoverRuntimePath(configuration, IRubyLaunchConfigurationConstants.ATTR_CLASSPATH);
+ return recoverRuntimePath(configuration, IRubyLaunchConfigurationConstants.ATTR_LOADPATH);
}
/* (non-Rubydoc)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 20:24:02
|
Revision: 1818
http://svn.sourceforge.net/rubyeclipse/?rev=1818&view=rev
Author: cawilliams
Date: 2007-01-19 12:24:00 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
use a boolean VERBOSE flag to spit out debug output to command line (and set to false by default)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java 2007-01-19 20:07:32 UTC (rev 1817)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultReferenceFinder.java 2007-01-19 20:24:00 UTC (rev 1818)
@@ -31,6 +31,8 @@
public class DefaultReferenceFinder implements IReferenceFinder {
+ private static final boolean VERBOSE = false;
+
public List<ISourcePosition> findReferences(String source, int offset) {
// References to return
@@ -43,7 +45,7 @@
// Find origiating node
Node orig = OffsetNodeLocator.Instance().getNodeAtOffset(root, offset);
- System.out.println("Origin: " + orig.getClass().getName());
+ log("Origin: " + orig.getClass().getName());
if ( isLocalVarRef(orig) ) {
pushLocalVarRefs( root, orig, references );
@@ -157,7 +159,7 @@
private void pushLocalVarRefs( Node root, Node orig, List<ISourcePosition> references ) {
- System.out.println("Finding references for a local variable " + orig.toString());
+ log("Finding references for a local variable " + orig.toString());
// Find the search space
Node searchSpace = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(root, orig.getPosition().getStartOffset(), new INodeAcceptor() {
@@ -194,8 +196,12 @@
// System.out.println("Searching search space " + searchSpace.toString() + searchSpace.getPosition().toString() );
}
+ private void log(String string) {
+ if (VERBOSE) System.out.println(string);
+ }
+
private void pushInstVarRefs( Node root, Node orig, List<ISourcePosition> references ) {
- System.out.println("Finding references for an instance variable " + orig.toString() );
+ log("Finding references for an instance variable " + orig.toString() );
Node searchSpace;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 20:07:34
|
Revision: 1817
http://svn.sourceforge.net/rubyeclipse/?rev=1817&view=rev
Author: cawilliams
Date: 2007-01-19 12:07:32 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
build still ain't broken - it's a miracle!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultEntryResolver.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathProvider.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/StandardLoadpathProvider.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultEntryResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultEntryResolver.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultEntryResolver.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry2;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+/**
+ * Default resolver for a contributed classpath entry
+ */
+public class DefaultEntryResolver implements IRuntimeLoadpathEntryResolver {
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(org.eclipse.jdt.launching.IRuntimeLoadpathEntry, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
+ IRuntimeLoadpathEntry2 entry2 = (IRuntimeLoadpathEntry2)entry;
+ IRuntimeLoadpathEntry[] entries = entry2.getRuntimeLoadpathEntries(configuration);
+ List resolved = new ArrayList();
+ for (int i = 0; i < entries.length; i++) {
+ IRuntimeLoadpathEntry[] temp = RubyRuntime.resolveRuntimeLoadpathEntry(entries[i], configuration);
+ for (int j = 0; j < temp.length; j++) {
+ resolved.add(temp[j]);
+ }
+ }
+ return (IRuntimeLoadpathEntry[]) resolved.toArray(new IRuntimeLoadpathEntry[resolved.size()]);
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(org.eclipse.jdt.launching.IRuntimeLoadpathEntry, org.eclipse.jdt.core.IRubyProject)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
+ IRuntimeLoadpathEntry2 entry2 = (IRuntimeLoadpathEntry2)entry;
+ IRuntimeLoadpathEntry[] entries = entry2.getRuntimeLoadpathEntries(null);
+ List resolved = new ArrayList();
+ for (int i = 0; i < entries.length; i++) {
+ IRuntimeLoadpathEntry[] temp = RubyRuntime.resolveRuntimeLoadpathEntry(entries[i], project);
+ for (int j = 0; j < temp.length; j++) {
+ resolved.add(temp[j]);
+ }
+ }
+ return (IRuntimeLoadpathEntry[]) resolved.toArray(new IRuntimeLoadpathEntry[resolved.size()]);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveVMInstall(org.eclipse.jdt.core.ILoadpathEntry)
+ */
+ public IVMInstall resolveVMInstall(ILoadpathEntry entry) throws CoreException {
+ return null;
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 19:13:42 UTC (rev 1816)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -67,6 +67,13 @@
public static String DefaultProjectLoadpathEntry_4;
public static String DefaultProjectLoadpathEntry_2;
public static String DefaultProjectLoadpathEntry_3;
+ public static String JavaRuntime_26;
+ public static String JavaRuntime_31;
+ public static String JavaRuntime_32;
+ public static String LaunchingPlugin_32;
+ public static String JavaRuntime_Classpath_references_non_existant_archive___0__4;
+ public static String JavaRuntime_Classpath_references_non_existant_project___0__3;
+ public static String JavaRuntime_Could_not_resolve_classpath_container___0__1;
private LaunchingMessages() {}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-19 19:13:42 UTC (rev 1816)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -6,6 +6,7 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
@@ -25,6 +26,8 @@
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
@@ -32,6 +35,7 @@
import org.eclipse.core.runtime.Status;
import org.osgi.framework.BundleContext;
import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry2;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -45,6 +49,17 @@
public static final String PLUGIN_ID = "org.rubypeople.rdt.launching"; //$NON-NLS-1$
/**
+ * Runtime classpath extensions
+ */
+ private HashMap fClasspathEntryExtensions = null;
+
+ /**
+ * Identifier for 'runtimeLoadpathEntries' extension point
+ */
+ public static final String ID_EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRIES = "runtimeLoadpathEntries"; //$NON-NLS-1$
+
+
+ /**
* Mapping of top-level VM installation directories to library info for that
* VM.
*/
@@ -67,7 +82,7 @@
plugin = this;
}
- public static Plugin getDefault() {
+ public static LaunchingPlugin getDefault() {
return plugin;
}
@@ -383,4 +398,34 @@
}
return (String[])paths.toArray(new String[paths.size()]);
}
+
+ /**
+ * Returns a new runtime classpath entry of the specified type.
+ *
+ * @param id extension type id
+ * @return new uninitialized runtime classpath entry
+ * @throws CoreException if unable to create an entry
+ */
+ public IRuntimeLoadpathEntry2 newRuntimeLoadpathEntry(String id) throws CoreException {
+ if (fClasspathEntryExtensions == null) {
+ initializeRuntimeLoadpathExtensions();
+ }
+ IConfigurationElement config = (IConfigurationElement) fClasspathEntryExtensions.get(id);
+ if (config == null) {
+ abort(MessageFormat.format(LaunchingMessages.LaunchingPlugin_32, new String[]{id}), null);
+ }
+ return (IRuntimeLoadpathEntry2) config.createExecutableExtension("class"); //$NON-NLS-1$
+ }
+
+ /**
+ * Loads runtime classpath extensions
+ */
+ private void initializeRuntimeLoadpathExtensions() {
+ IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, ID_EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRIES);
+ IConfigurationElement[] configs= extensionPoint.getConfigurationElements();
+ fClasspathEntryExtensions = new HashMap(configs.length);
+ for (int i= 0; i < configs.length; i++) {
+ fClasspathEntryExtensions.put(configs[i].getAttribute("id"), configs[i]); //$NON-NLS-1$
+ }
+ }
}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathProvider.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathProvider;
+
+/**
+ * Proxy to a runtime classpath provider extension.
+ */
+public class RuntimeLoadpathProvider implements IRuntimeLoadpathProvider {
+
+ private IConfigurationElement fConfigurationElement;
+
+ private IRuntimeLoadpathProvider fDelegate;
+
+ /**
+ * Constructs a new resolver on the given configuration element
+ */
+ public RuntimeLoadpathProvider(IConfigurationElement element) {
+ fConfigurationElement = element;
+ }
+
+ /**
+ * Returns the resolver delegate (and creates if required)
+ */
+ protected IRuntimeLoadpathProvider getProvider() throws CoreException {
+ if (fDelegate == null) {
+ fDelegate = (IRuntimeLoadpathProvider)fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ return fDelegate;
+ }
+
+ public String getIdentifier() {
+ return fConfigurationElement.getAttribute("id"); //$NON-NLS-1$
+ }
+ /**
+ * @see IRuntimeLoadpathProvider#computeUnresolvedLoadpath(ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] computeUnresolvedLoadpath(ILaunchConfiguration configuration) throws CoreException {
+ return getProvider().computeUnresolvedLoadpath(configuration);
+ }
+
+ /**
+ * @see IRuntimeLoadpathProvider#resolveLoadpath(IRuntimeLoadpathEntry[], ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] resolveLoadpath(IRuntimeLoadpathEntry[] entries, ILaunchConfiguration configuration) throws CoreException {
+ return getProvider().resolveLoadpath(entries, configuration);
+ }
+
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractRubyLaunchConfigurationDelegate.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -0,0 +1,437 @@
+package org.rubypeople.rdt.launching;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
+
+public abstract class AbstractRubyLaunchConfigurationDelegate extends
+ LaunchConfigurationDelegate {
+
+ /**
+ * Throws a core exception with an error status object built from the given
+ * message, lower level exception, and error code.
+ *
+ * @param message
+ * the status message
+ * @param exception
+ * lower level exception associated with the error, or
+ * <code>null</code> if none
+ * @param code
+ * error code
+ * @throws CoreException
+ * the "abort" core exception
+ */
+ protected void abort(String message, Throwable exception, int code)
+ throws CoreException {
+ throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin
+ .getUniqueIdentifier(), code, message, exception));
+ }
+
+ /**
+ * Returns the VM arguments specified by the given launch configuration, as
+ * a string. The returned string is empty if no VM arguments are specified.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the VM arguments specified by the given launch configuration,
+ * possibly an empty string
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public String getVMArguments(ILaunchConfiguration configuration) throws CoreException {
+ String arguments = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
+ String args = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(arguments);
+ return args;
+ }
+
+ /**
+ * Returns the program arguments specified by the given launch
+ * configuration, as a string. The returned string is empty if no program
+ * arguments are specified.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the program arguments specified by the given launch
+ * configuration, possibly an empty string
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public String getProgramArguments(ILaunchConfiguration configuration)
+ throws CoreException {
+ String arguments = configuration.getAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
+ return VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(arguments);
+ }
+
+ /**
+ * Returns an array of environment variables to be used when
+ * launching the given configuration or <code>null</code> if unspecified.
+ *
+ * @param configuration launch configuration
+ * @throws CoreException if unable to access associated attribute or if
+ * unable to resolve a variable in an environment variable's value
+ * @since 0.9.0
+ */
+ public String[] getEnvironment(ILaunchConfiguration configuration) throws CoreException {
+ return DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
+ }
+
+ /**
+ * Verifies the working directory specified by the given launch
+ * configuration exists, and returns the working directory, or
+ * <code>null</code> if none is specified.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the working directory specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public File verifyWorkingDirectory(ILaunchConfiguration configuration)
+ throws CoreException {
+ IPath path = getWorkingDirectoryPath(configuration);
+ if (path == null) {
+ File dir = getDefaultWorkingDirectory(configuration);
+ if (dir != null) {
+ if (!dir.isDirectory()) {
+ abort(
+ MessageFormat.format(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12,
+ new String[]{dir.toString()}),
+ null,
+ IRubyLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ }
+ return dir;
+ }
+ } else {
+ if (path.isAbsolute()) {
+ File dir = new File(path.toOSString());
+ if (dir.isDirectory()) {
+ return dir;
+ }
+ // This may be a workspace relative path returned by a variable.
+ // However variable paths start with a slash and thus are thought to
+ // be absolute
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(path);
+ if (res instanceof IContainer && res.exists()) {
+ return res.getLocation().toFile();
+ }
+ abort(
+ MessageFormat
+ .format(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12,
+ new String[]{path.toString()}),
+ null,
+ IRubyLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ } else {
+ IResource res = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(path);
+ if (res instanceof IContainer && res.exists()) {
+ return res.getLocation().toFile();
+ }
+ abort(
+ MessageFormat
+ .format(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12,
+ new String[]{path.toString()}),
+ null,
+ IRubyLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the working directory path specified by the given launch
+ * configuration, or <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the working directory path specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public IPath getWorkingDirectoryPath(ILaunchConfiguration configuration)
+ throws CoreException {
+ String path = configuration.getAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ (String) null);
+ if (path != null) {
+ path = VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(path);
+ return new Path(path);
+ }
+ return null;
+ }
+
+ /**
+ * Returns the default working directory for the given launch configuration,
+ * or <code>null</code> if none. Subclasses may override as necessary.
+ *
+ * @param configuration
+ * @return default working directory or <code>null</code> if none
+ * @throws CoreException if an exception occurs computing the default working
+ * directory
+ * @since 0.9.0
+ */
+ protected File getDefaultWorkingDirectory(ILaunchConfiguration configuration) throws CoreException {
+ // default working directory is the project if this config has a project
+ IRubyProject rp = getRubyProject(configuration);
+ if (rp != null) {
+ IProject p = rp.getProject();
+ return p.getLocation().toFile();
+ }
+ return null;
+ }
+
+ /**
+ * Returns the Ruby project specified by the given launch configuration, or
+ * <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the Ruby project specified by the given launch configuration, or
+ * <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public IRubyProject getRubyProject(ILaunchConfiguration configuration)
+ throws CoreException {
+ String projectName = getRubyProjectName(configuration);
+ if (projectName != null) {
+ projectName = projectName.trim();
+ if (projectName.length() > 0) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(projectName);
+ IRubyProject rubyProject = RubyCore.create(project);
+ if (rubyProject != null && rubyProject.exists()) {
+ return rubyProject;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the Ruby project name specified by the given launch
+ * configuration, or <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the Ruby project name specified by the given launch
+ * configuration, or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public String getRubyProjectName(ILaunchConfiguration configuration)
+ throws CoreException {
+ return configuration.getAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME,
+ (String) null);
+ }
+
+ /**
+ * Returns the Map of VM-specific attributes specified by the given launch
+ * configuration, or <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the <code>Map</code> of VM-specific attributes
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public Map getVMSpecificAttributesMap(ILaunchConfiguration configuration)
+ throws CoreException {
+ Map map = configuration
+ .getAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP,
+ (Map) null);
+ return map;
+ }
+
+ /**
+ * Returns the VM runner for the given launch mode to use when launching the
+ * given configuration.
+ *
+ * @param configuration launch configuration
+ * @param mode launch node
+ * @return VM runner to use when launching the given configuration in the given mode
+ * @throws CoreException if a VM runner cannot be determined
+ * @since 0.9.0
+ */
+ public IVMRunner getVMRunner(ILaunchConfiguration configuration, String mode) throws CoreException {
+ IVMInstall vm = verifyVMInstall(configuration);
+ IVMRunner runner = vm.getVMRunner(mode);
+ if (runner == null) {
+ abort(MessageFormat.format(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_0, new String[]{vm.getName(), mode}), null, IRubyLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
+ }
+ return runner;
+ }
+
+ /**
+ * Verifies the VM install specified by the given launch configuration
+ * exists and returns the VM install.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the VM install specified by the given launch configuration
+ * @exception CoreException
+ * if unable to retrieve the attribute, the attribute is
+ * unspecified, or if the home location is unspecified or
+ * does not exist
+ */
+ public IVMInstall verifyVMInstall(ILaunchConfiguration configuration)
+ throws CoreException {
+ IVMInstall vm = getVMInstall(configuration);
+ if (vm == null) {
+ abort(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4,
+ null,
+ IRubyLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST);
+ }
+ File location = vm.getInstallLocation();
+ if (location == null) {
+ abort(
+ MessageFormat
+ .format(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5,
+ new String[]{vm.getName()}),
+ null,
+ IRubyLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST);
+ }
+ if (!location.exists()) {
+ abort(
+ MessageFormat
+ .format(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6,
+ new String[]{vm.getName(),
+ location.getAbsolutePath()}),
+ null,
+ IRubyLaunchConfigurationConstants.ERR_VM_INSTALL_DOES_NOT_EXIST);
+ }
+ return vm;
+ }
+
+ /**
+ * Returns the VM install specified by the given launch configuration, or
+ * <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the VM install specified by the given launch configuration, or
+ * <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public IVMInstall getVMInstall(ILaunchConfiguration configuration)
+ throws CoreException {
+ return RubyRuntime.computeVMInstall(configuration);
+ }
+
+ /**
+ * Verifies a main type name is specified by the given launch configuration,
+ * and returns the main type name.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the main type name specified by the given launch configuration
+ * @exception CoreException
+ * if unable to retrieve the attribute or the attribute is
+ * unspecified
+ */
+ public String verifyFileToLaunch(ILaunchConfiguration configuration)
+ throws CoreException {
+ // TODO Verify file exists and is a file (not directory)
+ String name = getFileToLaunch(configuration);
+ if (name == null) {
+ abort(
+ LaunchingMessages.AbstractJavaLaunchConfigurationDelegate_Main_type_not_specified_11,
+ null,
+ IRubyLaunchConfigurationConstants.ERR_UNSPECIFIED_FILE_NAME);
+ }
+ return name;
+ }
+
+ /**
+ * Returns the main type name specified by the given launch configuration,
+ * or <code>null</code> if none.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the main type name specified by the given launch configuration,
+ * or <code>null</code> if none
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public String getFileToLaunch(ILaunchConfiguration configuration)
+ throws CoreException {
+ String mainType = configuration.getAttribute(
+ IRubyLaunchConfigurationConstants.ATTR_FILE_NAME,
+ (String) null);
+ if (mainType == null) {
+ return null;
+ }
+ return VariablesPlugin.getDefault().getStringVariableManager()
+ .performStringSubstitution(mainType);
+ }
+
+ protected void setDefaultSourceLocator(ILaunch launch,
+ ILaunchConfiguration configuration) {
+ // TODO Actually set up the source locator!
+
+ }
+
+ /**
+ * Returns the entries that should appear on the user portion of the
+ * classpath as specified by the given launch configuration, as an array of
+ * resolved strings. The returned array is empty if no classpath is
+ * specified.
+ *
+ * @param configuration
+ * launch configuration
+ * @return the classpath specified by the given launch configuration,
+ * possibly an empty array
+ * @exception CoreException
+ * if unable to retrieve the attribute
+ */
+ public String[] getLoadpath(ILaunchConfiguration configuration)
+ throws CoreException {
+ IRuntimeLoadpathEntry[] entries = RubyRuntime
+ .computeUnresolvedRuntimeLoadpath(configuration);
+ entries = RubyRuntime.resolveRuntimeLoadpath(entries, configuration);
+ List userEntries = new ArrayList(entries.length);
+ for (int i = 0; i < entries.length; i++) {
+ if (entries[i].getLoadpathProperty() == IRuntimeLoadpathEntry.USER_CLASSES) {
+ String location = entries[i].getLocation();
+ if (location != null) {
+ userEntries.add(location);
+ }
+ }
+ }
+ return (String[]) userEntries.toArray(new String[userEntries.size()]);
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 19:13:42 UTC (rev 1816)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -6,11 +6,29 @@
/**
* Status code indicating a launch configuration does not
+ * specify a file to launch.
+ */
+ public static final int ERR_UNSPECIFIED_FILE_NAME = 101;
+
+ /**
+ * Status code indicating a launch configuration does not
* specify a VM Install
*/
public static final int ERR_UNSPECIFIED_VM_INSTALL = 103;
/**
+ * Status code indicating a launch configuration's VM install
+ * could not be found.
+ */
+ public static final int ERR_VM_INSTALL_DOES_NOT_EXIST = 105;
+
+ /**
+ * Status code indicating a VM runner could not be located
+ * for the VM install specified by a launch configuration.
+ */
+ public static final int ERR_VM_RUNNER_DOES_NOT_EXIST = 106;
+
+ /**
* Status code indicating the project associated with
* a launch configuration is not a Ruby project.
*/
@@ -92,4 +110,72 @@
*/
public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
+ /**
+ * Launch configuration attribute key. The value is a string specifying
+ * program arguments for a Ruby launch configuration, as they should appear
+ * on the command line.
+ */
+ public static final String ATTR_PROGRAM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".PROGRAM_ARGUMENTS"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a string specifying
+ * VM arguments for a Ruby launch configuration, as they should appear
+ * on the command line.
+ */
+ public static final String ATTR_VM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".VM_ARGUMENTS"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a string specifying a
+ * path to the working directory to use when launching a local VM.
+ * When specified as an absolute path, the path represents a path in the local
+ * file system. When specified as a full path, the path represents a workspace
+ * relative path. When unspecified, the working directory defaults to the project
+ * associated with a launch configuration. When no project is associated with a
+ * launch configuration, the working directory is inherited from the current
+ * process.
+ */
+ public static final String ATTR_WORKING_DIRECTORY = LaunchingPlugin.getUniqueIdentifier() + ".WORKING_DIRECTORY"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a Map of attributes specific
+ * to a particular VM install type, used when launching a local Ruby
+ * application. The map is passed to a <code>VMRunner</code> via a <code>VMRunnerConfiguration</code>
+ * when launching a VM. The attributes in the map are implementation dependent
+ * and are limited to String keys and values.
+ */
+ public static final String ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP = LaunchingPlugin.getUniqueIdentifier() + "VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a fully qualified name
+ * of a file to launch.
+ */
+ public static final String ATTR_FILE_NAME = LaunchingPlugin.getUniqueIdentifier() + ".FILE_NAME"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is an identifier of a
+ * classpath provider extension used to compute the classpath
+ * for a launch configuration. When unspecified, the default classpath
+ * provider is used - <code>StandardClasspathProvider</code>.
+ */
+ public static final String ATTR_CLASSPATH_PROVIDER = LaunchingPlugin.getUniqueIdentifier() + ".CLASSPATH_PROVIDER"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is a boolean specifying
+ * whether a default classpath should be used when launching a local
+ * Java application. When <code>false</code>, a classpath must be specified
+ * via the <code>ATTR_CLASSPATH</code> attribute. When <code>true</code> or
+ * unspecified, a classpath is computed by the classpath provider associated
+ * with a launch configuration.
+ */
+ public static final String ATTR_DEFAULT_CLASSPATH = LaunchingPlugin.getUniqueIdentifier() + ".DEFAULT_CLASSPATH"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The attribute value is an ordered list of strings
+ * which are mementos for runtime class path entries. When unspecified, a default
+ * classpath is generated by the classpath provider associated with a launch
+ * configuration (via the <code>ATTR_CLASSPATH_PROVIDER</code> attribute).
+ */
+ public static final String ATTR_CLASSPATH = LaunchingPlugin.getUniqueIdentifier() + ".CLASSPATH"; //$NON-NLS-1$
+
+
}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyLaunchDelegate.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+import java.io.File;
+import java.text.MessageFormat;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
+
+/**
+ * A launch delegate for launching local Ruby applications.
+ * <p>
+ * Clients may subclass and instantiate this class.
+ * </p>
+ * @since 0.9.0
+ */
+public class RubyLaunchDelegate extends AbstractRubyLaunchConfigurationDelegate {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ monitor.beginTask(MessageFormat.format("{0}...", new String[]{configuration.getName()}), 3); //$NON-NLS-1$
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1);
+
+ String mainTypeName = verifyFileToLaunch(configuration);
+ IVMRunner runner = getVMRunner(configuration, mode);
+
+ File workingDir = verifyWorkingDirectory(configuration);
+ String workingDirName = null;
+ if (workingDir != null) {
+ workingDirName = workingDir.getAbsolutePath();
+ }
+
+ // Environment variables
+ String[] envp= getEnvironment(configuration);
+
+ // Program & VM arguments
+ String pgmArgs = getProgramArguments(configuration);
+ String vmArgs = getVMArguments(configuration);
+ ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
+
+ // VM-specific attributes
+ Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
+
+ // Loadpath
+ String[] classpath = getLoadpath(configuration);
+
+ // Create VM config
+ VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
+ runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
+ runConfig.setEnvironment(envp);
+ runConfig.setVMArguments(execArgs.getVMArgumentsArray());
+ runConfig.setWorkingDirectory(workingDirName);
+ runConfig.setVMSpecificAttributesMap(vmAttributesMap);
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ // done the verification phase
+ monitor.worked(1);
+
+ monitor.subTask(LaunchingMessages.JavaLocalApplicationLaunchConfigurationDelegate_Creating_source_locator____2);
+ // set the default source locator if required
+ setDefaultSourceLocator(launch, configuration);
+ monitor.worked(1);
+
+ // Launch the configuration - 1 unit of work
+ runner.run(runConfig, launch, monitor);
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ monitor.done();
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:13:42 UTC (rev 1816)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 20:07:32 UTC (rev 1817)
@@ -4,6 +4,7 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.io.StringReader;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
@@ -13,9 +14,12 @@
import java.util.Map;
import java.util.Set;
+import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
@@ -29,17 +33,26 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathContainer;
import org.rubypeople.rdt.core.ILoadpathEntry;
import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.launching.CompositeId;
+import org.rubypeople.rdt.internal.launching.DefaultEntryResolver;
+import org.rubypeople.rdt.internal.launching.DefaultProjectLoadpathEntry;
import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.launching.ListenerList;
import org.rubypeople.rdt.internal.launching.RuntimeLoadpathEntry;
import org.rubypeople.rdt.internal.launching.RuntimeLoadpathEntryResolver;
+import org.rubypeople.rdt.internal.launching.RuntimeLoadpathProvider;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
public class RubyRuntime {
@@ -92,6 +105,14 @@
* @since 0.9.0
*/
public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS= "runtimeLoadpathEntryResolvers"; //$NON-NLS-1$
+
+ /**
+ * Simple identifier constant (value <code>"loadpathProviders"</code>) for the
+ * runtime loadpath providers extension point.
+ *
+ * @since 0.9.0
+ */
+ public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS= "loadpathProviders"; //$NON-NLS-1$
private static IVMInstallType[] fgVMTypes= null;
@@ -101,7 +122,25 @@
private static String fgDefaultVMId;
private static ListenerList fgVMListeners = new ListenerList(5);
private static String fgDefaultVMConnectorId;
+
+ /**
+ * Cache of already resolved projects in container entries. Used to avoid
+ * cycles in project dependencies when resolving classpath container entries.
+ * Counters used to know when entering/exiting to clear cache
+ */
+ private static ThreadLocal fgProjects = new ThreadLocal(); // Lists
+ private static ThreadLocal fgEntryCount = new ThreadLocal(); // Integers
+ /**
+ * Default loadpath provider.
+ */
+ private static IRuntimeLoadpathProvider fgDefaultClasspathProvider = new StandardLoadpathProvider();
+
+ /**
+ * Path providers keyed by id
+ */
+ private static Map fgPathProviders = null;
+
/**
* Set of IDs of VMs contributed via vmInstalls extension point.
*/
@@ -946,5 +985,612 @@
IPath path) {
ILoadpathEntry cpe = RubyCore.newVariableEntry(path);
return newRuntimeLoadpathEntry(cpe);
+ }
+
+ /**
+ * Computes and returns the unresolved class path for the given launch configuration.
+ * Variable and container entries are unresolved.
+ *
+ * @param configuration launch configuration
+ * @return unresolved runtime classpath entries
+ * @throws CoreException
+ * @exception CoreException if unable to compute the classpath
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry[] computeUnresolvedRuntimeLoadpath(
+ ILaunchConfiguration configuration) throws CoreException {
+ return getLoadpathProvider(configuration).computeUnresolvedLoadpath(configuration);
}
+
+ /**
+ * Returns the classpath provider for the given launch configuration.
+ *
+ * @param configuration launch configuration
+ * @return classpath provider
+ * @exception CoreException if unable to resolve the path provider
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathProvider getLoadpathProvider(ILaunchConfiguration configuration) throws CoreException {
+ String providerId = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, (String)null);
+ IRuntimeLoadpathProvider provider = null;
+ if (providerId == null) {
+ provider = fgDefaultClasspathProvider;
+ } else {
+ provider = (IRuntimeLoadpathProvider)getLoadpathProviders().get(providerId);
+ if (provider == null) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_26, new String[]{providerId}), null);
+ }
+ }
+ return provider;
+ }
+
+ /**
+ * Returns all registered classpath providers.
+ */
+ private static Map getLoadpathProviders() {
+ if (fgPathProviders == null) {
+ initializeProviders();
+ }
+ return fgPathProviders;
+ }
+
+ private static void initializeProviders() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, EXTENSION_POINT_RUNTIME_CLASSPATH_PROVIDERS);
+ IConfigurationElement[] extensions = point.getConfigurationElements();
+ fgPathProviders = new HashMap(extensions.length);
+ for (int i = 0; i < extensions.length; i++) {
+ RuntimeLoadpathProvider res = new RuntimeLoadpathProvider(extensions[i]);
+ fgPathProviders.put(res.getIdentifier(), res);
+ }
+ }
+
+ /**
+ * Returns a runtime classpath entry constructed from the given memento.
+ *
+ * @param memento a memento for a runtime classpath entry
+ * @return runtime classpath entry
+ * @exception CoreException if unable to construct a runtime classpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newRuntimeLoadpathEntry(String memento) throws CoreException {
+ try {
+ Element root = null;
+ DocumentBuilder parser = LaunchingPlugin.getParser();
+ StringReader reader = new StringReader(memento);
+ InputSource source = new InputSource(reader);
+ root = parser.parse(source).getDocumentElement();
+
+ String id = root.getAttribute("id"); //$NON-NLS-1$
+ if (id == null || id.length() == 0) {
+ // assume an old format
+ return new RuntimeLoadpathEntry(root);
+ }
+ // get the extension & create a new one
+ IRuntimeLoadpathEntry2 entry = LaunchingPlugin.getDefault().newRuntimeLoadpathEntry(id);
+ NodeList list = root.getChildNodes();
+ for (int i = 0; i < list.getLength(); i++) {
+ Node node = list.item(i);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element)node;
+ if ("memento".equals(element.getNodeName())) { //$NON-NLS-1$
+ entry.initializeFrom(element);
+ }
+ }
+ }
+ return entry;
+ } catch (SAXException e) {
+ abort(LaunchingMessages.JavaRuntime_31, e);
+ } catch (IOException e) {
+ abort(LaunchingMessages.JavaRuntime_32, e);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a runtime classpath entry identifying the JRE to use when launching the specified
+ * configuration or <code>null</code> if none is specified. The entry returned represents a
+ * either a classpath variable or classpath container that resolves to a JRE.
+ * <p>
+ * The entry is resolved as follows:
+ * <ol>
+ * <li>If the <code>ATTR_JRE_CONTAINER_PATH</code> is present, it is used to create
+ * a classpath container referring to a JRE.</li>
+ * <li>Next, if the <code>ATTR_VM_INSTALL_TYPE</code> and <code>ATTR_VM_INSTALL_NAME</code>
+ * attributes are present, they are used to create a classpath container.</li>
+ * <li>When none of the above attributes are specified, a default entry is
+ * created which refers to the JRE referenced by the build path of the configuration's
+ * associated Java project. This could be a classpath variable or classpath container.</li>
+ * <li>When there is no Java project associated with a configuration, the workspace
+ * default JRE is used to create a container path.</li>
+ * </ol>
+ * </p>
+ * @param configuration
+ * @return classpath container path identifying a JRE or <code>null</code>
+ * @exception org.eclipse.core.runtime.CoreException if an exception occurs retrieving
+ * attributes from the specified launch configuration
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry computeJREEntry(ILaunchConfiguration configuration) throws CoreException {
+ String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null);
+ IPath containerPath = null;
+ if (jreAttr == null) {
+ String type = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null);
+ if (type == null) {
+ // default JRE for the launch configuration
+ IRubyProject proj = getRubyProject(configuration);
+ if (proj == null) {
+ containerPath = newDefaultJREContainerPath();
+ } else {
+ return computeJREEntry(proj);
+ }
+ } else {
+ String name = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String)null);
+ if (name != null) {
+ containerPath = newDefaultJREContainerPath().append(type).append(name);
+ }
+ }
+ } else {
+ containerPath = Path.fromPortableString(jreAttr);
+ }
+ if (containerPath != null) {
+ return newRuntimeContainerLoadpathEntry(containerPath, IRuntimeLoadpathEntry.STANDARD_CLASSES);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a runtime classpath entry identifying the JRE referenced by the specified
+ * project, or <code>null</code> if none. The entry returned represents a either a
+ * classpath variable or classpath container that resolves to a JRE.
+ *
+ * @param project Java project
+ * @return JRE runtime classpath entry or <code>null</code>
+ * @exception org.eclipse.core.runtime.CoreException if an exception occurs
+ * accessing the project's classpath
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry computeJREEntry(IRubyProject project) throws CoreException {
+ ILoadpathEntry[] rawClasspath = project.getRawLoadpath();
+ IRuntimeLoadpathEntryResolver2 resolver = null;
+ for (int i = 0; i < rawClasspath.length; i++) {
+ ILoadpathEntry entry = rawClasspath[i];
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_VARIABLE:
+ resolver = getVariableResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ if (resolver.isVMInstallReference(entry)) {
+ return newRuntimeLoadpathEntry(entry);
+ }
+ }
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ resolver = getContainerResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ if (resolver.isVMInstallReference(entry)) {
+ ILoadpathContainer container = RubyCore.getLoadpathContainer(entry.getPath(), project);
+ if (container != null) {
+ switch (container.getKind()) {
+ case ILoadpathContainer.K_APPLICATION:
+ break;
+ case ILoadpathContainer.K_DEFAULT_SYSTEM:
+ return newRuntimeContainerLoadpathEntry(entry.getPath(), IRuntimeLoadpathEntry.STANDARD_CLASSES);
+ case ILoadpathContainer.K_SYSTEM:
+ return newRuntimeContainerLoadpathEntry(entry.getPath(), IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES);
+ }
+ }
+ }
+ }
+ break;
+ }
+
+ }
+ return null;
+ }
+
+ /**
+ * Returns a path for the JRE classpath container identifying the
+ * default VM install.
+ *
+ * @return classpath container path
+ * @since 0.9.0
+ */
+ public static IPath newDefaultJREContainerPath() {
+ return new Path(RUBY_CONTAINER);
+ }
+
+ /**
+ * Returns a runtime classpath entry for the given container path with the given
+ * classpath property.
+ *
+ * @param path container path
+ * @param classpathProperty the type of entry - one of <code>USER_CLASSES</code>,
+ * <code>BOOTSTRAP_CLASSES</code>, or <code>STANDARD_CLASSES</code>
+ * @return runtime classpath entry
+ * @exception CoreException if unable to construct a runtime classpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int classpathProperty) throws CoreException {
+ return newRuntimeContainerLoadpathEntry(path, classpathProperty, null);
+ }
+
+ /**
+ * Computes and returns the default unresolved runtime classpath for the
+ * given project.
+ *
+ * @return runtime classpath entries
+ * @exception CoreException if unable to compute the runtime classpath
+ * @see IRuntimeClasspathEntry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry[] computeUnresolvedRuntimeLoadpath(IRubyProject project) throws CoreException {
+ ILoadpathEntry[] entries = project.getRawLoadpath();
+ List classpathEntries = new ArrayList(3);
+ for (int i = 0; i < entries.length; i++) {
+ ILoadpathEntry entry = entries[i];
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_CONTAINER:
+ ILoadpathContainer container = RubyCore.getLoadpathContainer(entry.getPath(), project);
+ if (container != null) {
+ switch (container.getKind()) {
+ case ILoadpathContainer.K_APPLICATION:
+ // don't look at application entries
+ break;
+ case ILoadpathContainer.K_DEFAULT_SYSTEM:
+ classpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.STANDARD_CLASSES, project));
+ break;
+ case ILoadpathContainer.K_SYSTEM:
+ classpathEntries.add(newRuntimeContainerLoadpathEntry(container.getPath(), IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES, project));
+ break;
+ }
+ }
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ if (RUBYLIB_VARIABLE.equals(entry.getPath().segment(0))) {
+ IRuntimeLoadpathEntry jre = newVariableRuntimeLoadpathEntry(entry.getPath());
+ jre.setLoadpathProperty(IRuntimeLoadpathEntry.STANDARD_CLASSES);
+ classpathEntries.add(jre);
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ classpathEntries.add(newDefaultProjectLoadpathEntry(project));
+ return (IRuntimeLoadpathEntry[]) classpathEntries.toArray(new IRuntimeLoadpathEntry[classpathEntries.size()]);
+ }
+
+ /**
+ * Returns a new runtime classpath entry containing the default classpath
+ * for the specified Ruby project.
+ *
+ * @param project Ruby project
+ * @return runtime classpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newDefaultProjectLoadpathEntry(IRubyProject project) {
+ return new DefaultProjectLoadpathEntry(project);
+ }
+
+ /**
+ * Returns resolved entries for the given entry in the context of the given
+ * launch configuration. If the entry is of kind
+ * <code>VARIABLE</code> or <code>CONTAINER</code>, variable and container
+ * resolvers are consulted. If the entry is of kind <code>PROJECT</code>,
+ * and the associated Java project specifies non-default output locations,
+ * the corresponding output locations are returned. Otherwise, the given
+ * entry is returned.
+ * <p>
+ * If the given entry is a variable entry, and a resolver is not registered,
+ * the entry itself is returned. If the given entry is a container, and a
+ * resolver is not registered, resolved runtime classpath entries are calculated
+ * from the associated container classpath entries, in the context of the project
+ * associated with the given launch configuration.
+ * </p>
+ * @param entry runtime classpath entry
+ * @param configuration launch configuration
+ * @return resolved runtime classpath entry
+ * @exception CoreException if unable to resolve
+ * @see IRuntimeClasspathEntryResolver
+ * @since 2.0
+ */
+ public static IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
+ switch (entry.getType()) {
+ case IRuntimeLoadpathEntry.PROJECT:
+ // if the project has multiple output locations, they must be returned
+ IResource resource = entry.getResource();
+ if (resource instanceof IProject) {
+ IProject p = (IProject)resource;
+ IRubyProject project = RubyCore.create(p);
+ if (project == null || !p.isOpen() || !project.exists()) {
+ return new IRuntimeLoadpathEntry[0];
+ }
+ IRuntimeLoadpathEntry[] entries = resolveOutputLocations(project, entry.getLoadpathProperty());
+ if (entries != null) {
+ return entries;
+ }
+ } else {
+ // could not resolve project
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Classpath_references_non_existant_project___0__3, new String[]{entry.getPath().lastSegment()}), null);
+ }
+ break;
+ case IRuntimeLoadpathEntry.VARIABLE:
+ IRuntimeLoadpathEntryResolver resolver = getVariableResolver(entry.getVariableName());
+ if (resolver == null) {
+ IRuntimeLoadpathEntry[] resolved = resolveVariableEntry(entry, null, configuration);
+ if (resolved != null) {
+ return resolved;
+ }
+ break;
+ }
+ return resolver.resolveRuntimeLoadpathEntry(entry, configuration);
+ case IRuntimeLoadpathEntry.CONTAINER:
+ resolver = getContainerResolver(entry.getVariableName());
+ if (resolver == null) {
+ return computeDefaultContainerEntries(entry, configuration);
+ }
+ return resolver.resolveRuntimeLoadpathEntry(entry, configuration);
+ case IRuntimeLoadpathEntry.ARCHIVE:
+ // verify the archive exists
+ String location = entry.getLocation();
+ if (location == null) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Classpath_references_non_existant_archive___0__4, new String[]{entry.getPath().toString()}), null);
+ }
+ File file = new File(location);
+ if (!file.exists()) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Classpath_references_non_existant_archive___0__4, new String[]{entry.getPath().toString()}), null);
+ }
+ break;
+ case IRuntimeLoadpathEntry.OTHER:
+ resolver = getContributedResolver(((IRuntimeLoadpathEntry2)entry).getTypeId());
+ return resolver.resolveRuntimeLoadpathEntry(entry, configuration);
+ default:
+ break;
+ }
+ return new IRuntimeLoadpathEntry[] {entry};
+ }
+
+ /**
+ * Performs default resolution for a container entry.
+ * Delegates to the Ruby model.
+ */
+ private static IRuntimeLoadpathEntry[] computeDefaultContainerEntries(IRuntimeLoadpathEntry entry, ILaunchConfiguration config) throws CoreException {
+ IRubyProject project = entry.getRubyProject();
+ if (project == null) {
+ project = getRubyProject(config);
+ }
+ return computeDefaultContainerEntries(entry, project);
+ }
+
+ /**
+ * Performs default resolution for a container entry.
+ * Delegates to the Java model.
+ */
+ private static IRuntimeLoadpathEntry[] computeDefaultContainerEntries(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
+ if (project == null || entry == null) {
+ // cannot resolve without entry or project context
+ return new IRuntimeLoadpathEntry[0];
+ }
+ ILoadpathContainer container = RubyCore.getLoadpathContainer(entry.getPath(), project);
+ if (container == null) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Could_not_resolve_classpath_container___0__1, new String[]{entry.getPath().toString()}), null);
+ // execution will not reach here - exception will be thrown
+ return null;
+ }
+ ILoadpathEntry[] cpes = container.getLoadpathEntries();
+ int property = -1;
+ switch (container.getKind()) {
+ case ILoadpathContainer.K_APPLICATION:
+ property = IRuntimeLoadpathEntry.USER_CLASSES;
+ break;
+ case ILoadpathContainer.K_DEFAULT_SYSTEM:
+ property = IRuntimeLoadpathEntry.STANDARD_CLASSES;
+ break;
+ case ILoadpathContainer.K_SYSTEM:
+ property = IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES;
+ break;
+ }
+ List resolved = new ArrayList(cpes.length);
+ List projects = (List) fgProjects.get();
+ Integer count = (Integer) fgEntryCount.get();
+ if (projects == null) {
+ projects = new ArrayList();
+ fgProjects.set(projects);
+ count = new Integer(0);
+ }
+ int intCount = count.intValue();
+ intCount++;
+ fgEntryCount.set(new Integer(intCount));
+ try {
+ for (int i = 0; i < cpes.length; i++) {
+ ILoadpathEntry cpe = cpes[i];
+ if (cpe.getEntryKind() == ILoadpathEntry.CPE_PROJECT) {
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(cpe.getPath().segment(0));
+ IRubyProject jp = RubyCore.create(p);
+ if (!projects.contains(jp)) {
+ projects.add(jp);
+ IRuntimeLoadpathEntry classpath = newDefaultProjectLoadpathEntry(jp);
+ IRuntimeLoadpathEntry[] entries = resolveRuntimeLoadpathEntry(classpath, jp);
+ for (int j = 0; j < entries.length; j++) {
+ IRuntimeLoadpathEntry e = entries[j];
+ if (!resolved.contains(e)) {
+ resolved.add(entries[j]);
+ }
+ }
+ }
+ } else {
+ IRuntimeLoadpathEntry e = newRuntimeLoadpathEntry(cpe);
+ if (!resolved.contains(e)) {
+ resolved.add(e);
+ }
+ }
+ }
+ } finally {
+ intCount--;
+ if (intCount == 0) {
+ fgProjects.set(null);
+ fgEntryCount.set(null);
+ } else {
+ fgEntryCount.set(new Integer(intCount));
+ }
+ }
+ // set classpath property
+ IRuntimeLoadpathEntry[] result = new IRuntimeLoadpathEntry[resolved.size()];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = (IRuntimeLoadpathEntry) resolved.get(i);
+ result[i].setLoadpathProperty(property);
+ }
+ return result;
+ }
+
+ /**
+ * Default resolution for a classpath variable - resolve to an archive. Only
+ * one of project/configuration can be non-null.
+ *
+ * @param entry
+ * @param project the project context or <code>null</code>
+ * @param configuration configuration context or <code>null</code>
+ * @return IRuntimeLoadpathEntry[]
+ * @throws CoreException
+ */
+ private static IRuntimeLoadpathEntry[] resolveVariableEntry(IRuntimeLoadpathEnt...
[truncated message content] |
|
From: <caw...@us...> - 2007-01-19 19:13:48
|
Revision: 1816
http://svn.sourceforge.net/rubyeclipse/?rev=1816&view=rev
Author: cawilliams
Date: 2007-01-19 11:13:42 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
hey look at that, still not broken!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultProjectLoadpathEntry.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeContainerComparator.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultProjectLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultProjectLoadpathEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DefaultProjectLoadpathEntry.java 2007-01-19 19:13:42 UTC (rev 1816)
@@ -0,0 +1,352 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathContainer;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.LoadpathContainerInitializer;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IRuntimeContainerComparator;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.RubyRuntime;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Default user classpath entries for a Ruby project
+ */
+public class DefaultProjectLoadpathEntry extends AbstractRuntimeLoadpathEntry {
+
+ public static final String TYPE_ID = "org.eclipse.jdt.launching.classpathentry.defaultLoadpath"; //$NON-NLS-1$
+
+ /**
+ * Whether only exported entries should be on the runtime classpath.
+ * By default all entries are on the runtime classpath.
+ */
+ private boolean fExportedEntriesOnly = false;
+
+ /**
+ * Default constructor need to instantiate extensions
+ */
+ public DefaultProjectLoadpathEntry() {
+ }
+
+ /**
+ * Constructs a new classpath entry for the given project.
+ *
+ * @param project Ruby project
+ */
+ public DefaultProjectLoadpathEntry(IRubyProject project) {
+ setRubyProject(project);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.internal.launching.AbstractRuntimeLoadpathEntry#buildMemento(org.w3c.dom.Document, org.w3c.dom.Element)
+ */
+ protected void buildMemento(Document document, Element memento) throws CoreException {
+ memento.setAttribute("project", getRubyProject().getElementName()); //$NON-NLS-1$
+ memento.setAttribute("exportedEntriesOnly", Boolean.toString(fExportedEntriesOnly)); //$NON-NLS-1$
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#initializeFrom(org.w3c.dom.Element)
+ */
+ public void initializeFrom(Element memento) throws CoreException {
+ String name = memento.getAttribute("project"); //$NON-NLS-1$
+ if (name == null) {
+ abort(LaunchingMessages.DefaultProjectLoadpathEntry_3, null);
+ }
+ IRubyProject project = RubyCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject(name));
+ setRubyProject(project);
+ name = memento.getAttribute("exportedEntriesOnly"); //$NON-NLS-1$
+ if (name == null) {
+ fExportedEntriesOnly = false;
+ } else {
+ fExportedEntriesOnly = Boolean.valueOf(name).booleanValue();
+ }
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getTypeId()
+ */
+ public String getTypeId() {
+ return TYPE_ID;
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getType()
+ */
+ public int getType() {
+ return OTHER;
+ }
+
+ protected IProject getProject() {
+ return getRubyProject().getProject();
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getLocation()
+ */
+ public String getLocation() {
+ return getProject().getLocation().toOSString();
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getPath()
+ */
+ public IPath getPath() {
+ return getProject().getFullPath();
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getResource()
+ */
+ public IResource getResource() {
+ return getProject();
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getRuntimeLoadpathEntries(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] getRuntimeLoadpathEntries(ILaunchConfiguration configuration) throws CoreException {
+ ILoadpathEntry entry = RubyCore.newProjectEntry(getRubyProject().getProject().getFullPath());
+ List classpathEntries = new ArrayList(5);
+ List expanding = new ArrayList(5);
+ expandProject(entry, classpathEntries, expanding);
+ IRuntimeLoadpathEntry[] runtimeEntries = new IRuntimeLoadpathEntry[classpathEntries.size()];
+ for (int i = 0; i < runtimeEntries.length; i++) {
+ Object e = classpathEntries.get(i);
+ if (e instanceof ILoadpathEntry) {
+ ILoadpathEntry cpe = (ILoadpathEntry)e;
+ runtimeEntries[i] = new RuntimeLoadpathEntry(cpe);
+ } else {
+ runtimeEntries[i] = (IRuntimeLoadpathEntry)e;
+ }
+ }
+ // remove bootpath entries - this is a default user classpath
+ List ordered = new ArrayList(runtimeEntries.length);
+ for (int i = 0; i < runtimeEntries.length; i++) {
+ if (runtimeEntries[i].getLoadpathProperty() == IRuntimeLoadpathEntry.USER_CLASSES) {
+ ordered.add(runtimeEntries[i]);
+ }
+ }
+ return (IRuntimeLoadpathEntry[]) ordered.toArray(new IRuntimeLoadpathEntry[ordered.size()]);
+ }
+
+ /**
+ * Returns the transitive closure of classpath entries for the
+ * given project entry.
+ *
+ * @param projectEntry project classpath entry
+ * @param expandedPath a list of entries already expanded, should be empty
+ * to begin, and contains the result
+ * @param expanding a list of projects that have been or are currently being
+ * expanded (to detect cycles)
+ * @exception CoreException if unable to expand the classpath
+ */
+ private void expandProject(ILoadpathEntry projectEntry, List expandedPath, List expanding) throws CoreException {
+ expanding.add(projectEntry);
+ // 1. Get the raw classpath
+ // 2. Replace source folder entries with a project entry
+ IPath projectPath = projectEntry.getPath();
+ IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(projectPath.lastSegment());
+ if (res == null) {
+ // add project entry and return
+ expandedPath.add(projectEntry);
+ return;
+ }
+ IRubyProject project = (IRubyProject)RubyCore.create(res);
+ if (project == null || !project.getProject().isOpen() || !project.exists()) {
+ // add project entry and return
+ expandedPath.add(projectEntry);
+ return;
+ }
+
+ ILoadpathEntry[] buildPath = project.getRawLoadpath();
+ List unexpandedPath = new ArrayList(buildPath.length);
+ boolean projectAdded = false;
+ for (int i = 0; i < buildPath.length; i++) {
+ ILoadpathEntry classpathEntry = buildPath[i];
+ if (classpathEntry.getEntryKind() == ILoadpathEntry.CPE_SOURCE) {
+ if (!projectAdded) {
+ projectAdded = true;
+ unexpandedPath.add(projectEntry);
+ }
+ } else {
+ // add exported entires, as configured
+ if (classpathEntry.isExported()) {
+ unexpandedPath.add(classpathEntry);
+ } else if (!isExportedEntriesOnly() || project.equals(getRubyProject())) {
+ // add non exported entries from root project or if we are including all entries
+ unexpandedPath.add(classpathEntry);
+ }
+ }
+ }
+ // 3. expand each project entry (except for the root project)
+ // 4. replace each container entry with a runtime entry associated with the project
+ Iterator iter = unexpandedPath.iterator();
+ while (iter.hasNext()) {
+ ILoadpathEntry entry = (ILoadpathEntry)iter.next();
+ if (entry == projectEntry) {
+ expandedPath.add(entry);
+ } else {
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_PROJECT:
+ if (!expanding.contains(entry)) {
+ expandProject(entry, expandedPath, expanding);
+ }
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ ILoadpathContainer container = RubyCore.getLoadpathContainer(entry.getPath(), project);
+ int property = -1;
+ if (container != null) {
+ switch (container.getKind()) {
+ case ILoadpathContainer.K_APPLICATION:
+ property = IRuntimeLoadpathEntry.USER_CLASSES;
+ break;
+ case ILoadpathContainer.K_DEFAULT_SYSTEM:
+ property = IRuntimeLoadpathEntry.STANDARD_CLASSES;
+ break;
+ case ILoadpathContainer.K_SYSTEM:
+ property = IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES;
+ break;
+ }
+ IRuntimeLoadpathEntry r = RubyRuntime.newRuntimeContainerLoadpathEntry(entry.getPath(), property, project);
+ // check for duplicate/redundant entries
+ boolean duplicate = false;
+ LoadpathContainerInitializer initializer = RubyCore.getLoadpathContainerInitializer(r.getPath().segment(0));
+ for (int i = 0; i < expandedPath.size(); i++) {
+ Object o = expandedPath.get(i);
+ if (o instanceof IRuntimeLoadpathEntry) {
+ IRuntimeLoadpathEntry re = (IRuntimeLoadpathEntry)o;
+ if (re.getType() == IRuntimeLoadpathEntry.CONTAINER) {
+ if (container instanceof IRuntimeContainerComparator) {
+ duplicate = ((IRuntimeContainerComparator)container).isDuplicate(re.getPath());
+ } else {
+ LoadpathContainerInitializer initializer2 = RubyCore.getLoadpathContainerInitializer(re.getPath().segment(0));
+ Object id1 = null;
+ Object id2 = null;
+ if (initializer == null) {
+ id1 = r.getPath().segment(0);
+ } else {
+ id1 = initializer.getComparisonID(r.getPath(), project);
+ }
+ if (initializer2 == null) {
+ id2 = re.getPath().segment(0);
+ } else {
+ IRubyProject context = re.getRubyProject();
+ if (context == null) {
+ context = project;
+ }
+ id2 = initializer2.getComparisonID(re.getPath(), context);
+ }
+ if (id1 == null) {
+ duplicate = id2 == null;
+ } else {
+ duplicate = id1.equals(id2);
+ }
+ }
+ if (duplicate) {
+ break;
+ }
+ }
+ }
+ }
+ if (!duplicate) {
+ expandedPath.add(r);
+ }
+ }
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ if (entry.getPath().segment(0).equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ IRuntimeLoadpathEntry r = RubyRuntime.newVariableRuntimeLoadpathEntry(entry.getPath());
+ r.setLoadpathProperty(IRuntimeLoadpathEntry.STANDARD_CLASSES);
+ if (!expandedPath.contains(r)) {
+ expandedPath.add(r);
+ }
+ break;
+ }
+ // fall through if not the special RUBYLIB variable
+ default:
+ if (!expandedPath.contains(entry)) {
+ expandedPath.add(entry);
+ }
+ break;
+ }
+ }
+ }
+ return;
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#isComposite()
+ */
+ public boolean isComposite() {
+ return true;
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getName()
+ */
+ public String getName() {
+ if (isExportedEntriesOnly()) {
+ return MessageFormat.format(LaunchingMessages.DefaultProjectLoadpathEntry_2, new String[] {getRubyProject().getElementName()});
+ }
+ return MessageFormat.format(LaunchingMessages.DefaultProjectLoadpathEntry_4, new String[] {getRubyProject().getElementName()});
+ }
+ /* (non-Rubydoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof DefaultProjectLoadpathEntry) {
+ DefaultProjectLoadpathEntry entry = (DefaultProjectLoadpathEntry) obj;
+ return entry.getRubyProject().equals(getRubyProject()) &&
+ entry.isExportedEntriesOnly() == isExportedEntriesOnly();
+ }
+ return false;
+ }
+ /* (non-Rubydoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ return getRubyProject().hashCode();
+ }
+
+ /**
+ * Sets whether the runtime classpath computaion should only
+ * include exported entries in referenced projects.
+ *
+ * @param exportedOnly
+ * @since 3.2
+ */
+ public void setExportedEntriesOnly(boolean exportedOnly) {
+ fExportedEntriesOnly = exportedOnly;
+ }
+
+ /**
+ * Returns whether the classpath computation only includes exported
+ * entries in referenced projects.
+ *
+ * @return
+ * @since 3.2
+ */
+ public boolean isExportedEntriesOnly() {
+ return fExportedEntriesOnly;
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 19:08:37 UTC (rev 1815)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 19:13:42 UTC (rev 1816)
@@ -64,6 +64,9 @@
public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_archive_path_5;
public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6;
public static String RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8;
+ public static String DefaultProjectLoadpathEntry_4;
+ public static String DefaultProjectLoadpathEntry_2;
+ public static String DefaultProjectLoadpathEntry_3;
private LaunchingMessages() {}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeContainerComparator.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeContainerComparator.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeContainerComparator.java 2007-01-19 19:13:42 UTC (rev 1816)
@@ -0,0 +1,43 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import org.eclipse.core.runtime.IPath;
+
+/**
+ * Determines if container entries are duplicates/redundant on a runtime
+ * classpath. If an <code>IClasspathContianer</code> implements this interface,
+ * the <code>isDuplicate</code> method is used to determine if containers are
+ * duplicates/redundant. Otherwise, containers with the same identifier are
+ * considered duplicates.
+ *
+ * @since 2.0.1
+ * @deprecated support has been added to <code>ClasspathContainerInitializer</code>
+ * to handle comparison of classpath containers. Use
+ * <code>ClasspathContainerInitializer.getComparisonID(IPath,IJavaProject)</code>.
+ * When a classpath container implements this interface, this interface is
+ * used to determine equality before using the support defined in
+ * <code>ClasspathContainerInitializer</code>.
+ */
+public interface IRuntimeContainerComparator {
+
+ /**
+ * Returns whether this container is a duplicate of the container
+ * identified by the given path.
+ *
+ * @param containerPath the container to compare against
+ * @return whether this container is a duplicate of the container
+ * identified by the given path
+ */
+ public boolean isDuplicate(IPath containerPath);
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:08:37 UTC (rev 1815)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:13:42 UTC (rev 1816)
@@ -910,5 +910,41 @@
*/
private static IRuntimeLoadpathEntry newRuntimeLoadpathEntry(ILoadpathEntry entry) {
return new RuntimeLoadpathEntry(entry);
+ }
+
+ /**
+ * Returns a runtime classpath entry for the given container path with the given
+ * classpath property to be resolved in the context of the given Java project.
+ *
+ * @param path container path
+ * @param classpathProperty the type of entry - one of <code>USER_CLASSES</code>,
+ * <code>BOOTSTRAP_CLASSES</code>, or <code>STANDARD_CLASSES</code>
+ * @param project Java project context used for resolution, or <code>null</code>
+ * if to be resolved in the context of the launch configuration this entry
+ * is referenced in
+ * @return runtime classpath entry
+ * @exception CoreException if unable to construct a runtime classpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newRuntimeContainerLoadpathEntry(IPath path, int classpathProperty, IRubyProject project) throws CoreException {
+ ILoadpathEntry cpe = RubyCore.newContainerEntry(path);
+ RuntimeLoadpathEntry entry = new RuntimeLoadpathEntry(cpe, classpathProperty);
+ entry.setRubyProject(project);
+ return entry;
+ }
+
+ /**
+ * Returns a new runtime classpath entry for the classpath
+ * variable with the given path.
+ *
+ * @param path variable path; first segment is the name of the variable;
+ * trailing segments are appended to the resolved variable value
+ * @return runtime loadpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newVariableRuntimeLoadpathEntry(
+ IPath path) {
+ ILoadpathEntry cpe = RubyCore.newVariableEntry(path);
+ return newRuntimeLoadpathEntry(cpe);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 19:08:40
|
Revision: 1815
http://svn.sourceforge.net/rubyeclipse/?rev=1815&view=rev
Author: cawilliams
Date: 2007-01-19 11:08:37 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
yay for no broken builds!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/plugin.xml
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/AbstractRuntimeLoadpathEntry.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathEntry.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathResolver.java
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 19:03:28 UTC (rev 1814)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 19:08:37 UTC (rev 1815)
@@ -62,10 +62,10 @@
<extension
point="org.rubypeople.rdt.launching.runtimeLoadpathEntryResolvers">
<runtimeLoadpathEntryResolver
- container="org.rubypeople.rdt.launching.JRE_CONTAINER"
- variable="JRE_LIB"
- class="org.rubypeople.rdt.internal.launching.JRERuntimeLoadpathEntryResolver"
- id="org.rubypeople.rdt.launching.JRE_RESOLVER">
+ container="org.rubypeople.rdt.launching.RUBY_CONTAINER"
+ variable="RUBY_LIB"
+ class="org.rubypeople.rdt.internal.launching.RubyVMRuntimeLoadpathEntryResolver"
+ id="org.rubypeople.rdt.launching.RUBYVM_RESOLVER">
</runtimeLoadpathEntryResolver>
<runtimeLoadpathEntryResolver
runtimeLoadpathEntryId="org.rubypeople.rdt.launching.loadpathentry.variableLoadpathEntry"
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/AbstractRuntimeLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/AbstractRuntimeLoadpathEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/AbstractRuntimeLoadpathEntry.java 2007-01-19 19:08:37 UTC (rev 1815)
@@ -0,0 +1,233 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry2;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * Common function for runtime classpath entries.
+ * <p>
+ * Clients implementing runtime classpath entries must subclass this
+ * class.
+ * </p>
+ * @since 3.0
+ */
+public abstract class AbstractRuntimeLoadpathEntry extends PlatformObject implements IRuntimeLoadpathEntry2 {
+
+ private IPath sourceAttachmentPath = null;
+ private IPath rootSourcePath = null;
+ private int classpathProperty = IRuntimeLoadpathEntry.USER_CLASSES;
+ /**
+ * Associated ruby project, or <code>null</code>
+ */
+ private IRubyProject fRubyProject;
+
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>false</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.internal.launching.IRuntimeLoadpathEntry2#isComposite()
+ */
+ public boolean isComposite() {
+ return false;
+ }
+
+ /* (non-rubydoc)
+ *
+ * Default implementation returns an empty collection.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.internal.launching.IRuntimeLoadpathEntry2#getRuntimeLoadpathEntries()
+ */
+ public IRuntimeLoadpathEntry[] getRuntimeLoadpathEntries() throws CoreException {
+ return new IRuntimeLoadpathEntry[0];
+ }
+
+ /**
+ * Throws an exception with the given message and underlying exception.
+ *
+ * @param message error message
+ * @param exception underlying exception or <code>null</code> if none
+ * @throws CoreException
+ */
+ protected void abort(String message, Throwable exception) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR, message, exception);
+ throw new CoreException(status);
+ }
+
+ /* (non-rubydoc)
+ *
+ * Default implementation generates a string containing an XML
+ * document. Subclasses should override <code>buildMemento</code>
+ * to specify the contents of the required <code>memento</code>
+ * node.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getMemento()
+ */
+ public String getMemento() throws CoreException {
+ Document doc= DebugPlugin.newDocument();
+ Element root = doc.createElement("runtimeLoadpathEntry"); //$NON-NLS-1$
+ doc.appendChild(root);
+ root.setAttribute("id", getTypeId()); //$NON-NLS-1$
+ Element memento = doc.createElement("memento"); //$NON-NLS-1$
+ root.appendChild(memento);
+ buildMemento(doc, memento);
+ return DebugPlugin.serializeDocument(doc);
+ }
+
+ /**
+ * Constructs a memento for this classpath entry in the given
+ * document and element. The memento element has already been
+ * appended to the document.
+ *
+ * @param document XML document
+ * @param memento element node for client specific attributes
+ * @throws CoreException if unable to create a memento
+ */
+ protected abstract void buildMemento(Document document, Element memento) throws CoreException;
+
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getPath()
+ */
+ public IPath getPath() {
+ return null;
+ }
+
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getResource()
+ */
+ public IResource getResource() {
+ return null;
+ }
+
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getSourceAttachmentPath()
+ */
+ public IPath getSourceAttachmentPath() {
+ return sourceAttachmentPath;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#setSourceAttachmentPath(org.eclipse.core.runtime.IPath)
+ */
+ public void setSourceAttachmentPath(IPath path) {
+ sourceAttachmentPath = path;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getSourceAttachmentRootPath()
+ */
+ public IPath getSourceAttachmentRootPath() {
+ return rootSourcePath;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#setSourceAttachmentRootPath(org.eclipse.core.runtime.IPath)
+ */
+ public void setSourceAttachmentRootPath(IPath path) {
+ rootSourcePath = path;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getLoadpathProperty()
+ */
+ public int getLoadpathProperty() {
+ return classpathProperty;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#setLoadpathProperty(int)
+ */
+ public void setLoadpathProperty(int property) {
+ classpathProperty = property;
+ }
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getLocation()
+ */
+ public String getLocation() {
+ return null;
+ }
+
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getSourceAttachmentLocation()
+ */
+ public String getSourceAttachmentLocation() {
+ return null;
+ }
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getSourceAttachmentRootLocation()
+ */
+ public String getSourceAttachmentRootLocation() {
+ return null;
+ }
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getVariableName()
+ */
+ public String getVariableName() {
+ return null;
+ }
+ /* (non-rubydoc)
+ *
+ * Default implementation returns <code>null</code>.
+ * Subclasses should override if required.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getLoadpathEntry()
+ */
+ public ILoadpathEntry getLoadpathEntry() {
+ return null;
+ }
+ /* (non-rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getrubyProject()
+ */
+ public IRubyProject getRubyProject() {
+ return fRubyProject;
+ }
+
+ /**
+ * Sets the ruby project associated with this entry.
+ *
+ * @param javaProject
+ */
+ protected void setRubyProject(IRubyProject javaProject) {
+ fRubyProject = javaProject;
+ }
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathEntry.java 2007-01-19 19:08:37 UTC (rev 1815)
@@ -0,0 +1,120 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.rubypeople.rdt.internal.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+
+public class VariableLoadpathEntry extends AbstractRuntimeLoadpathEntry {
+ public static final String TYPE_ID = "org.rubypeople.rdt.launching.loadpathentry.variableLoadpathEntry"; //$NON-NLS-1$
+ private String variableString;
+
+ public VariableLoadpathEntry() {
+ }
+
+ public VariableLoadpathEntry(String variableString) {
+ this.variableString = variableString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.internal.launching.AbstractRuntimeLoadpathEntry#buildMemento(org.w3c.dom.Document, org.w3c.dom.Element)
+ */
+ protected void buildMemento(Document document, Element memento) throws CoreException {
+ memento.setAttribute("variableString", variableString); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#initializeFrom(org.w3c.dom.Element)
+ */
+ public void initializeFrom(Element memento) throws CoreException {
+ variableString = memento.getAttribute("variableString"); //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getTypeId()
+ */
+ public String getTypeId() {
+ return TYPE_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getRuntimeLoadpathEntries(org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] getRuntimeLoadpathEntries(ILaunchConfiguration configuration) throws CoreException {
+ return new IRuntimeLoadpathEntry[0];
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2#getName()
+ */
+ public String getName() {
+ return variableString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getType()
+ */
+ public int getType() {
+ return OTHER;
+ }
+ /**
+ * @return Returns the variableString.
+ */
+ public String getVariableString() {
+ return variableString;
+ }
+ /**
+ * @param variableString The variableString to set.
+ */
+ public void setVariableString(String variableString) {
+ this.variableString = variableString;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getPath()
+ */
+// public IPath getPath() {
+// try {
+// String path = StringVariableManager.getDefault().performStringSubstitution(variableString);
+// return new Path(path);
+// } catch (CoreException ce) {
+// return null;
+// }
+// }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode() {
+ if (variableString != null)
+ return variableString.hashCode();
+ return 0;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof VariableLoadpathEntry) {
+ VariableLoadpathEntry other= (VariableLoadpathEntry)obj;
+ if (variableString != null) {
+ return variableString.equals(other.variableString);
+ }
+ }
+ return false;
+ }
+
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathResolver.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VariableLoadpathResolver.java 2007-01-19 19:08:37 UTC (rev 1815)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.rubypeople.rdt.internal.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+
+public class VariableLoadpathResolver implements IRuntimeLoadpathEntryResolver {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(org.eclipse.jdt.launching.IRuntimeLoadpathEntry, org.eclipse.debug.core.ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
+ return resolveRuntimeLoadpathEntry(entry);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(org.eclipse.jdt.launching.IRuntimeLoadpathEntry, org.eclipse.jdt.core.IJavaProject)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
+ return resolveRuntimeLoadpathEntry(entry);
+ }
+
+ private IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry) throws CoreException{
+ String variableString = ((VariableLoadpathEntry)entry).getVariableString();
+ String strpath = VariablesPlugin.getDefault().getStringVariableManager().performStringSubstitution(variableString);
+ IPath path = new Path(strpath).makeAbsolute();
+ IRuntimeLoadpathEntry archiveEntry = RubyRuntime.newArchiveRuntimeLoadpathEntry(path);
+ return new IRuntimeLoadpathEntry[] { archiveEntry };
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver#resolveVMInstall(org.eclipse.jdt.core.ILoadpathEntry)
+ */
+ public IVMInstall resolveVMInstall(ILoadpathEntry entry) throws CoreException {
+ return null;
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:03:28 UTC (rev 1814)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:08:37 UTC (rev 1815)
@@ -37,6 +37,7 @@
import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.launching.ListenerList;
+import org.rubypeople.rdt.internal.launching.RuntimeLoadpathEntry;
import org.rubypeople.rdt.internal.launching.RuntimeLoadpathEntryResolver;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
@@ -884,4 +885,30 @@
private static IRubyModel getRubyModel() {
return RubyCore.create(ResourcesPlugin.getWorkspace().getRoot());
}
+
+ /**
+ * Returns a new runtime classpath entry for the given archive (possibly
+ * external).
+ *
+ * @param path absolute path to an archive
+ * @return runtime classpath entry
+ * @since 0.9.0
+ */
+ public static IRuntimeLoadpathEntry newArchiveRuntimeLoadpathEntry(IPath path) {
+ ILoadpathEntry cpe = RubyCore.newLibraryEntry(path);
+ return newRuntimeLoadpathEntry(cpe);
+ }
+
+ /**
+ * Returns a runtime classpath entry that corresponds to the given
+ * classpath entry. The classpath entry may not be of type <code>CPE_SOURCE</code>
+ * or <code>CPE_CONTAINER</code>.
+ *
+ * @param entry a classpath entry
+ * @return runtime classpath entry
+ * @since 0.9.0
+ */
+ private static IRuntimeLoadpathEntry newRuntimeLoadpathEntry(ILoadpathEntry entry) {
+ return new RuntimeLoadpathEntry(entry);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 19:03:29
|
Revision: 1814
http://svn.sourceforge.net/rubyeclipse/?rev=1814&view=rev
Author: cawilliams
Date: 2007-01-19 11:03:28 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
yay for no broken builds!
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.launching/plugin.xml
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntryResolver.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-19 18:38:07 UTC (rev 1813)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -1312,4 +1312,20 @@
RubyModelManager.getRubyModelManager().updateVariableValues(variableNames, paths, true/*update preferences*/, monitor);
}
+ public static ILoadpathEntry newProjectEntry(IPath fullPath) {
+ return newProjectEntry(fullPath, false);
+ }
+
+ public static ILoadpathEntry newVariableEntry(IPath path) {
+ return newVariableEntry(path, false);
+ }
+
+ public static ILoadpathEntry newContainerEntry(IPath path) {
+ return newContainerEntry(path, false);
+ }
+
+ public static ILoadpathEntry newLibraryEntry(IPath p) {
+ return newLibraryEntry(p, false);
+ }
+
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 18:38:07 UTC (rev 1813)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 19:03:28 UTC (rev 1814)
@@ -59,5 +59,30 @@
id="org.rubypeople.rdt.launching.RUBY_CONTAINER">
</loadpathContainerInitializer>
</extension>
+ <extension
+ point="org.rubypeople.rdt.launching.runtimeLoadpathEntryResolvers">
+ <runtimeLoadpathEntryResolver
+ container="org.rubypeople.rdt.launching.JRE_CONTAINER"
+ variable="JRE_LIB"
+ class="org.rubypeople.rdt.internal.launching.JRERuntimeLoadpathEntryResolver"
+ id="org.rubypeople.rdt.launching.JRE_RESOLVER">
+ </runtimeLoadpathEntryResolver>
+ <runtimeLoadpathEntryResolver
+ runtimeLoadpathEntryId="org.rubypeople.rdt.launching.loadpathentry.variableLoadpathEntry"
+ class="org.rubypeople.rdt.internal.launching.VariableLoadpathResolver"
+ id="org.rubypeople.rdt.launching.variableLoadpathResolver">
+ </runtimeLoadpathEntryResolver>
+ </extension>
+ <extension
+ point="org.rubypeople.rdt.launching.runtimeLoadpathEntries">
+ <runtimeLoadpathEntry
+ id="org.rubypeople.rdt.launching.loadpathentry.defaultLoadpath"
+ class="org.rubypeople.rdt.internal.launching.DefaultProjectLoadpathEntry">
+ </runtimeLoadpathEntry>
+ <runtimeLoadpathEntry
+ id="org.rubypeople.rdt.launching.loadpathentry.variableLoadpathEntry"
+ class="org.rubypeople.rdt.internal.launching.VariableLoadpathEntry">
+ </runtimeLoadpathEntry>
+ </extension>
</plugin>
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 18:38:07 UTC (rev 1813)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -44,6 +44,26 @@
public static String StandardVMRunner_Launching_VM____1;
public static String StandardVMRunner_Constructing_command_line____2;
public static String StandardVMRunner_Starting_virtual_machine____3;
+ public static String JavaLocalApplicationLaunchConfigurationDelegate_Creating_source_locator____2;
+ public static String JavaLocalApplicationLaunchConfigurationDelegate_Verifying_launch_attributes____1;
+ public static String AbstractJavaLaunchConfigurationDelegate_The_specified_JRE_installation_does_not_exist_4;
+ public static String AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_not_specified_for__0__5;
+ public static String AbstractJavaLaunchConfigurationDelegate_JRE_home_directory_for__0__does_not_exist___1__6;
+ public static String JavaLocalApplicationLaunchConfigurationDelegate_0;
+ public static String JavaRuntime_Specified_VM_install_type_does_not_exist___0__2;
+ public static String JavaRuntime_Specified_VM_install_not_found__type__0___name__1__2;
+ public static String JavaRuntime_VM_not_fully_specified_in_launch_configuration__0____missing_VM_name__Reverting_to_default_VM__1;
+ public static String JavaRuntime_28;
+ public static String JavaRuntime_Launch_configuration__0__references_non_existing_project__1___1;
+ public static String AbstractJavaLaunchConfigurationDelegate_Working_directory_does_not_exist___0__12;
+ public static String AbstractJavaLaunchConfigurationDelegate_Main_type_not_specified_11;
+ public static String RuntimeLoadpathEntry_Illegal_classpath_entry__0__1;
+ public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_type_2;
+ public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_location_3;
+ public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_project_name_4;
+ public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_archive_path_5;
+ public static String RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6;
+ public static String RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8;
private LaunchingMessages() {}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMRuntimeLoadpathEntryResolver.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -0,0 +1,208 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver2;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+/**
+ * Resolves for JRELIB_VARIABLE and JRE_CONTAINER
+ */
+public class RubyVMRuntimeLoadpathEntryResolver implements IRuntimeLoadpathEntryResolver2 {
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
+ IVMInstall jre = null;
+ if (entry.getType() == IRuntimeLoadpathEntry.CONTAINER && entry.getPath().segmentCount() > 1) {
+ // a specific VM
+ jre = RubyContainerInitializer.resolveInterpreter(entry.getPath());
+ } else {
+ // default VM for config
+ jre = RubyRuntime.computeVMInstall(configuration);
+ }
+ if (jre == null) {
+ // cannot resolve JRE
+ return new IRuntimeLoadpathEntry[0];
+ }
+ return resolveLibraryLocations(jre, entry.getLoadpathProperty());
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, IRubyProject)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
+ IVMInstall jre = null;
+ if (entry.getType() == IRuntimeLoadpathEntry.CONTAINER && entry.getPath().segmentCount() > 1) {
+ // a specific VM
+ jre = RubyContainerInitializer.resolveInterpreter(entry.getPath());
+ } else {
+ // default VM for project
+ jre = RubyRuntime.getVMInstall(project);
+ }
+ if (jre == null) {
+ // cannot resolve JRE
+ return new IRuntimeLoadpathEntry[0];
+ }
+ return resolveLibraryLocations(jre, entry.getLoadpathProperty());
+ }
+
+ /**
+ * Resolves libray locations for the given VM install
+ */
+ protected IRuntimeLoadpathEntry[] resolveLibraryLocations(IVMInstall vm, int kind) {
+ IPath[] libs = vm.getLibraryLocations();
+ IPath[] defaultLibs = vm.getVMInstallType().getDefaultLibraryLocations(vm.getInstallLocation());
+ boolean overrideRubydoc = false;
+ if (libs == null) {
+ // default system libs
+ libs = defaultLibs;
+ overrideRubydoc = true;
+ } else if (!isSameArchives(libs, defaultLibs)) {
+ // determine if bootpath should be explicit
+ kind = IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES;
+ }
+ if (kind == IRuntimeLoadpathEntry.BOOTSTRAP_CLASSES) {
+ File vmInstallLocation= vm.getInstallLocation();
+ if (vmInstallLocation != null) {
+ LibraryInfo libraryInfo= LaunchingPlugin.getLibraryInfo(vmInstallLocation.getAbsolutePath());
+ if (libraryInfo != null) {
+ // only return endorsed and bootstrap classpath entries if we have the info
+ // libs in the ext dirs are not loaded by the boot class loader
+ String[] extensionDirsArray = libraryInfo.getExtensionDirs();
+ Set extensionDirsSet = new HashSet();
+ for (int i = 0; i < extensionDirsArray.length; i++) {
+ extensionDirsSet.add(extensionDirsArray[i]);
+ }
+ List resolvedEntries = new ArrayList(libs.length);
+ for (int i = 0; i < libs.length; i++) {
+ IPath location = libs[i];
+ IPath libraryPath = location;
+ String dir = libraryPath.toFile().getParent();
+ // exclude extension directory entries
+ if (!extensionDirsSet.contains(dir)) {
+ resolvedEntries.add(resolveLibraryLocation(vm, location, kind, overrideRubydoc));
+ }
+ }
+ return (IRuntimeLoadpathEntry[]) resolvedEntries.toArray(new IRuntimeLoadpathEntry[resolvedEntries.size()]);
+ }
+ }
+ }
+ List resolvedEntries = new ArrayList(libs.length);
+ for (int i = 0; i < libs.length; i++) {
+ IPath systemLibraryPath = libs[i];
+ if (systemLibraryPath.toFile().exists()) {
+ resolvedEntries.add(resolveLibraryLocation(vm, libs[i], kind, overrideRubydoc));
+ }
+ }
+ return (IRuntimeLoadpathEntry[]) resolvedEntries.toArray(new IRuntimeLoadpathEntry[resolvedEntries.size()]);
+ }
+
+ /**
+ * Return whether the given list of libraries refer to the same archives in the same
+ * order. Only considers the binary archive (not source or javadoc locations).
+ *
+ * @param libs
+ * @param defaultLibs
+ * @return whether the given list of libraries refer to the same archives in the same
+ * order
+ */
+ public static boolean isSameArchives(IPath[] libs, IPath[] defaultLibs) {
+ if (libs.length != defaultLibs.length) {
+ return false;
+ }
+ for (int i = 0; i < defaultLibs.length; i++) {
+ IPath def = defaultLibs[i];
+ IPath lib = libs[i];
+ if (!def.equals(lib)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveVMInstall(ILoadpathEntry)
+ */
+ public IVMInstall resolveVMInstall(ILoadpathEntry entry) {
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_VARIABLE:
+ if (entry.getPath().segment(0).equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ return RubyRuntime.getDefaultVMInstall();
+ }
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ if (entry.getPath().segment(0).equals(RubyRuntime.RUBY_CONTAINER)) {
+ return RubyContainerInitializer.resolveInterpreter(entry.getPath());
+ }
+ break;
+ default:
+ break;
+ }
+ return null;
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver2#isVMInstallReference(org.eclipse.jdt.core.ILoadpathEntry)
+ */
+ public boolean isVMInstallReference(ILoadpathEntry entry) {
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_VARIABLE:
+ if (entry.getPath().segment(0).equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ return true;
+ }
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ if (entry.getPath().segment(0).equals(RubyRuntime.RUBY_CONTAINER)) {
+ return true;
+ }
+ break;
+ default:
+ break;
+ }
+ return false;
+ }
+
+ /**
+ * Returns a runtime classpath entry for the given library in the specified VM.
+ *
+ * @param vm
+ * @param location
+ * @param kind
+ * @return runtime classpath entry
+ * @since 0.9.0
+ */
+ private IRuntimeLoadpathEntry resolveLibraryLocation(IVMInstall vm, IPath location, int kind, boolean overrideRubyDoc) {
+ IPath libraryPath = location;
+ ILoadpathEntry cpe = RubyCore.newLibraryEntry(libraryPath, false);
+ IRuntimeLoadpathEntry resolved = new RuntimeLoadpathEntry(cpe);
+ resolved.setLoadpathProperty(kind);
+ return resolved;
+ }
+
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntry.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -0,0 +1,555 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * BEA - Daniel R Somerfield - Bug 88939
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+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.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.LoadpathContainerInitializer;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.core.RubyModelException;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.RubyRuntime;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/**
+ * An entry on the runtime classpath that the user can manipulate
+ * and share in a launch configuration.
+ *
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry
+ * @since 2.0
+ */
+public class RuntimeLoadpathEntry implements IRuntimeLoadpathEntry {
+
+ /**
+ * This entry's type - must be set on creation.
+ */
+ private int fType = -1;
+
+ /**
+ * This entry's classpath property.
+ */
+ private int fLoadpathProperty = -1;
+
+ /**
+ * This entry's associated build path entry.
+ */
+ private ILoadpathEntry fLoadpathEntry = null;
+
+ /**
+ * The entry's resolved entry (lazily initialized)
+ */
+ private ILoadpathEntry fResolvedEntry = null;
+
+ /**
+ * Associated Ruby project, or <code>null</code>
+ */
+ private IRubyProject fRubyProject = null;
+
+ /**
+ * The path if the entry was invalid and fLoadpathEntry is null
+ */
+ private IPath fInvalidPath;
+
+ /**
+ * Constructs a new runtime classpath entry based on the
+ * (build) classpath entry.
+ *
+ * @param entry the associated classpath entry
+ */
+ public RuntimeLoadpathEntry(ILoadpathEntry entry) {
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_PROJECT:
+ setType(PROJECT);
+ break;
+ case ILoadpathEntry.CPE_LIBRARY:
+ setType(ARCHIVE);
+ break;
+ case ILoadpathEntry.CPE_VARIABLE:
+ setType(VARIABLE);
+ break;
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(LaunchingMessages.RuntimeLoadpathEntry_Illegal_classpath_entry__0__1, new String[] {entry.toString()}));
+ }
+ setLoadpathEntry(entry);
+ initializeLoadpathProperty();
+ }
+
+ /**
+ * Constructs a new container entry in the context of the given project
+ *
+ * @param entry classpath entry
+ * @param classpathProperty this entry's classpath property
+ */
+ public RuntimeLoadpathEntry(ILoadpathEntry entry, int classpathProperty) {
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_CONTAINER:
+ setType(CONTAINER);
+ break;
+ default:
+ throw new IllegalArgumentException(MessageFormat.format(LaunchingMessages.RuntimeLoadpathEntry_Illegal_classpath_entry__0__1, new String[] {entry.toString()}));
+ }
+ setLoadpathEntry(entry);
+ setLoadpathProperty(classpathProperty);
+ }
+
+ /**
+ * Reconstructs a runtime classpath entry from the given
+ * XML document root not.
+ *
+ * @param root a memento root doc element created by this class
+ * @exception CoreException if unable to restore from the given memento
+ */
+ public RuntimeLoadpathEntry(Element root) throws CoreException {
+ try {
+ setType(Integer.parseInt(root.getAttribute("type"))); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_type_2, e);
+ }
+ try {
+ setLoadpathProperty(Integer.parseInt(root.getAttribute("path"))); //$NON-NLS-1$
+ } catch (NumberFormatException e) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry_location_3, e);
+ }
+
+ // source attachment
+ IPath sourcePath = null;
+ IPath rootPath = null;
+ String path = root.getAttribute("sourceAttachmentPath"); //$NON-NLS-1$
+ if (path != null && path.length() > 0) {
+ sourcePath = new Path(path);
+ }
+ path = root.getAttribute("sourceRootPath"); //$NON-NLS-1$
+ if (path != null && path.length() > 0) {
+ rootPath = new Path(path);
+ }
+
+ switch (getType()) {
+ case PROJECT :
+ String name = root.getAttribute("projectName"); //$NON-NLS-1$
+ if (isEmpty(name)) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_project_name_4, null);
+ } else {
+ IProject proj = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ setLoadpathEntry(RubyCore.newProjectEntry(proj.getFullPath()));
+ }
+ break;
+ case ARCHIVE :
+ path = root.getAttribute("externalArchive"); //$NON-NLS-1$
+ if (isEmpty(path)) {
+ // internal
+ path = root.getAttribute("internalArchive"); //$NON-NLS-1$
+ if (isEmpty(path)) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_archive_path_5, null);
+ } else {
+ setLoadpathEntry(createLibraryEntry(sourcePath, rootPath, path));
+ }
+ } else {
+ // external
+ setLoadpathEntry(createLibraryEntry(sourcePath, rootPath, path));
+ }
+ break;
+ case VARIABLE :
+ String var = root.getAttribute("containerPath"); //$NON-NLS-1$
+ if (isEmpty(var)) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6, null);
+ } else {
+ setLoadpathEntry(RubyCore.newVariableEntry(new Path(var)));
+ }
+ break;
+ case CONTAINER :
+ var = root.getAttribute("containerPath"); //$NON-NLS-1$
+ if (isEmpty(var)) {
+ abort(LaunchingMessages.RuntimeLoadpathEntry_Unable_to_recover_runtime_class_path_entry___missing_variable_name_6, null);
+ } else {
+ setLoadpathEntry(RubyCore.newContainerEntry(new Path(var)));
+ }
+ break;
+ }
+
+ String name = root.getAttribute("rubyProject"); //$NON-NLS-1$
+ if (isEmpty(name)) {
+ fRubyProject = null;
+ } else {
+ IProject project2 = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ fRubyProject = RubyCore.create(project2);
+ }
+ }
+
+ private ILoadpathEntry createLibraryEntry(IPath sourcePath, IPath rootPath, String path) {
+ Path p = new Path(path);
+ if (!p.isAbsolute())
+ {
+ fInvalidPath = p;
+ return null;
+ //abort("There was a problem with path \" " + path + "\": paths must be absolute.", null);
+ }
+ return RubyCore.newLibraryEntry(p);
+ }
+
+ /**
+ * Throws an internal error exception
+ */
+ protected void abort(String message, Throwable e) throws CoreException {
+ IStatus s = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR, message, e);
+ throw new CoreException(s);
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getType()
+ */
+ public int getType() {
+ return fType;
+ }
+
+ /**
+ * Sets this entry's type
+ *
+ * @param type this entry's type
+ */
+ private void setType(int type) {
+ fType = type;
+ }
+
+ /**
+ * Sets the classpath entry associated with this runtime classpath entry.
+ * Clears the cache of the resolved entry.
+ *
+ * @param entry the classpath entry associated with this runtime classpath entry
+ */
+ private void setLoadpathEntry(ILoadpathEntry entry) {
+ fLoadpathEntry = entry;
+ fResolvedEntry = null;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getLoadpathEntry()
+ */
+ public ILoadpathEntry getLoadpathEntry() {
+ return fLoadpathEntry;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getMemento()
+ */
+ public String getMemento() throws CoreException {
+
+ Document doc;
+ try {
+ doc = LaunchingPlugin.getDocument();
+ } catch (ParserConfigurationException e) {
+ IStatus status = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR, LaunchingMessages.RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8, e);
+ throw new CoreException(status);
+ }
+ Element node = doc.createElement("runtimeLoadpathEntry"); //$NON-NLS-1$
+ doc.appendChild(node);
+ node.setAttribute("type", (new Integer(getType())).toString()); //$NON-NLS-1$
+ node.setAttribute("path", (new Integer(getLoadpathProperty())).toString()); //$NON-NLS-1$
+ switch (getType()) {
+ case PROJECT :
+ node.setAttribute("projectName", getPath().lastSegment()); //$NON-NLS-1$
+ break;
+ case ARCHIVE :
+ IResource res = getResource();
+ if (res == null) {
+ node.setAttribute("externalArchive", getPath().toString()); //$NON-NLS-1$
+ } else {
+ node.setAttribute("internalArchive", res.getFullPath().toString()); //$NON-NLS-1$
+ }
+ break;
+ case VARIABLE :
+ case CONTAINER :
+ node.setAttribute("containerPath", getPath().toString()); //$NON-NLS-1$
+ break;
+ }
+ if (getRubyProject() != null) {
+ node.setAttribute("rubyProject", getRubyProject().getElementName()); //$NON-NLS-1$
+ }
+ try {
+ return LaunchingPlugin.serializeDocument(doc);
+ } catch (IOException e) {
+ IStatus status = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR, LaunchingMessages.RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8, e);
+ throw new CoreException(status);
+ } catch (TransformerException e) {
+ IStatus status = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR, LaunchingMessages.RuntimeLoadpathEntry_An_exception_occurred_generating_runtime_classpath_memento_8, e);
+ throw new CoreException(status);
+ }
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getPath()
+ */
+ public IPath getPath() {
+ ILoadpathEntry entry = getLoadpathEntry();
+ return entry != null ? entry.getPath() : fInvalidPath;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getResource()
+ */
+ public IResource getResource() {
+ switch (getType()) {
+ case CONTAINER:
+ case VARIABLE:
+ return null;
+ default:
+ return getResource(getPath());
+ }
+ }
+
+ /**
+ * Returns the resource in the workspace assciated with the given
+ * absolute path, or <code>null</code> if none. The path may have
+ * a device.
+ *
+ * @param path absolute path, or <code>null</code>
+ * @return resource or <code>null</code>
+ */
+ protected IResource getResource(IPath path) {
+ if (path != null) {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if (path.getDevice() == null) {
+ // search relative to the workspace if no device present
+ return root.findMember(path);
+ }
+ // look for files or folders with the given path
+ IFile[] files = root.findFilesForLocation(path);
+ if (files.length > 0) {
+ return files[0];
+ }
+ IContainer[] containers = root.findContainersForLocation(path);
+ if (containers.length > 0) {
+ return containers[0];
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Initlaizes the classpath property based on this entry's type.
+ */
+ private void initializeLoadpathProperty() {
+ switch (getType()) {
+ case VARIABLE:
+ if (getVariableName().equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ setLoadpathProperty(STANDARD_CLASSES);
+ } else {
+ setLoadpathProperty(USER_CLASSES);
+ }
+ break;
+ case PROJECT:
+ case ARCHIVE:
+ setLoadpathProperty(USER_CLASSES);
+ break;
+ default:
+ break;
+ }
+ }
+
+
+ /**
+ * @see IRuntimeLoadpathEntry#setLoadpathProperty(int)
+ */
+ public void setLoadpathProperty(int location) {
+ fLoadpathProperty = location;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#setLoadpathProperty(int)
+ */
+ public int getLoadpathProperty() {
+ return fLoadpathProperty;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getLocation()
+ */
+ public String getLocation() {
+
+ IPath path = null;
+ switch (getType()) {
+ case PROJECT :
+ IRubyProject pro = (IRubyProject) RubyCore.create(getResource());
+ if (pro != null) {
+ path = pro.getPath();
+ }
+ break;
+ case ARCHIVE :
+ path = getPath();
+ break;
+ case VARIABLE :
+ ILoadpathEntry resolved = getResolvedLoadpathEntry();
+ if (resolved != null) {
+ path = resolved.getPath();
+ }
+ break;
+ case CONTAINER :
+ break;
+ }
+ return resolveToOSPath(path);
+ }
+
+ /**
+ * Returns the OS path for the given aboslute or workspace relative path
+ */
+ protected String resolveToOSPath(IPath path) {
+ if (path != null) {
+ IResource res = null;
+ if (path.getDevice() == null) {
+ // if there is no device specified, find the resource
+ res = getResource(path);
+ }
+ if (res == null) {
+ return path.toOSString();
+ }
+ IPath location = res.getLocation();
+ if (location != null) {
+ return location.toOSString();
+ }
+ }
+ return null;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntry#getVariableName()
+ */
+ public String getVariableName() {
+ if (getType() == IRuntimeLoadpathEntry.VARIABLE || getType() == IRuntimeLoadpathEntry.CONTAINER) {
+ return getPath().segment(0);
+ }
+ return null;
+ }
+
+ /**
+ * @see Object#equals(Object)
+ */
+ public boolean equals(Object obj) {
+ if (obj instanceof IRuntimeLoadpathEntry) {
+ IRuntimeLoadpathEntry r = (IRuntimeLoadpathEntry)obj;
+ if (getType() == r.getType() && getLoadpathProperty() == r.getLoadpathProperty()) {
+ if (getType() == IRuntimeLoadpathEntry.CONTAINER) {
+ String id = getPath().segment(0);
+ LoadpathContainerInitializer initializer = RubyCore.getLoadpathContainerInitializer(id);
+ IRubyProject javaProject1 = getRubyProject();
+ IRubyProject javaProject2 = r.getRubyProject();
+ if (initializer == null || javaProject1 == null || javaProject2 == null) {
+ // containers are equal if their ID is equal by default
+ return getPath().equals(r.getPath());
+ }
+ Object comparisonID1 = initializer.getComparisonID(getPath(), javaProject1);
+ Object comparisonID2 = initializer.getComparisonID(r.getPath(), javaProject2);
+ return comparisonID1.equals(comparisonID2);
+ } else {
+ return getPath() != null && getPath().equals(r.getPath());
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns whether the given objects are equal, accounting for null
+ */
+ protected boolean equal(Object one, Object two) {
+ if (one == null) {
+ return two == null;
+ }
+ return one.equals(two);
+ }
+
+ /**
+ * @see Object#hashCode()
+ */
+ public int hashCode() {
+ if (getType() == CONTAINER) {
+ return getPath().segment(0).hashCode() + getType();
+ }
+ return getPath().hashCode() + getType();
+ }
+
+ /**
+ * Creates a new underlying classpath entry for this runtime classpath entry
+ * with the given paths, due to a change in source attachment.
+ */
+ protected void updateLoadpathEntry(IPath path, IPath sourcePath, IPath rootPath) {
+ ILoadpathEntry entry = null;
+ ILoadpathEntry original = getLoadpathEntry();
+ switch (getType()) {
+ case ARCHIVE:
+ entry = RubyCore.newLibraryEntry(path, original.isExported());
+ break;
+ case VARIABLE:
+ entry = RubyCore.newVariableEntry(path);
+ break;
+ default:
+ return;
+ }
+ setLoadpathEntry(entry);
+ }
+
+ /**
+ * Returns the resolved classpath entry associated with this runtime
+ * entry, resolving if required.
+ */
+ protected ILoadpathEntry getResolvedLoadpathEntry() {
+ if (fResolvedEntry == null) {
+ fResolvedEntry = RubyCore.getResolvedLoadpathEntry(getLoadpathEntry());
+ }
+ return fResolvedEntry;
+ }
+
+ protected boolean isEmpty(String string) {
+ return string == null || string.length() == 0;
+ }
+
+ public String toString() {
+ if (fLoadpathEntry != null) {
+ return fLoadpathEntry.toString();
+ }
+ return super.toString();
+
+ }
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry#getRubyProject()
+ */
+ public IRubyProject getRubyProject() {
+ return fRubyProject;
+ }
+
+ /**
+ * Sets the Ruby project associated with this classpath entry.
+ *
+ * @param project Ruby project
+ */
+ public void setRubyProject(IRubyProject project) {
+ fRubyProject = project;
+ }
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntryResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntryResolver.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RuntimeLoadpathEntryResolver.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntry;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver;
+import org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver2;
+import org.rubypeople.rdt.launching.IVMInstall;
+
+/**
+ * Proxy to a runtime classpath entry resolver extension.
+ */
+public class RuntimeLoadpathEntryResolver implements IRuntimeLoadpathEntryResolver2 {
+
+ private IConfigurationElement fConfigurationElement;
+
+ private IRuntimeLoadpathEntryResolver fDelegate;
+
+ /**
+ * Constructs a new resolver on the given configuration element
+ */
+ public RuntimeLoadpathEntryResolver(IConfigurationElement element) {
+ fConfigurationElement = element;
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, ILaunchConfiguration)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException {
+ return getResolver().resolveRuntimeLoadpathEntry(entry, configuration);
+ }
+
+ /**
+ * Returns the resolver delegate (and creates if required)
+ */
+ protected IRuntimeLoadpathEntryResolver getResolver() throws CoreException {
+ if (fDelegate == null) {
+ fDelegate = (IRuntimeLoadpathEntryResolver)fConfigurationElement.createExecutableExtension("class"); //$NON-NLS-1$
+ }
+ return fDelegate;
+ }
+
+ /**
+ * Returns the variable name this resolver is registered for, or <code>null</code>
+ */
+ public String getVariableName() {
+ return fConfigurationElement.getAttribute("variable"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the container id this resolver is registered for, or <code>null</code>
+ */
+ public String getContainerId() {
+ return fConfigurationElement.getAttribute("container"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the runtime classpath entry id this resolver is registered
+ * for,or <code>null</code> if none.
+ */
+ public String getRuntimeLoadpathEntryId() {
+ return fConfigurationElement.getAttribute("runtimeLoadpathEntryId"); //$NON-NLS-1$
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveVMInstall(ILoadpathEntry)
+ */
+ public IVMInstall resolveVMInstall(ILoadpathEntry entry) throws CoreException {
+ return getResolver().resolveVMInstall(entry);
+ }
+
+ /**
+ * @see IRuntimeLoadpathEntryResolver#resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry, IRubyProject)
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException {
+ return getResolver().resolveRuntimeLoadpathEntry(entry, project);
+ }
+
+ /* (non-Rubydoc)
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntryResolver2#isVMInstallReference(org.eclipse.jdt.core.ILoadpathEntry)
+ */
+ public boolean isVMInstallReference(ILoadpathEntry entry) {
+ try {
+ IRuntimeLoadpathEntryResolver resolver = getResolver();
+ if (resolver instanceof IRuntimeLoadpathEntryResolver2) {
+ IRuntimeLoadpathEntryResolver2 resolver2 = (IRuntimeLoadpathEntryResolver2) resolver;
+ return resolver2.isVMInstallReference(entry);
+ } else {
+ return resolver.resolveVMInstall(entry) != null;
+ }
+ } catch (CoreException e) {
+ return false;
+ }
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 18:38:07 UTC (rev 1813)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -3,6 +3,18 @@
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
public interface IRubyLaunchConfigurationConstants {
+
+ /**
+ * Status code indicating a launch configuration does not
+ * specify a VM Install
+ */
+ public static final int ERR_UNSPECIFIED_VM_INSTALL = 103;
+
+ /**
+ * Status code indicating the project associated with
+ * a launch configuration is not a Ruby project.
+ */
+ public static final int ERR_NOT_A_RUBY_PROJECT = 107;
/**
* Status code indicating the specified working directory
@@ -11,6 +23,14 @@
public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 108;
/**
+ * Status code indicating that the project referenced by a launch configuration
+ * is closed.
+ *
+ * @since 0.9.0
+ */
+ public static final int ERR_PROJECT_CLOSED = 124;
+
+ /**
* Status code indicating an unexpected internal error.
*/
public static final int ERR_INTERNAL_ERROR = 150;
@@ -30,4 +50,46 @@
*/
public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.getUniqueIdentifier() + ".RUBY_COMMAND"; //$NON-NLS-1$
+ /**
+ * Launch configuration attribute key. The value is a name of
+ * a Ruby project associated with a Ruby launch configuration.
+ */
+ public static final String ATTR_PROJECT_NAME = LaunchingPlugin.getUniqueIdentifier() + ".PROJECT_ATTR"; //$NON-NLS-1$
+
+
+ /**
+ * Launch configuration attribute key. The value is a path identifying the JRE used
+ * when launching a local VM. The path is a classpath container corresponding
+ * to the <code>JavaRuntime.JRE_CONTAINER</code> classpath container.
+ * <p>
+ * When unspecified the default JRE for a launch configuration is used (which is the
+ * JRE associated with the project being launched, or the workspace default JRE when
+ * no project is associated with a configuration). The default JRE classpath container
+ * refers explicitly to the workspace default JRE.
+ * </p>
+ * @since 3.2
+ */
+ public static final String ATTR_JRE_CONTAINER_PATH = RubyRuntime.RUBY_CONTAINER;
+
+ /**
+ * Launch configuration attribute key. The value is a name of a VM install
+ * to use when launching a local VM. This attribute must be qualified
+ * by a VM install type, via the <code>ATTR_VM_INSTALL_TYPE</code>
+ * attribute. When unspecified, the default VM is used.
+ *
+ * @deprecated use <code>ATTR_JRE_CONTAINER_PATH</code>
+ */
+ public static final String ATTR_VM_INSTALL_NAME = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_NAME"; //$NON-NLS-1$
+
+ /**
+ * Launch configuration attribute key. The value is an identifier of
+ * a VM install type. Used in conjunction with a VM install name, to
+ * specify the VM to use when launching a local Java application.
+ * The associated VM install name is specified via the attribute
+ * <code>ATTR_VM_INSTALL_NAME</code>.
+ *
+ * @deprecated use <code>ATTR_JRE_CONTAINER_PATH</code>
+ */
+ public static final String ATTR_VM_INSTALL_TYPE = LaunchingPlugin.getUniqueIdentifier() + ".VM_INSTALL_TYPE_ID"; //$NON-NLS-1$
+
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 18:38:07 UTC (rev 1813)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-19 19:03:28 UTC (rev 1814)
@@ -6,14 +6,17 @@
import java.io.IOException;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.TransformerException;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
@@ -25,17 +28,19 @@
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyModel;
+import org.rubypeople.rdt.core.IRubyProject;
+import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.launching.CompositeId;
import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.launching.ListenerList;
+import org.rubypeople.rdt.internal.launching.RuntimeLoadpathEntryResolver;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
public class RubyRuntime {
- private static final String TAG_INTERPRETER = "interpreter";
- private static final String ATTR_PATH = "path";
- private static final String ATTR_NAME = "name";
- private static final String ATTR_SELECTED = "selected";
/**
* Loadpath container used for a project's Ruby
@@ -79,6 +84,13 @@
*/
public static final String RUBYLIB_VARIABLE= "RUBY_LIB"; //$NON-NLS-1$
+ /**
+ * Simple identifier constant (value <code>"runtimeLoadpathEntryResolvers"</code>) for the
+ * runtime loadpath entry resolvers extension point.
+ *
+ * @since 0.9.0
+ */
+ public static final String EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS= "runtimeLoadpathEntryResolvers"; //$NON-NLS-1$
private static IVMInstallType[] fgVMTypes= null;
@@ -86,16 +98,21 @@
private static Object fgVMLock = new Object();
private static boolean fgInitializingVMs;
private static String fgDefaultVMId;
+ private static ListenerList fgVMListeners = new ListenerList(5);
+ private static String fgDefaultVMConnectorId;
/**
* Set of IDs of VMs contributed via vmInstalls extension point.
*/
private static Set<String> fgContributedVMs = new HashSet<String>();
-
- protected static List<IVMInstall> installedInterpreters;
- protected static IVMInstall selectedInterpreter;
- private static ListenerList fgVMListeners = new ListenerList(5);
- private static String fgDefaultVMConnectorId;
+
+ /**
+ * Resolvers keyed by variable name, container id,
+ * and runtime classpath entry id.
+ */
+ private static Map fgVariableResolvers = null;
+ private static Map fgContainerResolvers = null;
+ private static Map fgRuntimeClasspathEntryResolvers = null;
protected RubyRuntime() {
super();
@@ -648,4 +665,223 @@
}
return libraryPaths;
}
+
+ /**
+ * Returns the VM install for the given launch configuration.
+ * The VM install is determined in the following prioritized way:
+ * <ol>
+ * <li>The VM install is explicitly specified on the launch configuration
+ * via the <code>ATTR_JRE_CONTAINER_PATH</code> attribute (since 3.2).</li>
+ * <li>The VM install is explicitly specified on the launch configuration
+ * via the <code>ATTR_VM_INSTALL_TYPE</code> and <code>ATTR_VM_INSTALL_ID</code>
+ * attributes.</li>
+ * <li>If no explicit VM install is specified, the VM install associated with
+ * the launch configuration's project is returned.</li>
+ * <li>If no project is specified, or the project does not specify a custom
+ * VM install, the workspace default VM install is returned.</li>
+ * </ol>
+ *
+ * @param configuration launch configuration
+ * @return vm install
+ * @exception CoreException if unable to compute a vm install
+ * @since 0.9.0
+ */
+ public static IVMInstall computeVMInstall(ILaunchConfiguration configuration) throws CoreException {
+ String jreAttr = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, (String)null);
+ if (jreAttr == null) {
+ String type = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_TYPE, (String)null);
+ if (type == null) {
+ IRubyProject proj = getRubyProject(configuration);
+ if (proj != null) {
+ IVMInstall vm = getVMInstall(proj);
+ if (vm != null) {
+ return vm;
+ }
+ }
+ } else {
+ String name = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_VM_INSTALL_NAME, (String)null);
+ return resolveVM(type, name, configuration);
+ }
+ } else {
+ IPath jrePath = Path.fromPortableString(jreAttr);
+ ILoadpathEntry entry = RubyCore.newContainerEntry(jrePath);
+ IRuntimeLoadpathEntryResolver2 resolver = getVariableResolver(jrePath.segment(0));
+ if (resolver != null) {
+ return resolver.resolveVMInstall(entry);
+ } else {
+ resolver = getContainerResolver(jrePath.segment(0));
+ if (resolver != null) {
+ return resolver.resolveVMInstall(entry);
+ }
+ }
+ }
+
+ return getDefaultVMInstall();
+ }
+
+ /**
+ * Returns the VM of the given type with the specified name.
+ *
+ * @param type vm type identifier
+ * @param name vm name
+ * @return vm install
+ * @exception CoreException if unable to resolve
+ * @since 0.9.0
+ */
+ private static IVMInstall resolveVM(String type, String name, ILaunchConfiguration configuration) throws CoreException {
+ IVMInstallType vt = getVMInstallType(type);
+ if (vt == null) {
+ // error type does not exist
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Specified_VM_install_type_does_not_exist___0__2, new String[] {type}), null);
+ }
+ IVMInstall vm = null;
+ // look for a name
+ if (name == null) {
+ // error - type specified without a specific install (could be an old config that specified a VM ID)
+ // log the error, but choose the default VM.
+ IStatus status = new Status(IStatus.WARNING, LaunchingPlugin.getUniqueIdentifier(), IRubyLaunchConfigurationConstants.ERR_UNSPECIFIED_VM_INSTALL, MessageFormat.format(LaunchingMessages.JavaRuntime_VM_not_fully_specified_in_launch_configuration__0____missing_VM_name__Reverting_to_default_VM__1, new String[] {configuration.getName()}), null);
+ LaunchingPlugin.log(status);
+ return getDefaultVMInstall();
+ }
+ vm = vt.findVMInstallByName(name);
+ if (vm == null) {
+ // error - install not found
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Specified_VM_install_not_found__type__0___name__1__2, new String[] {vt.getName(), name}), null);
+ } else {
+ return vm;
+ }
+ // won't reach here
+ return null;
+ }
+
+ /**
+ * Returns the resolver registered for the given variable, or
+ * <code>null</code> if none.
+ *
+ * @param variableName the variable to determine the resolver for
+ * @return the resolver registered for the given variable, or
+ * <code>null</code> if none
+ */
+ private static IRuntimeLoadpathEntryResolver2 getVariableResolver(String variableName) {
+ return (IRuntimeLoadpathEntryResolver2)getVariableResolvers().get(variableName);
+ }
+
+ /**
+ * Returns the resolver registered for the given container id, or
+ * <code>null</code> if none.
+ *
+ * @param containerId the container to determine the resolver for
+ * @return the resolver registered for the given container id, or
+ * <code>null</code> if none
+ */
+ private static IRuntimeLoadpathEntryResolver2 getContainerResolver(String containerId) {
+ return (IRuntimeLoadpathEntryResolver2)getContainerResolvers().get(containerId);
+ }
+
+ private static Map getVariableResolvers() {
+ if (fgVariableResolvers == null) {
+ initializeResolvers();
+ }
+ return fgVariableResolvers;
+ }
+
+ /**
+ * Returns all registered container resolvers.
+ */
+ private static Map getContainerResolvers() {
+ if (fgContainerResolvers == null) {
+ initializeResolvers();
+ }
+ return fgContainerResolvers;
+ }
+
+ private static void initializeResolvers() {
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, EXTENSION_POINT_RUNTIME_CLASSPATH_ENTRY_RESOLVERS);
+ IConfigurationElement[] extensions = point.getConfigurationElements();
+ fgVariableResolvers = new HashMap(extensions.length);
+ fgContainerResolvers = new HashMap(extensions.length);
+ fgRuntimeClasspathEntryResolvers = new HashMap(extensions.length);
+ for (int i = 0; i < extensions.length; i++) {
+ RuntimeLoadpathEntryResolver res = new RuntimeLoadpathEntryResolver(extensions[i]);
+ String variable = res.getVariableName();
+ String container = res.getContainerId();
+ String entryId = res.getRuntimeLoadpathEntryId();
+ if (variable != null) {
+ fgVariableResolvers.put(variable, res);
+ }
+ if (container != null) {
+ fgContainerResolvers.put(container, res);
+ }
+ if (entryId != null) {
+ fgRuntimeClasspathEntryResolvers.put(entryId, res);
+ }
+ }
+ }
+
+ /**
+ * Returns the VM assigned to build the given Java project.
+ * The project must exist. The VM assigned to a project is
+ * determined from its build path.
+ *
+ * @param project the project to retrieve the VM from
+ * @return the VM instance that is assigned to build the given Java project
+ * Returns <code>null</code> if no VM is referenced on the project's build path.
+ * @throws CoreException if unable to determine the project's VM install
+ */
+ public static IVMInstall getVMInstall(IRubyProject project) throws CoreException {
+ // check the classpath
+ IVMInstall vm = null;
+ ILoadpathEntry[] classpath = project.getRawLoadpath();
+ IRuntimeLoadpathEntryResolver resolver = null;
+ for (int i = 0; i < classpath.length; i++) {
+ ILoadpathEntry entry = classpath[i];
+ switch (entry.getEntryKind()) {
+ case ILoadpathEntry.CPE_VARIABLE:
+ resolver = getVariableResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ vm = resolver.resolveVMInstall(entry);
+ }
+ break;
+ case ILoadpathEntry.CPE_CONTAINER:
+ resolver = getContainerResolver(entry.getPath().segment(0));
+ if (resolver != null) {
+ vm = resolver.resolveVMInstall(entry);
+ }
+ break;
+ }
+ if (vm != null) {
+ return vm;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the <code>IRubyProject</code> referenced in the specified configuration or
+ * <code>null</code> if none.
+ *
+ * @exception CoreException if the referenced Ruby project does not exist
+ * @since 0.9.0
+ */
+ public static IRubyProject getRubyProject(ILaunchConfiguration configuration) throws CoreException {
+ String projectName = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME, (String)null);
+ if ((projectName == null) || (projectName.trim().length() < 1)) {
+ return null;
+ }
+ IRubyProject javaProject = getRubyModel().getRubyProject(projectName);
+ if (javaProject != null && javaProject.getProject().exists() && !javaProject.getProject().isOpen()) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_28, new String[] {configuration.getName(), projectName}), IRubyLaunchConfigurationConstants.ERR_PROJECT_CLOSED, null);
+ }
+ if ((javaProject == null) || !javaProject.exists()) {
+ abort(MessageFormat.format(LaunchingMessages.JavaRuntime_Launch_configuration__0__references_non_existing_project__1___1, new String[] {configuration.getName(), projectName}), IRubyLaunchConfigurationConstants.ERR_NOT_A_RUBY_PROJECT, null);
+ }
+ return javaProject;
+ }
+
+ /**
+ * Convenience method to get the ruby model.
+ */
+ private static IRubyModel getRubyModel() {
+ return RubyCore.create(ResourcesPlugin.getWorkspace().getRoot());
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 18:38:08
|
Revision: 1813
http://svn.sourceforge.net/rubyeclipse/?rev=1813&view=rev
Author: cawilliams
Date: 2007-01-19 10:38:07 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
new interfaces...
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry2.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry2.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry2.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry2.java 2007-01-19 18:38:07 UTC (rev 1813)
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.w3c.dom.Element;
+
+/**
+ * Enhancements to <code>IRuntimeLoadpathEntry</code> to support
+ * extensible runtime classpath entries. Contributed runtime classpath
+ * entries have a type of <code>OTHER</code>, and are contributed to
+ * the <code>runtimeLoadpathEntries</code> extension point.
+ * <p>
+ * Clients are not intended to implement this interface, as new types
+ * of runtime classpath entries are only intended to be contributed
+ * by the Java debugger.
+ * </p>
+ * @since 0.9.0
+ * @see org.rubypeople.rdt.launching.IRuntimeLoadpathEntry
+ */
+public interface IRuntimeLoadpathEntry2 extends IRuntimeLoadpathEntry {
+
+ /**
+ * Initializes this runtime classpath entry from the given memento.
+ *
+ * @param memento memento created by a classpath entry of the same type
+ * @throws CoreException if unable to initialize from the given memento
+ */
+ public void initializeFrom(Element memento) throws CoreException;
+
+ /**
+ * Returns the unique identifier of the extension that contributed
+ * this classpath entry type, or <code>null</code> if this classpath
+ * entry type was not contributed.
+ *
+ * @return the unique identifier of the extension that contributed
+ * this classpath entry type, or <code>null</code> if this classpath
+ * entry type was not contributed
+ */
+ public String getTypeId();
+
+ /**
+ * Returns whether this classpath entry is composed of other entries.
+ *
+ * @return whether this classpath entry is composed of other entries
+ */
+ public boolean isComposite();
+
+ /**
+ * Returns the classpath entries this entry is composed of, or an
+ * empty collection if this entry is not a composite entry.
+ *
+ * @param configuration the context (launch configuration) in which
+ * this runtime classpath entry is being queried for contained
+ * entries, possibly <code>null</code>
+ * @return the classpath entries this entry is composed of, or an
+ * empty collection if this entry is not a composite entry
+ * @throws CoreException if unable to retrieve contained entries
+ */
+ public IRuntimeLoadpathEntry[] getRuntimeLoadpathEntries(ILaunchConfiguration configuration) throws CoreException;
+
+ /**
+ * Returns a human readable name for this classpath entry.
+ *
+ * @return a human readable name for this classpath entry
+ */
+ public String getName();
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 18:37:15
|
Revision: 1812
http://svn.sourceforge.net/rubyeclipse/?rev=1812&view=rev
Author: cawilliams
Date: 2007-01-19 10:37:14 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
new interfaces...
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver2.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver2.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver2.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver2.java 2007-01-19 18:37:14 UTC (rev 1812)
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import org.rubypeople.rdt.core.ILoadpathEntry;
+
+/**
+ * Optional enhancements to {@link IRuntimeLoadpathEntryResolver}.
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @since 0.9.0
+ */
+public interface IRuntimeLoadpathEntryResolver2 extends IRuntimeLoadpathEntryResolver {
+
+ /**
+ * Returns whether the given classpath entry references a VM install.
+ *
+ * @param entry classpath entry
+ * @return whether the given classpath entry references a VM install
+ */
+ public boolean isVMInstallReference(ILoadpathEntry entry);
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 18:36:16
|
Revision: 1811
http://svn.sourceforge.net/rubyeclipse/?rev=1811&view=rev
Author: cawilliams
Date: 2007-01-19 10:36:08 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
new interfaces...
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntryResolver.java 2007-01-19 18:36:08 UTC (rev 1811)
@@ -0,0 +1,97 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+
+/**
+ * Resolves variable and/or container runtime classpath entries in
+ * the context of a launch configuration or Ruby project. A resolver can be declared
+ * as an extension (<code>org.eclipse.jdt.launching.runtimeLoadpathEntryResolver</code>),
+ * or be registered with the <code>RubyRuntime</code> programmatically.
+ * <p>
+ * A resolver is registered for a specific classpath
+ * <code>VARIABLE</code> and/or <code>CONTAINER</code>. A resolver is
+ * consulted when a runtime classpath entry is needs to be resolved.
+ * </p>
+ * A resolver extension is defined in <code>plugin.xml</code>.
+ * Following is an example definition of a runtime classpath entry
+ * resolver extension.
+ * <pre>
+ * <extension point="org.eclipse.jdt.launching.runtimeLoadpathEntryResolvers">
+ * <runtimeLoadpathEntryResolver
+ * id="com.example.ExampleResolver"
+ * class="com.example.ExampleResolverImpl"
+ * variable="VAR_NAME"
+ * container="CONTAINER_ID"
+ * </runtimeLoadpathEntryResolver>
+ * </extension>
+ * </pre>
+ * The attributes are specified as follows:
+ * <ul>
+ * <li><code>id</code> specifies a unique identifier for this extension.</li>
+ * <li><code>class</code> specifies the fully qualified name of the Ruby class
+ * that implements <code>IRuntimeLoadpathEntryResolver</code>.</li>
+ * <li><code>variable</code> name of the classpath variable this resolver
+ * is registered for.</li>
+ * <li><code>container</code> identifier of the classpath container this
+ * resolver is registered for.</li>
+ * </ul>
+ * At least one of <code>variable</code> or <code>container</code> must be
+ * specified.
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ * @since 0.9.0
+ */
+public interface IRuntimeLoadpathEntryResolver {
+
+ /**
+ * Returns resolved runtime classpath entries for the given runtime classpath entry,
+ * in the context of the given launch configuration.
+ *
+ * @param entry runtime classpath entry to resolve, of type
+ * <code>VARIABLE</code> or <code>CONTAINTER</code>
+ * @param configuration the context in which the runtime classpath entry
+ * needs to be resolved
+ * @return resolved entries (zero or more)
+ * @exception CoreException if unable to resolve the entry
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, ILaunchConfiguration configuration) throws CoreException;
+
+ /**
+ * Returns resolved runtime classpath entries for the given runtime classpath entry,
+ * in the context of the given Ruby project.
+ *
+ * @param entry runtime classpath entry to resolve, of type
+ * <code>VARIABLE</code> or <code>CONTAINTER</code>
+ * @param project context in which the runtime classpath entry
+ * needs to be resolved
+ * @return resolved entries (zero or more)
+ * @exception CoreException if unable to resolve the entry
+ */
+ public IRuntimeLoadpathEntry[] resolveRuntimeLoadpathEntry(IRuntimeLoadpathEntry entry, IRubyProject project) throws CoreException;
+
+ /**
+ * Returns a VM install associated with the given classpath entry,
+ * or <code>null</code> if none.
+ *
+ * @param entry classpath entry
+ * @return vm install associated with entry or <code>null</code> if none
+ * @exception CoreException if unable to resolve a VM
+ */
+ public IVMInstall resolveVMInstall(ILoadpathEntry entry) throws CoreException;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 18:34:54
|
Revision: 1810
http://svn.sourceforge.net/rubyeclipse/?rev=1810&view=rev
Author: cawilliams
Date: 2007-01-19 10:34:50 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
new schemas/extension points
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/plugin.xml
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/schema/loadpathProviders.exsd
trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntries.exsd
trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntryResolvers.exsd
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 18:29:36 UTC (rev 1809)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-19 18:34:50 UTC (rev 1810)
@@ -25,6 +25,9 @@
<!-- Extension point definitions -->
<extension-point id="vmInstallTypes" name="%vmInstallTypes" schema="schema/vmInstallTypes.exsd"/>
<extension-point id="vmInstalls" name="%vmInstalls" schema="schema/vmInstalls.exsd"/>
+ <extension-point id="loadpathProviders" name="%loadpathProviders" schema="schema/loadpathProviders.exsd"/>
+ <extension-point id="runtimeLoadpathEntryResolvers" name="%runtimeLoadpathEntryResolvers" schema="schema/runtimeLoadpathEntryResolvers.exsd"/>
+ <extension-point id="runtimeLoadpathEntries" name="%runtimeLoadpathEntries" schema="schema/runtimeLoadpathEntries.exsd"/>
<extension
point="org.rubypeople.rdt.launching.vmInstallTypes">
Added: trunk/org.rubypeople.rdt.launching/schema/loadpathProviders.exsd
===================================================================
--- trunk/org.rubypeople.rdt.launching/schema/loadpathProviders.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.launching/schema/loadpathProviders.exsd 2007-01-19 18:34:50 UTC (rev 1810)
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.jdt.launching">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.jdt.launching" id="classpathProviders" name="Java Runtime Classpath Providers"/>
+ </appInfo>
+ <documentation>
+ This extension point allows clients to dynamically compute and resolve classpaths and source lookup paths for Java launch configurations. A Java launch configuration is can be associated with a custom classpath provider via the launch configuration attriubte ATTR_CLASSPATH_PROVIDER and a custom source path provider via the attribute ATTR_SOURCE_PATH_PROVIDER. When specified, the launch configuration attributes correspond to the id of a classpath provider extension.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="loadpathProvider" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="loadpathProvider">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique identifier that can be used to reference this classpath provider
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the class that implements this classpath provider. The class must implement <code>IRuntimeClasspathProvider</code>
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.launching.AbstractVMInstallType"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 2.1
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a classpath provider:
+
+<p>
+<pre>
+ <extension point="org.eclipse.jdt.launching.classpathProviders">
+ <classpathProvider
+ class="com.example.ProviderImplementation"
+ id="com.example.ProviderId">
+ </classpathProvider>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ A default implementation is provided for all launch configurations that do not specify a custom classpath provider.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntries.exsd
===================================================================
--- trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntries.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntries.exsd 2007-01-19 18:34:50 UTC (rev 1810)
@@ -0,0 +1,115 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.launching">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.launching" id="runtimeLoadpathEntries" name="Ruby Runtime Loadpath Entries"/>
+ </appInfo>
+ <documentation>
+ This in an internal extension point that allows the Java debugger to extend the set of runtime classpath entries used for launching Java applications. Clients are not intended to use this extension point.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="runtimeLoadpathEntry" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtimeLoadpathEntry">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique identifier that can be used to reference this type of runtime classpath entry.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the class that implements this runtime classpath entry. The class must implement <code>IRuntimeClasspathEntry2</code>.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.launching.internal.IRuntimeLoadpathEntry2"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a resolver:
+
+<p>
+<pre>
+ <extension point="org.eclipse.jdt.launching.runtimeClasspathEntries">
+ <runtimeClasspathEntry
+ id="com.example.EnvVarEntry"
+ class="com.example.EnvVarClasspathEntry">
+ </runtimeClasspathEntry>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ An implementations is provided for Java projects, contributed with an identifier of <code>org.eclipse.jdt.launching.classpathentry.project</code>. A Java project classpath entry includes all references on its buildpath.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntryResolvers.exsd
===================================================================
--- trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntryResolvers.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.launching/schema/runtimeLoadpathEntryResolvers.exsd 2007-01-19 18:34:50 UTC (rev 1810)
@@ -0,0 +1,129 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.launching">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.launching" id="runtimeLoadpathEntryResolvers" name="Ruby Runtime Loadpath Entry Resolvers"/>
+ </appInfo>
+ <documentation>
+ This extension point allows clients to dynamically resolve entries used on the runtime classpath and source
+lookup path, for corresponding classpath variables and classpath containers.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="runtimeLoadpathEntryResolver" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtimeLoadpathEntryResolver">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique identifier that can be used to reference this resolver.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the class that implements this resolver. The class must implement <code>IRuntimeClasspathEntryResolver</code>.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.launching.IRuntimeLoadpathEntryResolver"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ <attribute name="variable" type="string">
+ <annotation>
+ <documentation>
+ the name of the classpath variable this resolver is registered for. At least one of variable or container must be specified, and at most one resolver can be registered for a variable or container.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="container" type="string">
+ <annotation>
+ <documentation>
+ the identifier of the classpath container this resolver is registered for. At least one of variable or container must be specified, and at most one resolver can be registered for a variable or container.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="runtimeLoadpathEntryId" type="string">
+ <annotation>
+ <documentation>
+ the identifier of the runtime classpath entry this resolver is associated with
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of a resolver:
+
+<p>
+<pre>
+ <extension point="org.eclipse.jdt.launching.runtimeClasspathEntryResolvers">
+ <runtimeClasspathEntryResolver
+ class="com.example.ResolverImplementation"
+ id="com.example.ResolverId"
+ variable="CLASSPATH_VARIABLE">
+ </runtimeClasspathEntryResolver>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ Implementations are provided for the standard JRE_LIB classpath variable and JRE_CONTAINER classpath container.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 18:29:40
|
Revision: 1809
http://svn.sourceforge.net/rubyeclipse/?rev=1809&view=rev
Author: cawilliams
Date: 2007-01-19 10:29:36 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
new interfaces...
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathProvider.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathEntry.java 2007-01-19 18:29:36 UTC (rev 1809)
@@ -0,0 +1,244 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.rubypeople.rdt.core.ILoadpathEntry;
+import org.rubypeople.rdt.core.IRubyProject;
+
+/**
+ * Represents an entry on a runtime classpath. A runtime classpath entry
+ * may refer to one of the following:
+ * <ul>
+ * <li>A Ruby project (type <code>PROJECT</code>) - a project entry refers
+ * to all of the built classes in a project, and resolves to the output
+ * location(s) of the associated Ruby project.</li>
+ * <li>An archive (type <code>ARCHIVE</code>) - an archive refers to a jar, zip, or
+ * folder in the workspace or in the local file system containing class
+ * files. An archive may have attached source.</li>
+ * <li>A variable (type <code>VARIABLE</code>) - a variable refers to a
+ * classpath variable, which may refer to a jar.</li>
+ * <li>A library (type <code>CONTAINER</code>) - a container refers to classpath
+ * container variable which refers to a collection of archives derived
+ * dynamically, on a per project basis.</li>
+ * <li>A contributed classpath entry (type <code>OTHER</code>) - a contributed
+ * classpath entry is an extension contributed by a plug-in. The resolution
+ * of a contributed classpath entry is client defined. See
+ * <code>IRuntimeLoadpathEntry2</code>.
+ * </ul>
+ * <p>
+ * Clients may implement this interface for contributed a classpath entry
+ * types (i.e. type <code>OTHER</code>). Note, contributed classpath entries
+ * are new in 3.0, and are only intended to be contributed by the Ruby debugger.
+ * </p>
+ * @since 2.0
+ * @see org.eclipse.jdt.launching.IRuntimeLoadpathEntry2
+ */
+public interface IRuntimeLoadpathEntry {
+
+ /**
+ * Type identifier for project entries.
+ */
+ public static final int PROJECT = 1;
+
+ /**
+ * Type identifier for archive entries.
+ */
+ public static final int ARCHIVE = 2;
+
+ /**
+ * Type identifier for variable entries.
+ */
+ public static final int VARIABLE = 3;
+
+ /**
+ * Type identifier for container entries.
+ */
+ public static final int CONTAINER = 4;
+
+ /**
+ * Type identifier for contributed entries.
+ * @since 3.0
+ */
+ public static final int OTHER = 5;
+
+ /**
+ * Loadpath property identifier for entries that appear on the
+ * bootstrap path by default.
+ */
+ public static final int STANDARD_CLASSES = 1;
+
+ /**
+ * Loadpath property identifier for entries that should appear on the
+ * bootstrap path explicitly.
+ */
+ public static final int BOOTSTRAP_CLASSES = 2;
+
+ /**
+ * Loadpath property identifier for entries that should appear on the
+ * user classpath.
+ */
+ public static final int USER_CLASSES = 3;
+
+ /**
+ * Returns this classpath entry's type. The type of a runtime classpath entry is
+ * identified by one of the following constants:
+ * <ul>
+ * <li><code>PROJECT</code></li>
+ * <li><code>ARCHIVE</code></li>
+ * <li><code>VARIABLE</code></li>
+ * <li><code>CONTAINER</code></li>
+ * <li><code>OTHER</code></li>
+ * </ul>
+ * <p>
+ * Since 3.0, a type of <code>OTHER</code> may be returned.
+ * </p>
+ * @return this classpath entry's type
+ */
+ public int getType();
+
+ /**
+ * Returns a memento for this classpath entry.
+ * <p>
+ * Since 3.0, the memento for a contributed classpath entry (i.e. of
+ * type <code>OTHER</code>), must be in the form of an XML document,
+ * with the following element structure:
+ * <pre>
+ * <runtimeLoadpathEntry id="exampleId">
+ * <memento
+ * key1="value1"
+ * ...>
+ * </memento>
+ * </runtimeLoadpathEntry>
+ * </pre>
+ * The <code>id</code> attribute is the unique identifier of the extension
+ * that contributed this runtime classpath entry type, via the extension
+ * point <code>org.eclipse.jdt.launching.runtimeLoadpathEntries</code>.
+ * The <code>memento</code> element will be used to initialize a
+ * restored runtime classpath entry, via the method
+ * <code>IRuntimeLoadpathEntry2.initializeFrom(Element memento)</code>. The
+ * attributes of the <code>memento</code> element are client defined.
+ * </p>
+ *
+ * @return a memento for this classpath entry
+ * @exception CoreException if an exception occurs generating a memento
+ */
+ public String getMemento() throws CoreException;
+
+ /**
+ * Returns the path associated with this entry, or <code>null</code>
+ * if none. The format of the
+ * path returned depends on this entry's type:
+ * <ul>
+ * <li><code>PROJECT</code> - a workspace relative path to the associated
+ * project.</li>
+ * <li><code>ARCHIVE</code> - the absolute path of the associated archive,
+ * which may or may not be in the workspace.</li>
+ * <li><code>VARIABLE</code> - the path corresponding to the associated
+ * classpath variable entry.</li>
+ * <li><code>CONTAINER</code> - the path corresponding to the associated
+ * classpath container variable entry.</li>
+ * <li><code>OTHER</code> - the path returned is client defined.</li>
+ * </ul>
+ * <p>
+ * Since 3.0, this method may return <code>null</code>.
+ * </p>
+ * @return the path associated with this entry, or <code>null</code>
+ * @see org.eclipse.jdt.core.ILoadpathEntry#getPath()
+ */
+ public IPath getPath();
+
+ /**
+ * Returns the resource associated with this entry, or <code>null</code>
+ * if none. A project, archive, or folder entry may be associated
+ * with a resource.
+ *
+ * @return the resource associated with this entry, or <code>null</code>
+ */
+ public IResource getResource();
+
+ /**
+ * Returns a constant indicating where this entry should appear on the
+ * runtime classpath by default.
+ * The value returned is one of the following:
+ * <ul>
+ * <li><code>STANDARD_CLASSES</code> - a standard entry does not need to appear
+ * on the runtime classpath</li>
+ * <li><code>BOOTSTRAP_CLASSES</code> - a bootstrap entry should appear on the
+ * boot path</li>
+ * <li><code>USER_CLASSES</code> - a user entry should appear on the path
+ * containing user or application classes</li>
+ * </ul>
+ *
+ * @return where this entry should appear on the runtime classpath
+ */
+ public int getLoadpathProperty();
+
+ /**
+ * Sets whether this entry should appear on the bootstrap classpath,
+ * the user classpath, or whether this entry is a standard bootstrap entry
+ * that does not need to appear on the classpath.
+ * The location is one of:
+ * <ul>
+ * <li><code>STANDARD_CLASSES</code> - a standard entry does not need to appear
+ * on the runtime classpath</li>
+ * <li><code>BOOTSTRAP_CLASSES</code> - a bootstrap entry should appear on the
+ * boot path</li>
+ * <li><code>USER_CLASSES</code> - a user entry should appear on the path
+ * conatining user or application classes</li>
+ * </ul>
+ *
+ * @param location a classpat property constant
+ */
+ public void setLoadpathProperty(int location);
+
+ /**
+ * Returns an absolute path in the local file system for this entry,
+ * or <code>null</code> if none, or if this entry is of type <code>CONTAINER</code>.
+ *
+ * @return an absolute path in the local file system for this entry,
+ * or <code>null</code> if none
+ */
+ public String getLocation();
+
+ /**
+ * Returns the first segment of the path associated with this entry, or <code>null</code>
+ * if this entry is not of type <code>VARIABLE</code> or <code>CONTAINER</code>.
+ *
+ * @return the first segment of the path associated with this entry, or <code>null</code>
+ * if this entry is not of type <code>VARIABLE</code> or <code>CONTAINER</code>
+ */
+ public String getVariableName();
+
+ /**
+ * Returns a classpath entry equivalent to this runtime classpath entry,
+ * or <code>null</code> if none.
+ * @return a classpath entry equivalent to this runtime classpath entry,
+ * or <code>null</code>
+ * @since 0.9.0
+ */
+ public ILoadpathEntry getLoadpathEntry();
+
+ /**
+ * Returns the Ruby project associated with this runtime classpath entry
+ * or <code>null</code> if none. Runtime classpath entries of type
+ * <code>CONTAINER</code> may be associated with a project for the
+ * purposes of resolving the entries in a container.
+ *
+ * @return the Ruby project associated with this runtime classpath entry
+ * or <code>null</code> if none
+ * @since 0.9.0
+ */
+ public IRubyProject getRubyProject();
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathProvider.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRuntimeLoadpathProvider.java 2007-01-19 18:29:36 UTC (rev 1809)
@@ -0,0 +1,83 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+
+/**
+ * A classpath provider computes an unresolved classpath for a launch
+ * configuration, and resolves classpath entries for a launch configuration.
+ * A classpath provider is defined as an extension of type
+ * <code>org.eclipse.jdt.launching.classpathProvider</code>.
+ * <p>
+ * A provider is registered with an identifier that can be
+ * referenced by a launch configuration. A classpath provider is consulted
+ * to compute a classpath or source lookup path when a launch configuration
+ * references a provider in one or both of the following attributes:
+ * <ul>
+ * <li><code>ATTR_CLASSPATH_PROVIDER</code></li>
+ * <li><code>ATTR_SOURCE_PATH_PROVIDER</code></li>
+ * </ul>
+ * </p>
+ * A provider extension is defined in <code>plugin.xml</code>.
+ * Following is an example definition of a runtime classpath provider
+ * extension.
+ * <pre>
+ * <extension point="org.eclipse.jdt.launching.classpathProviders">
+ * <classpathProvider
+ * id="com.example.ExampleLoadpathProvider"
+ * class="com.example.ExampleLoadpathProviderImpl"
+ * </classpathProvider>
+ * </extension>
+ * </pre>
+ * The attributes are specified as follows:
+ * <ul>
+ * <li><code>id</code> specifies a unique identifier for this extension. This
+ * identifier may be used to reference a provider on one of the launch
+ * configuration attributes mentioned above.</li>
+ * <li><code>class</code> specifies the fully qualified name of the Java class
+ * that implements <code>IRuntimeLoadpathProvider</code>.</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Clients may implement this interface.
+ * </p>
+ *
+ * @since 0.9.0
+ */
+public interface IRuntimeLoadpathProvider {
+
+ /**
+ * Computes and returns an unresolved classpath for the given launch configuration.
+ * Variable and container entries are not resolved.
+ *
+ * @param configuration launch configuration
+ * @return unresolved path
+ * @exception CoreException if unable to compute a path
+ */
+ public IRuntimeLoadpathEntry[] computeUnresolvedLoadpath(ILaunchConfiguration configuration) throws CoreException;
+
+ /**
+ * Returns the resolved path corresponding to the given path, in the context of the
+ * given launch configuration. Variable and container entries are resolved. The returned
+ * (resolved) path need not have the same number of entries as the given (unresolved)
+ * path.
+ *
+ * @param entries entries to resolve
+ * @param configuration launch configuration context to resolve in
+ * @return resolved path
+ * @exception CoreException if unable to resolve a path
+ */
+ public IRuntimeLoadpathEntry[] resolveLoadpath(IRuntimeLoadpathEntry[] entries, ILaunchConfiguration configuration) throws CoreException;
+
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 17:00:32
|
Revision: 1808
http://svn.sourceforge.net/rubyeclipse/?rev=1808&view=rev
Author: cawilliams
Date: 2007-01-19 09:00:28 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
Modified Paths:
--------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-19 15:48:40 UTC (rev 1807)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-19 17:00:28 UTC (rev 1808)
@@ -31,6 +31,9 @@
import org.rubypeople.rdt.launching.VMRunnerConfiguration;
public class StandardVMRunner extends AbstractVMRunner {
+
+ private static final String END_OF_OPTIONS_DELIMITER = "--";
+
protected IVMInstall fVMInstance;
public StandardVMRunner(IVMInstall vmInstance) {
@@ -161,20 +164,13 @@
return file.exists() && file.isFile();
}
- protected String convertClassPath(String[] cp) {
- int pathCount= 0;
- StringBuffer buf= new StringBuffer();
- if (cp.length == 0) {
- return ""; //$NON-NLS-1$
+ protected List<String> convertLoadPath(String[] lp) {
+ List<String> strings = new ArrayList<String>();
+ for (int i= 0; i < lp.length; i++) {
+ strings.add("-I"); //$NON-NLS-1$
+ strings.add(lp[i]);
}
- for (int i= 0; i < cp.length; i++) {
- if (pathCount > 0) {
- buf.append(File.pathSeparator);
- }
- buf.append(cp[i]);
- pathCount++;
- }
- return buf.toString();
+ return strings;
}
@@ -196,18 +192,19 @@
List arguments= new ArrayList();
arguments.add(program);
- // VM args are the first thing after the java program so that users can specify
+ // VM args are the first thing after the ruby program so that users can specify
// options like '-client' & '-server' which are required to be the first option
String[] allVMArgs = combineVmArgs(config, fVMInstance);
addArguments(allVMArgs, arguments);
- String[] cp= config.getClassPath();
- if (cp.length > 0) {
- arguments.add("-I"); //$NON-NLS-1$
- arguments.add(convertClassPath(cp));
+ String[] lp= config.getLoadPath();
+ if (lp.length > 0) {
+ arguments.addAll(convertLoadPath(lp));
}
- arguments.add(config.getClassToLaunch());
+ arguments.add(END_OF_OPTIONS_DELIMITER);
+ arguments.add(config.getFileToLaunch());
+
String[] programArgs= config.getProgramArguments();
addArguments(programArgs, arguments);
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java 2007-01-19 15:48:40 UTC (rev 1807)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java 2007-01-19 17:00:28 UTC (rev 1808)
@@ -24,12 +24,11 @@
* </p>
*/
public class VMRunnerConfiguration {
- private String fClassToLaunch;
+ private String fFileToLaunch;
private String[] fVMArgs;
private String[] fProgramArgs;
private String[] fEnvironment;
- private String[] fClassPath;
- private String[] fBootClassPath;
+ private String[] fLoadPath;
private String fWorkingDirectory;
private Map fVMSpecificAttributesMap;
private boolean fResume = true;
@@ -38,20 +37,20 @@
/**
* Creates a new configuration for launching a VM to run the given main class
- * using the given class path.
+ * using the given load path.
*
- * @param classToLaunch The fully qualified name of the class to launch. May not be null.
- * @param classPath The classpath. May not be null.
+ * @param fileToLaunch The fully qualified name of the file to launch. May not be null.
+ * @param loadPath The loadpath. May not be null.
*/
- public VMRunnerConfiguration(String classToLaunch, String[] classPath) {
- if (classToLaunch == null) {
+ public VMRunnerConfiguration(String fileToLaunch, String[] loadPath) {
+ if (fileToLaunch == null) {
throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_classNotNull);
}
- if (classPath == null) {
+ if (loadPath == null) {
throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_classPathNotNull);
}
- fClassToLaunch= classToLaunch;
- fClassPath= classPath;
+ fFileToLaunch= fileToLaunch;
+ fLoadPath= loadPath;
}
/**
@@ -111,24 +110,6 @@
}
/**
- * Sets the boot classpath. Note that the boot classpath will be passed to the
- * VM "as is". This means it has to be complete. Interpretation of the boot class path
- * is up to the VM runner this object is passed to.
- * <p>
- * In release 3.0, support has been added for appending and prepending the
- * boot classpath. Generally an <code>IVMRunner</code> should use the prepend,
- * main, and append boot classpaths provided. However, in the case that an
- * <code>IVMRunner</code> does not support these options, a complete bootpath
- * should also be specified.
- * </p>
- * @param bootClassPath The boot classpath. An empty array indicates an empty
- * bootpath and <code>null</code> indicates a default bootpath.
- */
- public void setBootClassPath(String[] bootClassPath) {
- fBootClassPath= bootClassPath;
- }
-
- /**
* Returns the <code>Map</code> that contains String name/value pairs that represent
* VM-specific attributes.
*
@@ -140,47 +121,24 @@
}
/**
- * Returns the name of the class to launch.
+ * Returns the name of the file to launch.
*
- * @return The fully qualified name of the class to launch. Will not be <code>null</code>.
+ * @return The fully qualified name of the file to launch. Will not be <code>null</code>.
*/
- public String getClassToLaunch() {
- return fClassToLaunch;
+ public String getFileToLaunch() {
+ return fFileToLaunch;
}
/**
- * Returns the classpath.
+ * Returns the loadpath.
*
- * @return the classpath
+ * @return the loadpath
*/
- public String[] getClassPath() {
- return fClassPath;
+ public String[] getLoadPath() {
+ return fLoadPath;
}
/**
- * Returns the boot classpath. An empty array indicates an empty
- * bootpath and <code>null</code> indicates a default bootpath.
- * <p>
- * In 3.0, support has been added for prepending and appending to the
- * boot classpath. The new attributes are stored in the VM specific
- * attributes map using the following keys defined in
- * <code>IJavaLaunchConfigurationConstants</code>:
- * <ul>
- * <li>ATTR_BOOTPATH_PREPEND</li>
- * <li>ATTR_BOOTPATH_APPEND</li>
- * <li>ATTR_BOOTPATH</li>
- * </ul>
- * </p>
- * @return The boot classpath. An empty array indicates an empty
- * bootpath and <code>null</code> indicates a default bootpath.
- * @see #setBootClassPath(String[])
- * @see IJavaLaunchConfigurationConstants
- */
- public String[] getBootClassPath() {
- return fBootClassPath;
- }
-
- /**
* Returns the arguments to the VM itself.
*
* @return The VM arguments. Default is an empty array. Will not be <code>null</code>.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 15:48:46
|
Revision: 1807
http://svn.sourceforge.net/rubyeclipse/?rev=1807&view=rev
Author: cawilliams
Date: 2007-01-19 07:48:40 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
fix key names to use underscores, not periods
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-01-19 15:44:11 UTC (rev 1806)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/util/messages.properties 2007-01-19 15:48:40 UTC (rev 1807)
@@ -1,346 +1,346 @@
###############################################################################
-# Copyright (c) 2000, 2004 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v1.0
+# Copyright (c) 2000, 2004 IBM Corporation and others_
+# All rights reserved_ This program and the accompanying materials
+# are made available under the terms of the Common Public License v1_0
# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v10.html
+# http://www_eclipse_org/legal/cpl-v10_html
#
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
-### JavaModel messages.
+### JavaModel messages_
### hierarchy
-hierarchy.nullProject = Project argument cannot be null
-hierarchy.nullRegion = Region cannot be null
-hierarchy.nullFocusType = Type focus cannot be null
-hierarchy.creating = Creating type hierarchy...
-hierarchy.creatingOnType = Creating type hierarchy on {0}...
+hierarchy_nullProject = Project argument cannot be null
+hierarchy_nullRegion = Region cannot be null
+hierarchy_nullFocusType = Type focus cannot be null
+hierarchy_creating = Creating type hierarchy...
+hierarchy_creatingOnType = Creating type hierarchy on {0}...
### java element
-element.doesNotExist = {0} does not exist
-element.notOnClasspath = {0} is not on its project's build path
-element.invalidClassFileName = Class file name must end with .class
-element.reconciling = Reconciling...
-element.attachingSource = Attaching source...
-element.invalidType = Type is not one of the defined constants
-element.invalidResourceForProject = Illegal argument - must be one of IProject, IFolder, or IFile
-element.nullName = Name cannot be null
-element.nullType = Type cannot be null
-element.illegalParent = Illegal parent argument
-sourcetype.invalidName = The source type has an invalid name: {0}
+element_doesNotExist = {0} does not exist
+element_notOnClasspath = {0} is not on its project's build path
+element_invalidClassFileName = Class file name must end with .class
+element_reconciling = Reconciling...
+element_attachingSource = Attaching source...
+element_invalidType = Type is not one of the defined constants
+element_invalidResourceForProject = Illegal argument - must be one of IProject, IFolder, or IFile
+element_nullName = Name cannot be null
+element_nullType = Type cannot be null
+element_illegalParent = Illegal parent argument
+sourcetype_invalidName = The source type has an invalid name: {0}
### java model operations
-operation.needElements = Operation requires one or more elements
-operation.needName = Operation requires a name
-operation.needPath = Operation requires a path
-operation.needAbsolutePath = Operation requires an absolute path. Relative path specified was: ''{0}''
-operation.needString = Operation requires a String.
-operation.notSupported = Operation not supported for specified element type(s):
-operation.cancelled = Operation cancelled
-operation.nullContainer = Container cannot be null
-operation.nullName = Name cannot be null
-operation.copyElementProgress = Copying elements...
-operation.moveElementProgress = Moving elements...
-operation.renameElementProgress = Renaming elements...
-operation.copyResourceProgress = Copying resources...
-operation.moveResourceProgress = Moving resources...
-operation.renameResourceProgress = Renaming resources...
-operation.createUnitProgress = Creating a compilation unit...
-operation.createFieldProgress = Creating a field...
-operation.createImportsProgress = Creating imports...
-operation.createInitializerProgress = Creating an initializer...
-operation.createMethodProgress = Creating a method...
-operation.createPackageProgress = Creating a package declaration...
-operation.createPackageFragmentProgress = Creating package fragment(s)...
-operation.createTypeProgress = Creating a type...
-operation.deleteElementProgress = Deleting elements...
-operation.deleteResourceProgress = Deleting resources...
-operation.cannotRenameDefaultPackage = Default package cannot be renamed
-operation.pathOutsideProject = Path ''{0}'' must denote location inside project {1}
-operation.sortelements = Sorting elements...
+operation_needElements = Operation requires one or more elements
+operation_needName = Operation requires a name
+operation_needPath = Operation requires a path
+operation_needAbsolutePath = Operation requires an absolute path. Relative path specified was: ''{0}''
+operation_needString = Operation requires a String.
+operation_notSupported = Operation not supported for specified element type(s):
+operation_cancelled = Operation cancelled
+operation_nullContainer = Container cannot be null
+operation_nullName = Name cannot be null
+operation_copyElementProgress = Copying elements...
+operation_moveElementProgress = Moving elements...
+operation_renameElementProgress = Renaming elements...
+operation_copyResourceProgress = Copying resources...
+operation_moveResourceProgress = Moving resources...
+operation_renameResourceProgress = Renaming resources...
+operation_createUnitProgress = Creating a compilation unit...
+operation_createFieldProgress = Creating a field...
+operation_createImportsProgress = Creating imports...
+operation_createInitializerProgress = Creating an initializer...
+operation_createMethodProgress = Creating a method...
+operation_createPackageProgress = Creating a package declaration...
+operation_createPackageFragmentProgress = Creating package fragment(s)...
+operation_createTypeProgress = Creating a type...
+operation_deleteElementProgress = Deleting elements...
+operation_deleteResourceProgress = Deleting resources...
+operation_cannotRenameDefaultPackage = Default package cannot be renamed
+operation_pathOutsideProject = Path ''{0}'' must denote location inside project {1}
+operation_sortelements = Sorting elements...
### working copy
-workingCopy.commit = Committing working copy...
+workingCopy_commit = Committing working copy...
### build status messages
-build.preparingBuild = Preparing for build
-build.readStateProgress = Reading saved built state for project {0}
-build.saveStateProgress = Saving built state for project {0}
-build.saveStateComplete = Saved in {0} ms
-build.readingDelta = Reading resource change information for {0}
-build.analyzingDeltas = Analyzing deltas
-build.analyzingSources = Analyzing sources
-build.cleaningOutput = Cleaning output folder
-build.copyingResources = Copying resources to the output folder
-build.compiling = Compiling {0}
-build.foundHeader = Found
-build.fixedHeader = Fixed
-build.oneError = 1 error
-build.oneWarning = 1 warning
-build.multipleErrors = {0} errors
-build.multipleWarnings = {0} warnings
-build.done = Build done
+build_preparingBuild = Preparing for build
+build_readStateProgress = Reading saved built state for project {0}
+build_saveStateProgress = Saving built state for project {0}
+build_saveStateComplete = Saved in {0} ms
+build_readingDelta = Reading resource change information for {0}
+build_analyzingDeltas = Analyzing deltas
+build_analyzingSources = Analyzing sources
+build_cleaningOutput = Cleaning output folder
+build_copyingResources = Copying resources to the output folder
+build_compiling = Compiling {0}
+build_foundHeader = Found
+build_fixedHeader = Fixed
+build_oneError = 1 error
+build_oneWarning = 1 warning
+build_multipleErrors = {0} errors
+build_multipleWarnings = {0} warnings
+build_done = Build done
### build errors
-build.wrongFileFormat = Wrong file format
-build.cannotSaveState = Error saving last build state for project {0}
-build.cannotSaveStates = Error saving build states
-build.initializationError = Builder initialization error
-build.serializationError = Builder serialization error
+build_wrongFileFormat = Wrong file format
+build_cannotSaveState = Error saving last build state for project {0}
+build_cannotSaveStates = Error saving build states
+build_initializationError = Builder initialization error
+build_serializationError = Builder serialization error
### build inconsistencies
-build.classFileCollision = Class file collision: {0}
-build.duplicateClassFile = The type {0} is already defined
-build.duplicateResource = The resource is a duplicate of {0} and was not copied to the output folder
-build.inconsistentClassFile = A class file was not written. The project may be inconsistent, if so try refreshing this project and building it
-build.inconsistentProject = The project was not built due to "{0}". Fix the problem, then try refreshing this project and building it since it may be inconsistent
-build.incompleteClassPath = The project was not built since its build path is incomplete. Cannot find the class file for {0}. Fix the build path then try building this project
-build.missingSourceFile = The project was not built since the source file {0} could not be read
-build.prereqProjectHasClasspathProblems = The project was not built since it depends on {0}, which has build path errors
-build.prereqProjectMustBeRebuilt = The project cannot be built until its prerequisite {0} is built. Cleaning and building all projects is recommended
-build.abortDueToClasspathProblems = The project cannot be built until build path errors are resolved
+build_classFileCollision = Class file collision: {0}
+build_duplicateClassFile = The type {0} is already defined
+build_duplicateResource = The resource is a duplicate of {0} and was not copied to the output folder
+build_inconsistentClassFile = A class file was not written. The project may be inconsistent, if so try refreshing this project and building it
+build_inconsistentProject = The project was not built due to "{0}". Fix the problem, then try refreshing this project and building it since it may be inconsistent
+build_incompleteClassPath = The project was not built since its build path is incomplete. Cannot find the class file for {0}. Fix the build path then try building this project
+build_missingSourceFile = The project was not built since the source file {0} could not be read
+build_prereqProjectHasClasspathProblems = The project was not built since it depends on {0}, which has build path errors
+build_prereqProjectMustBeRebuilt = The project cannot be built until its prerequisite {0} is built. Cleaning and building all projects is recommended
+build_abortDueToClasspathProblems = The project cannot be built until build path errors are resolved
### status
-status.cannotUseDeviceOnPath = Operation requires a path with no device. Path specified was: {0}
-status.coreException = Core exception
-status.defaultPackageReadOnly = Default package is read-only
-status.evaluationError = Evaluation error: {0}
-status.JDOMError = JDOM error
-status.IOException = I/O exception
-status.indexOutOfBounds = Index out of bounds
-status.invalidContents = Invalid contents specified
-status.invalidDestination = Invalid destination: ''{0}''
-status.invalidName = Invalid name specified: {0}
-status.invalidPackage = Invalid package: {0}
-status.invalidPath = Invalid path: ''{0}''
-status.invalidProject = Invalid project: {0}
-status.invalidResource = Invalid resource: {0}
-status.invalidResourceType = Invalid resource type for {0}
-status.invalidSibling = Invalid sibling: {0}
-status.nameCollision = {0} already exists in target
-status.noLocalContents = Cannot find local contents for resource: {0}
-status.OK = OK
-status.readOnly = {0} is read-only
-status.targetException = Target exception
-status.updateConflict = Update conflict
+status_cannotUseDeviceOnPath = Operation requires a path with no device. Path specified was: {0}
+status_coreException = Core exception
+status_defaultPackageReadOnly = Default package is read-only
+status_evaluationError = Evaluation error: {0}
+status_JDOMError = JDOM error
+status_IOException = I/O exception
+status_indexOutOfBounds = Index out of bounds
+status_invalidContents = Invalid contents specified
+status_invalidDestination = Invalid destination: ''{0}''
+status_invalidName = Invalid name specified: {0}
+status_invalidPackage = Invalid package: {0}
+status_invalidPath = Invalid path: ''{0}''
+status_invalidProject = Invalid project: {0}
+status_invalidResource = Invalid resource: {0}
+status_invalidResourceType = Invalid resource type for {0}
+status_invalidSibling = Invalid sibling: {0}
+status_nameCollision = {0} already exists in target
+status_noLocalContents = Cannot find local contents for resource: {0}
+status_OK = OK
+status_readOnly = {0} is read-only
+status_targetException = Target exception
+status_updateConflict = Update conflict
### classpath
-classpath.buildPath = Build path
-classpath.cannotNestEntryInEntry = Cannot nest ''{0}'' inside ''{1}''. To enable the nesting exclude ''{2}'' from ''{1}''
-classpath.cannotNestEntryInLibrary = Cannot nest ''{0}'' inside library ''{1}''
-classpath.cannotNestEntryInOutput = Cannot nest ''{0}'' inside output folder ''{1}''
-classpath.cannotNestOutputInEntry = Cannot nest output folder ''{0}'' inside ''{1}''
-classpath.cannotNestOutputInOutput = Cannot nest output folder ''{0}'' inside output folder ''{1}''
-classpath.cannotReadClasspathFile = Unable to read ''.classpath'' file of project {0}
-classpath.cannotReferToItself = Project cannot reference itself: {0}
-classpath.cannotUseDistinctSourceFolderAsOutput = Source folder ''{0}'' in project {2} cannot output to distinct source folder ''{1}''
-classpath.cannotUseLibraryAsOutput = Source folder ''{0}'' in project {2} cannot output to library ''{1}''
-classpath.closedProject = Required project: {0} needs to be open
-classpath.couldNotWriteClasspathFile = Could not write ''.classpath'' file of project {0}: {1}
-classpath.cycle = A cycle was detected in the build path of project: {0}
-classpath.duplicateEntryPath = Build path contains duplicate entry: ''{0}'' for project {1}
-classpath.illegalContainerPath = Illegal classpath container path: ''{0}'' in project {1}, must have at least one segment (containerID+hints)
-classpath.illegalEntryInClasspathFile = Illegal entry in ''.classpath'' of project {0} file: {1}
-classpath.illegalLibraryPath = Illegal path for required library: ''{0}'' in project {1}
-classpath.illegalLibraryArchive = Illegal type of archive for required library: ''{0}'' in project {1}
-classpath.illegalExternalFolder = Required library cannot denote external folder: ''{0}'' for project {1}
-classpath.illegalProjectPath = Illegal path for required project: ''{0}'' in project {1}
-classpath.illegalSourceFolderPath = Illegal path for required source folder: ''{0}'' in project {1}
-classpath.illegalVariablePath = Illegal classpath variable path: ''{0}'' in project {1}, must have at least one segment
-classpath.invalidClasspathInClasspathFile = Invalid build path in ''.classpath'' file of project {0}: {1}
-classpath.invalidContainer = Invalid classpath container: ''{0}'' in project {1}
-classpath.mustEndWithSlash = End exclusion filter ''{0}'' with / to fully exclude ''{1}''
-classpath.unboundContainerPath = Unbound classpath container: ''{0}'' in project {1}
-classpath.unboundLibrary = Project {1} is missing required library: ''{0}''
-classpath.unboundProject = Project {1} is missing required Java project: ''{0}''
-classpath.settingOutputLocationProgress = Setting output location for: ''{0}''
-classpath.settingProgress = Setting classpath for: {0}
-classpath.unboundSourceAttachment = Invalid source attachment: ''{0}'' for required library ''{1}'' in project {1}
-classpath.unboundSourceFolder = Project {1} is missing required source folder: ''{0}''
-classpath.unboundVariablePath = Unbound classpath variable: ''{0}'' in project {1}
-classpath.unknownKind = Unknown kind: ''{0}''
-classpath.xmlFormatError = XML format error in ''.classpath'' file of project {0}: {1}
-classpath.disabledInclusionExclusionPatterns = Inclusion or exclusion patterns are disabled in project {1}, cannot selectively include or exclude from entry: ''{0}''
-classpath.disabledMultipleOutputLocations = Multiple output locations are disabled in project {1}, cannot associate entry: ''{0}'' with a specific output
-classpath.incompatibleLibraryJDKLevel = Incompatible .class files version in required binaries. Project ''{0}'' is targeting a {1} runtime, but is compiled against ''{2}'' which requires a {3} runtime
+classpath_buildPath = Build path
+classpath_cannotNestEntryInEntry = Cannot nest ''{0}'' inside ''{1}''. To enable the nesting exclude ''{2}'' from ''{1}''
+classpath_cannotNestEntryInLibrary = Cannot nest ''{0}'' inside library ''{1}''
+classpath_cannotNestEntryInOutput = Cannot nest ''{0}'' inside output folder ''{1}''
+classpath_cannotNestOutputInEntry = Cannot nest output folder ''{0}'' inside ''{1}''
+classpath_cannotNestOutputInOutput = Cannot nest output folder ''{0}'' inside output folder ''{1}''
+classpath_cannotReadClasspathFile = Unable to read ''.classpath'' file of project {0}
+classpath_cannotReferToItself = Project cannot reference itself: {0}
+classpath_cannotUseDistinctSourceFolderAsOutput = Source folder ''{0}'' in project {2} cannot output to distinct source folder ''{1}''
+classpath_cannotUseLibraryAsOutput = Source folder ''{0}'' in project {2} cannot output to library ''{1}''
+classpath_closedProject = Required project: {0} needs to be open
+classpath_couldNotWriteClasspathFile = Could not write ''.classpath'' file of project {0}: {1}
+classpath_cycle = A cycle was detected in the build path of project: {0}
+classpath_duplicateEntryPath = Build path contains duplicate entry: ''{0}'' for project {1}
+classpath_illegalContainerPath = Illegal classpath container path: ''{0}'' in project {1}, must have at least one segment (containerID+hints)
+classpath_illegalEntryInClasspathFile = Illegal entry in ''_classpath'' of project {0} file: {1}
+classpath_illegalLibraryPath = Illegal path for required library: ''{0}'' in project {1}
+classpath_illegalLibraryArchive = Illegal type of archive for required library: ''{0}'' in project {1}
+classpath_illegalExternalFolder = Required library cannot denote external folder: ''{0}'' for project {1}
+classpath_illegalProjectPath = Illegal path for required project: ''{0}'' in project {1}
+classpath_illegalSourceFolderPath = Illegal path for required source folder: ''{0}'' in project {1}
+classpath_illegalVariablePath = Illegal classpath variable path: ''{0}'' in project {1}, must have at least one segment
+classpath_invalidClasspathInClasspathFile = Invalid build path in ''.classpath'' file of project {0}: {1}
+classpath_invalidContainer = Invalid classpath container: ''{0}'' in project {1}
+classpath_mustEndWithSlash = End exclusion filter ''{0}'' with / to fully exclude ''{1}''
+classpath_unboundContainerPath = Unbound classpath container: ''{0}'' in project {1}
+classpath_unboundLibrary = Project {1} is missing required library: ''{0}''
+classpath_unboundProject = Project {1} is missing required Java project: ''{0}''
+classpath_settingOutputLocationProgress = Setting output location for: ''{0}''
+classpath_settingProgress = Setting classpath for: {0}
+classpath_unboundSourceAttachment = Invalid source attachment: ''{0}'' for required library ''{1}'' in project {1}
+classpath_unboundSourceFolder = Project {1} is missing required source folder: ''{0}''
+classpath_unboundVariablePath = Unbound classpath variable: ''{0}'' in project {1}
+classpath_unknownKind = Unknown kind: ''{0}''
+classpath_xmlFormatError = XML format error in ''.classpath'' file of project {0}: {1}
+classpath_disabledInclusionExclusionPatterns = Inclusion or exclusion patterns are disabled in project {1}, cannot selectively include or exclude from entry: ''{0}''
+classpath_disabledMultipleOutputLocations = Multiple output locations are disabled in project {1}, cannot associate entry: ''{0}'' with a specific output
+classpath_incompatibleLibraryJDKLevel = Incompatible .class files version in required binaries. Project ''{0}'' is targeting a {1} runtime, but is compiled against ''{2}'' which requires a {3} runtime
### miscellaneous
-file.notFound = File not found: ''{0}''
-file.badFormat = Bad format
-path.nullPath = Path cannot be null
-path.mustBeAbsolute = Path must be absolute
-cache.invalidLoadFactor = Incorrect load factor
-savedState.jobName = Processing Java changes since last activation
+file_notFound = File not found: ''{0}''
+file_badFormat = Bad format
+path_nullPath = Path cannot be null
+path_mustBeAbsolute = Path must be absolute
+cache_invalidLoadFactor = Incorrect load factor
+savedState_jobName = Processing Java changes since last activation
### access restrictions
-restrictedAccess.project = The type {0} is not imported from required project {1}
-restrictedAccess.library = The type {0} is not imported from required library {1}
+restrictedAccess_project = The type {0} is not imported from required project {1}
+restrictedAccess_library = The type {0} is not imported from required library {1}
### java conventions
-convention.unit.nullName = Compilation unit name must not be null
-convention.unit.notJavaName = Compilation unit name must end with .java
-convention.classFile.nullName = .class file name must not be null
-convention.classFile.notClassFileName = .class file name must end with .class
-convention.illegalIdentifier = ''{0}'' is not a valid Java identifier
-convention.import.nullImport = An import declaration must not be null
-convention.import.unqualifiedImport = An import declaration must not end with an unqualified *
-convention.type.nullName = A Java type name must not be null
-convention.type.nameWithBlanks = A Java type name must not start or end with a blank
-convention.type.dollarName = By convention, Java type names usually don''t contain the $ character
-convention.type.lowercaseName = By convention, Java type names usually start with an uppercase letter
-convention.type.invalidName = The type name ''{0}'' is not a valid identifier
-convention.package.nullName = A package name must not be null
-convention.package.emptyName = A package name must not be empty
-convention.package.dotName = A package name cannot start or end with a dot
-convention.package.nameWithBlanks = A package name must not start or end with a blank
-convention.package.consecutiveDotsName = A package name must not contain two consecutive dots
-convention.package.uppercaseName = By convention, package names usually start with a lowercase letter
-convention.compiler.invalidCompilerOption = ''{0}'' is not valid value for ''{1}'' compiler option.
-convention.compiler.incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required
-convention.compiler.incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required
-convention.compiler.incompatibleComplianceForTarget = Compliance level ''{0}'' is incompatible with target level ''{1}''. A compliance level ''{1}'' or better is required
+convention_unit_nullName = Compilation unit name must not be null
+convention_unit_notJavaName = Compilation unit name must end with .java
+convention_classFile_nullName = .class file name must not be null
+convention_classFile_notClassFileName = .class file name must end with .class
+convention_illegalIdentifier = ''{0}'' is not a valid Java identifier
+convention_import_nullImport = An import declaration must not be null
+convention_import_unqualifiedImport = An import declaration must not end with an unqualified *
+convention_type_nullName = A Java type name must not be null
+convention_type_nameWithBlanks = A Java type name must not start or end with a blank
+convention_type_dollarName = By convention, Java type names usually don''t contain the $ character
+convention_type_lowercaseName = By convention, Java type names usually start with an uppercase letter
+convention_type_invalidName = The type name ''{0}'' is not a valid identifier
+convention_package_nullName = A package name must not be null
+convention_package_emptyName = A package name must not be empty
+convention_package_dotName = A package name cannot start or end with a dot
+convention_package_nameWithBlanks = A package name must not start or end with a blank
+convention_package_consecutiveDotsName = A package name must not contain two consecutive dots
+convention_package_uppercaseName = By convention, package names usually start with a lowercase letter
+convention_compiler_invalidCompilerOption = ''{0}'' is not valid value for ''{1}'' compiler option.
+convention_compiler_incompatibleTargetForSource = Target level ''{0}'' is incompatible with source level ''{1}''. A target level ''{1}'' or better is required
+convention_compiler_incompatibleComplianceForSource = Compliance level ''{0}'' is incompatible with source level ''{1}''. A compliance level ''{1}'' or better is required
+convention_compiler_incompatibleComplianceForTarget = Compliance level ''{0}'' is incompatible with target level ''{1}''. A compliance level ''{1}'' or better is required
### DOM
-dom.cannotDetail = Unable to generate detailed source indexes
-dom.nullTypeParameter = Cannot add parameter with null type
-dom.nullNameParameter = Cannot add parameter with null name
-dom.nullReturnType = Return type cannot be null
-dom.nullExceptionType = Cannot add null exception
-dom.mismatchArgNamesAndTypes = Types and names must have identical length
-dom.addNullChild = Attempt to add null child
-dom.addIncompatibleChild = Attempt to add child of incompatible type
-dom.addChildWithParent = Attempt to add child that is already parented
-dom.unableAddChild = Attempt to add child to node that cannot have children
-dom.addAncestorAsChild = Attempt to add ancestor as child
-dom.addNullSibling = Attempt to insert null sibling
-dom.addSiblingBeforeRoot = Attempt to insert sibling before root node
-dom.addIncompatibleSibling = Attempt to insert sibling of incompatible type
-dom.addSiblingWithParent = Attempt to insert sibling that is already parented
-dom.addAncestorAsSibling = Attempt to insert ancestor as sibling
-dom.addNullInterface = Cannot add null interface
-dom.nullInterfaces = Illegal to set super interfaces to null
+dom_cannotDetail = Unable to generate detailed source indexes
+dom_nullTypeParameter = Cannot add parameter with null type
+dom_nullNameParameter = Cannot add parameter with null name
+dom_nullReturnType = Return type cannot be null
+dom_nullExceptionType = Cannot add null exception
+dom_mismatchArgNamesAndTypes = Types and names must have identical length
+dom_addNullChild = Attempt to add null child
+dom_addIncompatibleChild = Attempt to add child of incompatible type
+dom_addChildWithParent = Attempt to add child that is already parented
+dom_unableAddChild = Attempt to add child to node that cannot have children
+dom_addAncestorAsChild = Attempt to add ancestor as child
+dom_addNullSibling = Attempt to insert null sibling
+dom_addSiblingBeforeRoot = Attempt to insert sibling before root node
+dom_addIncompatibleSibling = Attempt to insert sibling of incompatible type
+dom_addSiblingWithParent = Attempt to insert sibling that is already parented
+dom_addAncestorAsSibling = Attempt to insert ancestor as sibling
+dom_addNullInterface = Cannot add null interface
+dom_nullInterfaces = Illegal to set super interfaces to null
### correction
-correction.nullRequestor = Requestor cannot be null
-correction.nullUnit = Compilation unit cannot be null
+correction_nullRequestor = Requestor cannot be null
+correction_nullUnit = Compilation unit cannot be null
### Eclipse Java Core Search messages.
-engine.searching = Searching...
-engine.searching.indexing = {0}: lookup indexes...
-engine.searching.matching = {0}: locate matches...
-exception.wrongFormat = Wrong format
-process.name = Java indexing
-manager.filesToIndex = {0} files to index
-manager.indexingInProgress = Java indexing in progress
+engine_searching = Searching...
+engine_searching_indexing = {0}: lookup indexes...
+engine_searching_matching = {0}: locate matches...
+exception_wrongFormat = Wrong format
+process_name = Java indexing
+manager_filesToIndex = {0} files to index
+manager_indexingInProgress = Java indexing in progress
### Disassembler messages
### disassembler
-disassembler.description = Default classfile disassembler
-disassembler.opentypedeclaration =\ {
-disassembler.closetypedeclaration = }
-disassembler.parametername = arg
-disassembler.endofmethodheader = ;
-disassembler.begincommentline = //\
-disassembler.fieldhasconstant =\ =\
-disassembler.endoffieldheader = ;
-disassembler.sourceattributeheader = Compiled from
-disassembler.enclosingmethodheader = Enclosing Method:
-disassembler.exceptiontableheader = Exception Table:
-disassembler.linenumberattributeheader = Line numbers:
-disassembler.localvariabletableattributeheader = Local variable table:
-disassembler.localvariabletypetableattributeheader = Local variable type table:
-disassembler.arraydimensions = []
-disassembler.innerattributesheader = Inner classes:
-disassembler.inner_class_info_name = inner class info:
-disassembler.outer_class_info_name = outer class info:
-disassembler.inner_name = inner name:
-disassembler.inner_accessflags = accessflags:
-disassembler.genericattributeheader = Attribute:\
-disassembler.genericattributename = Name:
-disassembler.genericattributelength =\ Length:
-disassembler.signatureattributeheader = Signature:\
-disassembler.indentation = \
-disassembler.constantpoolindex =\ #
-disassembler.classmemberseparator = .
-disassembler.space = \
-disassembler.comma = ,
-disassembler.openinnerclassentry = [
-disassembler.closeinnerclassentry = ]
-disassembler.deprecated =\ (deprecated)
-disassembler.constantpoolheader = Constant pool:
-disassembler.constantpool.class = constant #{0} class: #{1} {2}
-disassembler.constantpool.double = constant #{0} double: {1}
-disassembler.constantpool.float = constant #{0} float: {1}
-disassembler.constantpool.integer = constant #{0} integer: {1}
-disassembler.constantpool.long = constant #{0} long: {1}
-disassembler.constantpool.string = constant #{0} string: #{1} {2}
-disassembler.constantpool.fieldref = constant #{0} field_ref: #{1}.#{2} {3}.{4}
-disassembler.constantpool.interfacemethodref = constant #{0} interface_method_ref: #{1}.#{2} {3}.{4}
-disassembler.constantpool.methodref = constant #{0} method_ref: #{1}.#{2} {3}.{4}
-disassembler.constantpool.name_and_type = constant #{0} name_and_type: #{1}.#{2} {3} {4}
-disassembler.constantpool.utf8 = constant #{0} utf8: {1}
-disassembler.annotationdefaultheader = Annotation Default:\
-disassembler.annotationdefaultvalue= {0} (constant type)
-disassembler.annotationenumvalue = {2}.{3}(enum type #{0}.#{1})
-disassembler.annotationclassvalue = {1} (#{0} class type)
-disassembler.annotationannotationvalue = annotation value =
-disassembler.annotationarrayvaluestart = [
-disassembler.annotationarrayvalueend = ]
-disassembler.annotationentrystart = #{0} @{1}(
-disassembler.annotationentryend = )
-disassembler.annotationcomponent = #{0} {1}=
-disassembler.runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\
-disassembler.runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\
-disassembler.runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\
-disassembler.runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\
-disassembler.parameterannotationentrystart=Number of annotations for parameter {0}: {1}
+disassembler_description = Default classfile disassembler
+disassembler_opentypedeclaration =\ {
+disassembler_closetypedeclaration = }
+disassembler_parametername = arg
+disassembler_endofmethodheader = ;
+disassembler_begincommentline = //\
+disassembler_fieldhasconstant =\ =\
+disassembler_endoffieldheader = ;
+disassembler_sourceattributeheader = Compiled from
+disassembler_enclosingmethodheader = Enclosing Method:
+disassembler_exceptiontableheader = Exception Table:
+disassembler_linenumberattributeheader = Line numbers:
+disassembler_localvariabletableattributeheader = Local variable table:
+disassembler_localvariabletypetableattributeheader = Local variable type table:
+disassembler_arraydimensions = []
+disassembler_innerattributesheader = Inner classes:
+disassembler_inner_class_info_name = inner class info:
+disassembler_outer_class_info_name = outer class info:
+disassembler_inner_name = inner name:
+disassembler_inner_accessflags = accessflags:
+disassembler_genericattributeheader = Attribute:\
+disassembler_genericattributename = Name:
+disassembler_genericattributelength =\ Length:
+disassembler_signatureattributeheader = Signature:\
+disassembler_indentation = \
+disassembler_constantpoolindex =\ #
+disassembler_classmemberseparator = .
+disassembler_space = \
+disassembler_comma = ,
+disassembler_openinnerclassentry = [
+disassembler_closeinnerclassentry = ]
+disassembler_deprecated =\ (deprecated)
+disassembler_constantpoolheader = Constant pool:
+disassembler_constantpool_class = constant #{0} class: #{1} {2}
+disassembler_constantpool_double = constant #{0} double: {1}
+disassembler_constantpool_float = constant #{0} float: {1}
+disassembler_constantpool_integer = constant #{0} integer: {1}
+disassembler_constantpool_long = constant #{0} long: {1}
+disassembler_constantpool_string = constant #{0} string: #{1} {2}
+disassembler_constantpool_fieldref = constant #{0} field.ref: #{1}_#{2} {3}_{4}
+disassembler_constantpool_interfacemethodref = constant #{0} interface.method.ref: #{1}.#{2} {3}_{4}
+disassembler_constantpool_methodref = constant #{0} method.ref: #{1}_#{2} {3}_{4}
+disassembler_constantpool_name_and_type = constant #{0} name.and.type: #{1}.#{2} {3} {4}
+disassembler_constantpool_utf8 = constant #{0} utf8: {1}
+disassembler_annotationdefaultheader = Annotation Default:\
+disassembler_annotationdefaultvalue= {0} (constant type)
+disassembler_annotationenumvalue = {2}_{3}(enum type #{0}.#{1})
+disassembler_annotationclassvalue = {1} (#{0} class type)
+disassembler_annotationannotationvalue = annotation value =
+disassembler_annotationarrayvaluestart = [
+disassembler_annotationarrayvalueend = ]
+disassembler_annotationentrystart = #{0} @{1}(
+disassembler_annotationentryend = )
+disassembler_annotationcomponent = #{0} {1}=
+disassembler_runtimevisibleannotationsattributeheader= RuntimeVisibleAnnotations:\
+disassembler_runtimeinvisibleannotationsattributeheader= RuntimeInvisibleAnnotations:\
+disassembler_runtimevisibleparameterannotationsattributeheader= RuntimeVisibleParameterAnnotations:\
+disassembler_runtimeinvisibleparameterannotationsattributeheader= RuntimeInvisibleParameterAnnotations:\
+disassembler_parameterannotationentrystart=Number of annotations for parameter {0}: {1}
### classfileformat decoding
-classfileformat.versiondetails =\ (version {0} : {1}.{2}, {3})
-classfileformat.methoddescriptor =Method descriptor
-classfileformat.fieldddescriptor =Field descriptor
-classfileformat.maxStack = Stack:
-classfileformat.maxLocals = Locals:
-classfileformat.superflagisnotset = no super bit
-classfileformat.superflagisset = super bit
-classfileformat.clinitname = {}
+classfileformat_versiondetails =\ (version {0} : {1}.{2}, {3})
+classfileformat_methoddescriptor =Method descriptor
+classfileformat_fieldddescriptor =Field descriptor
+classfileformat_maxStack = Stack:
+classfileformat_maxLocals = Locals:
+classfileformat_superflagisnotset = no super bit
+classfileformat_superflagisset = super bit
+classfileformat_clinitname = {}
### string displayed for each opcode
-classformat.invokeinterfacemethod =\ <Interface method
-classformat.invokeinterfacemethodclose = >
-classformat.invokespecialconstructor =\ <Constructor
-classformat.invokespecialconstructorclose = >
-classformat.invokespecialmethod =\ <Method
-classformat.invokespecialmethodclose = >
-classformat.invokestaticmethod =\ <Method
-classformat.invokestaticmethodclose = >
-classformat.invokevirtualmethod =\ <Method
-classformat.invokevirtualmethodclose = >
-classformat.getfield = \ <Field
-classformat.getfieldclose = >
-classformat.getstatic = \ <Field
-classformat.getstaticclose = >
-classformat.putstatic =\ <Field
-classformat.putstaticclose = >
-classformat.putfield =\ <Field
-classformat.putfieldclose = >
-classformat.nargs =\ [nargs :
-classformat.interfacemethodrefindex = ] #
-classfileformat.anyexceptionhandler=any
-classfileformat.fielddescriptorindex=#
-classfileformat.exceptiontablefrom=[pc:
-classfileformat.exceptiontableto=, pc:
-classfileformat.exceptiontablegoto=] ->
-classfileformat.exceptiontablewhen =\ when :
-classfileformat.linenumbertablefrom=[pc:
-classfileformat.linenumbertableto=, line:
-classfileformat.linenumbertableclose=]
-classfileformat.localvariabletablefrom=[pc:
-classfileformat.localvariabletableto=, pc:
-classfileformat.localvariabletablelocalname=] local:
-classfileformat.localvariabletablelocalindex=\ index:
-classfileformat.localvariabletablelocaltype=\ type:
\ No newline at end of file
+classformat_invokeinterfacemethod =\ <Interface method
+classformat_invokeinterfacemethodclose = >
+classformat_invokespecialconstructor =\ <Constructor
+classformat_invokespecialconstructorclose = >
+classformat_invokespecialmethod =\ <Method
+classformat_invokespecialmethodclose = >
+classformat_invokestaticmethod =\ <Method
+classformat_invokestaticmethodclose = >
+classformat_invokevirtualmethod =\ <Method
+classformat_invokevirtualmethodclose = >
+classformat_getfield = \ <Field
+classformat_getfieldclose = >
+classformat_getstatic = \ <Field
+classformat_getstaticclose = >
+classformat_putstatic =\ <Field
+classformat_putstaticclose = >
+classformat_putfield =\ <Field
+classformat_putfieldclose = >
+classformat_nargs =\ [nargs :
+classformat_interfacemethodrefindex = ] #
+classfileformat_anyexceptionhandler=any
+classfileformat_fielddescriptorindex=#
+classfileformat_exceptiontablefrom=[pc:
+classfileformat_exceptiontableto=, pc:
+classfileformat_exceptiontablegoto=] ->
+classfileformat_exceptiontablewhen =\ when :
+classfileformat_linenumbertablefrom=[pc:
+classfileformat_linenumbertableto=, line:
+classfileformat_linenumbertableclose=]
+classfileformat_localvariabletablefrom=[pc:
+classfileformat_localvariabletableto=, pc:
+classfileformat_localvariabletablelocalname=] local:
+classfileformat_localvariabletablelocalindex=\ index:
+classfileformat_localvariabletablelocaltype=\ type:
\ No newline at end of file
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-19 15:44:18
|
Revision: 1806
http://svn.sourceforge.net/rubyeclipse/?rev=1806&view=rev
Author: cawilliams
Date: 2007-01-19 07:44:11 -0800 (Fri, 19 Jan 2007)
Log Message:
-----------
yay, our new interpreter stuff is hooked in and works. Now I need to slowly remove the old stuff in the pipeline (like InterpreterRunner and InterpreterRunnerConfiguration).
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DataFlowTypeInferrer.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.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/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMRunner.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TS_InternalLaunching.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/launching/tests/TS_Launching.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DataFlowTypeInferrer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DataFlowTypeInferrer.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DataFlowTypeInferrer.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -37,9 +37,10 @@
import org.rubypeople.rdt.internal.ti.util.ScopedNodeLocator;
public class DataFlowTypeInferrer implements ITypeInferrer {
+ private static final boolean VERBOSE = false;
+
private void sysout(String string) {
- // false to suppress debug
- if ( true ) {
+ if ( VERBOSE ) {
System.out.println(string);
}
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/ti/DefaultTypeInferrer.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -174,7 +174,7 @@
private void tryLocalVarNode(Node node, List<ITypeGuess> guesses)
{
- System.out.println(node.getClass().getName());
+ //System.out.println(node.getClass().getName());
if ( node instanceof LocalVarNode )
{
LocalVarNode localVarNode = (LocalVarNode)node;
@@ -209,12 +209,12 @@
if ( argsNode != null )
{
int argNumber = getArgumentIndex(argsNode,localVarName);
- System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to the enclosing method ");
+ //System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to the enclosing method ");
// Find enclosing method
Node defNode = FirstPrecursorNodeLocator.Instance().findFirstPrecursor(rootNode, nodeStart, new INodeAcceptor(){
public boolean doesAccept(Node node) {
- System.out.println("Looking for enclosing method, checking: " + node.getClass().getName() + "[" + node.getPosition().getStartOffset() + ".." + node.getPosition().getEndOffset() + "]" );
+ //System.out.println("Looking for enclosing method, checking: " + node.getClass().getName() + "[" + node.getPosition().getStartOffset() + ".." + node.getPosition().getEndOffset() + "]" );
ArgsNode argsNode = null;
if ( node instanceof DefnNode ) argsNode = ((DefnNode)node).getArgsNode();
if ( node instanceof DefsNode ) argsNode = ((DefsNode)node).getArgsNode();
@@ -227,7 +227,7 @@
if ( defNode instanceof DefnNode ) methodName = ((DefnNode)defNode).getName();
if ( defNode instanceof DefsNode ) methodName = ((DefsNode)defNode).getName();
- System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to method " + methodName );
+ //System.out.println("Variable " + localVarName + " is the " + argNumber + "th argument to method " + methodName );
// Find all invocations of the surrounding method.
//todo: from easiest to hardest:
Modified: 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-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -44,6 +44,8 @@
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();
@@ -62,6 +64,8 @@
return commandLine;
}
+
+
protected void addDebugCommandLineArgument(List<String> commandLine) {
}
Modified: 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-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -117,15 +117,14 @@
protected List<String> renderLoadPath() {
List<String> loadPath = new ArrayList<String>();
RubyProject project = this.getProject();
- addToLoadPath(loadPath, project.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().toOSString());
+ addToLoadPath(loadPath, entries[i].getPath().makeAbsolute().toFile().getAbsolutePath());
}
} catch (RubyModelException e) {
- // TODO Auto-generated catch block
e.printStackTrace();
}
if (new Path(this.getFileName()).segmentCount() > 1) { ;
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -30,6 +30,20 @@
public static String StandardVMType_Not_a_JDK_Root__Java_executable_was_not_found_1;
public static String StandardVMType_ok_2;
public static String StandardVMType_Not_a_JDK_root__System_library_was_not_found__1;
+
+ public static String AbstractVMRunner_0;
+ public static String vmRunnerConfig_assert_classNotNull;
+ public static String vmRunnerConfig_assert_classPathNotNull;
+ public static String vmRunnerConfig_assert_vmArgsNotNull;
+ public static String vmRunnerConfig_assert_programArgsNotNull;
+ public static String StandardVMRunner__0__at_localhost__1__1;
+ public static String StandardVMRunner__0____1___2;
+ public static String StandardVMRunner_Specified_working_directory_does_not_exist_or_is_not_a_directory___0__3;
+ public static String StandardVMRunner_Unable_to_locate_executable_for__0__1;
+ public static String StandardVMRunner_Specified_executable__0__does_not_exist_for__1__4;
+ public static String StandardVMRunner_Launching_VM____1;
+ public static String StandardVMRunner_Constructing_command_line____2;
+ public static String StandardVMRunner_Starting_virtual_machine____3;
private LaunchingMessages() {}
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-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -2,6 +2,7 @@
import java.io.File;
import java.io.IOException;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
@@ -9,6 +10,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.rubypeople.rdt.launching.AbstractVMInstall;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
import org.rubypeople.rdt.launching.IVMInstallType;
public class StandardVM extends AbstractVMInstall {
@@ -26,7 +28,7 @@
LaunchingPlugin.debug("Launching: " + args) ;
LaunchingPlugin.debug("Working Dir: " + workingDirectory) ;
List rubyCmd = new ArrayList();
- rubyCmd.add(this.getCommand());
+ rubyCmd.add(getCommand());
rubyCmd.addAll(args);
return fCommandExecutor.exec((String[]) rubyCmd.toArray(new String[] {}), workingDirectory);
} catch (IOException e) {
@@ -34,16 +36,46 @@
"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 String getCommand() throws IllegalCommandException {
- // TODO Auto-generated method stub
- 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();
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMRunner.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -0,0 +1,246 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.launching;
+
+
+import java.io.File;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.rubypeople.rdt.launching.AbstractVMRunner;
+import org.rubypeople.rdt.launching.IRubyLaunchConfigurationConstants;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.VMRunnerConfiguration;
+
+public class StandardVMRunner extends AbstractVMRunner {
+ protected IVMInstall fVMInstance;
+
+ public StandardVMRunner(IVMInstall vmInstance) {
+ fVMInstance= vmInstance;
+ }
+
+ protected String renderDebugTarget(String classToRun, int host) {
+ String format= LaunchingMessages.StandardVMRunner__0__at_localhost__1__1;
+ return MessageFormat.format(format, new String[] { classToRun, String.valueOf(host) });
+ }
+
+ public static String renderProcessLabel(String[] commandLine) {
+ String format= LaunchingMessages.StandardVMRunner__0____1___2;
+ String timestamp= DateFormat.getDateTimeInstance(DateFormat.MEDIUM, DateFormat.MEDIUM).format(new Date(System.currentTimeMillis()));
+ return MessageFormat.format(format, new String[] { commandLine[0], timestamp });
+ }
+
+ protected static String renderCommandLine(String[] commandLine) {
+ if (commandLine.length < 1)
+ return ""; //$NON-NLS-1$
+ StringBuffer buf= new StringBuffer();
+ for (int i= 0; i < commandLine.length; i++) {
+ buf.append(' ');
+ char[] characters= commandLine[i].toCharArray();
+ StringBuffer command= new StringBuffer();
+ boolean containsSpace= false;
+ for (int j = 0; j < characters.length; j++) {
+ char character= characters[j];
+ if (character == '\"') {
+ command.append('\\');
+ } else if (character == ' ') {
+ containsSpace = true;
+ }
+ command.append(character);
+ }
+ if (containsSpace) {
+ buf.append('\"');
+ buf.append(command.toString());
+ buf.append('\"');
+ } else {
+ buf.append(command.toString());
+ }
+ }
+ return buf.toString();
+ }
+
+ protected void addArguments(String[] args, List v) {
+ if (args == null) {
+ return;
+ }
+ for (int i= 0; i < args.length; i++) {
+ v.add(args[i]);
+ }
+ }
+
+ /**
+ * Returns the working directory to use for the launched VM,
+ * or <code>null</code> if the working directory is to be inherited
+ * from the current process.
+ *
+ * @return the working directory to use
+ * @exception CoreException if the working directory specified by
+ * the configuration does not exist or is not a directory
+ */
+ protected File getWorkingDir(VMRunnerConfiguration config) throws CoreException {
+ String path = config.getWorkingDirectory();
+ if (path == null) {
+ return null;
+ }
+ File dir = new File(path);
+ if (!dir.isDirectory()) {
+ abort(MessageFormat.format(LaunchingMessages.StandardVMRunner_Specified_working_directory_does_not_exist_or_is_not_a_directory___0__3, new String[] {path}), null, IRubyLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
+ }
+ return dir;
+ }
+
+ /**
+ * @see VMRunner#getPluginIdentifier()
+ */
+ protected String getPluginIdentifier() {
+ return LaunchingPlugin.getUniqueIdentifier();
+ }
+
+ /**
+ * Construct and return a String containing the full path of a java executable
+ * command such as 'java' or 'javaw.exe'. If the configuration specifies an
+ * explicit executable, that is used.
+ *
+ * @return full path to java executable
+ * @exception CoreException if unable to locate an executeable
+ */
+ protected String constructProgramString(VMRunnerConfiguration config) throws CoreException {
+
+ // Look for the user-specified java executable command
+ String command= null;
+ Map map= config.getVMSpecificAttributesMap();
+ if (map != null) {
+ command = (String)map.get(IRubyLaunchConfigurationConstants.ATTR_RUBY_COMMAND);
+ }
+
+ // If no java command was specified, use default executable
+ if (command == null) {
+ File exe = StandardVMType.findRubyExecutable(fVMInstance.getInstallLocation());
+ if (exe == null) {
+ abort(MessageFormat.format(LaunchingMessages.StandardVMRunner_Unable_to_locate_executable_for__0__1, new String[]{fVMInstance.getName()}), null, IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ return exe.getAbsolutePath();
+ }
+
+ // Build the path to the ruby executable. First try 'bin'
+ String installLocation = fVMInstance.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, fVMInstance.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();
+ }
+
+ protected String convertClassPath(String[] cp) {
+ int pathCount= 0;
+ StringBuffer buf= new StringBuffer();
+ if (cp.length == 0) {
+ return ""; //$NON-NLS-1$
+ }
+ for (int i= 0; i < cp.length; i++) {
+ if (pathCount > 0) {
+ buf.append(File.pathSeparator);
+ }
+ buf.append(cp[i]);
+ pathCount++;
+ }
+ return buf.toString();
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jdt.launching.IVMRunner#run(org.eclipse.jdt.launching.VMRunnerConfiguration, org.eclipse.debug.core.ILaunch, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void run(VMRunnerConfiguration config, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ subMonitor.beginTask(LaunchingMessages.StandardVMRunner_Launching_VM____1, 2);
+ subMonitor.subTask(LaunchingMessages.StandardVMRunner_Constructing_command_line____2);
+
+ String program= constructProgramString(config);
+
+ List arguments= new ArrayList();
+ arguments.add(program);
+
+ // VM args are the first thing after the java program so that users can specify
+ // options like '-client' & '-server' which are required to be the first option
+ String[] allVMArgs = combineVmArgs(config, fVMInstance);
+ addArguments(allVMArgs, arguments);
+
+ String[] cp= config.getClassPath();
+ if (cp.length > 0) {
+ arguments.add("-I"); //$NON-NLS-1$
+ arguments.add(convertClassPath(cp));
+ }
+ arguments.add(config.getClassToLaunch());
+
+ String[] programArgs= config.getProgramArguments();
+ addArguments(programArgs, arguments);
+
+ String[] cmdLine= new String[arguments.size()];
+ arguments.toArray(cmdLine);
+
+ String[] envp= config.getEnvironment();
+
+ subMonitor.worked(1);
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ return;
+ }
+
+ subMonitor.subTask(LaunchingMessages.StandardVMRunner_Starting_virtual_machine____3);
+ Process p= null;
+ File workingDir = getWorkingDir(config);
+ p= exec(cmdLine, workingDir, envp);
+ if (p == null) {
+ return;
+ }
+
+ // check for cancellation
+ if (monitor.isCanceled()) {
+ p.destroy();
+ return;
+ }
+
+ IProcess process= newProcess(launch, p, renderProcessLabel(cmdLine), getDefaultProcessMap());
+ process.setAttribute(IProcess.ATTR_CMDLINE, renderCommandLine(cmdLine));
+ subMonitor.worked(1);
+ subMonitor.done();
+ }
+
+}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMRunner.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IProcess;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
+
+/**
+ * Abstract implementation of a VM runner.
+ * <p>
+ * Clients implementing VM runners should subclass this class.
+ * </p>
+ * @see IVMRunner
+ * @since 2.0
+ */
+public abstract class AbstractVMRunner implements IVMRunner {
+
+ /**
+ * Throws a core exception with an error status object built from
+ * the given message, lower level exception, and error code.
+ *
+ * @param message the status message
+ * @param exception lower level exception associated with the
+ * error, or <code>null</code> if none
+ * @param code error code
+ * @throws CoreException The exception encapsulating the reason for the abort
+ */
+ protected void abort(String message, Throwable exception, int code) throws CoreException {
+ throw new CoreException(new Status(IStatus.ERROR, getPluginIdentifier(), code, message, exception));
+ }
+
+ /**
+ * Returns the identifier of the plug-in this VM runner
+ * originated from.
+ *
+ * @return plug-in identifier
+ */
+ protected abstract String getPluginIdentifier();
+
+ /**
+ * @see DebugPlugin#exec(String[], File)
+ */
+ protected Process exec(String[] cmdLine, File workingDirectory) throws CoreException {
+ return DebugPlugin.exec(cmdLine, workingDirectory);
+ }
+
+ /**
+ * @since 3.0
+ * @see DebugPlugin#exec(String[], File, String[])
+ */
+ protected Process exec(String[] cmdLine, File workingDirectory, String[] envp) throws CoreException {
+ return DebugPlugin.exec(cmdLine, workingDirectory, envp);
+ }
+
+ /**
+ * Returns the given array of strings as a single space-delimited string.
+ *
+ * @param cmdLine array of strings
+ * @return a single space-delimited string
+ */
+ protected String getCmdLineAsString(String[] cmdLine) {
+ StringBuffer buff= new StringBuffer();
+ for (int i = 0, numStrings= cmdLine.length; i < numStrings; i++) {
+ buff.append(cmdLine[i]);
+ buff.append(' ');
+ }
+ return buff.toString().trim();
+ }
+
+ /**
+ * Returns the default process attribute map for Ruby processes.
+ *
+ * @return default process attribute map for Ruby processes
+ */
+ protected Map getDefaultProcessMap() {
+ Map map = new HashMap();
+ map.put(IProcess.ATTR_PROCESS_TYPE, IRubyLaunchConfigurationConstants.ID_RUBY_PROCESS_TYPE);
+ return map;
+ }
+
+ /**
+ * Returns a new process aborting if the process could not be created.
+ * @param launch the launch the process is contained in
+ * @param p the system process to wrap
+ * @param label the label assigned to the process
+ * @param attributes values for the attribute map
+ * @return the new process
+ * @throws CoreException problems occurred creating the process
+ * @since 3.0
+ */
+ protected IProcess newProcess(ILaunch launch, Process p, String label, Map attributes) throws CoreException {
+ IProcess process= DebugPlugin.newProcess(launch, p, label, attributes);
+ if (process == null) {
+ p.destroy();
+ abort(LaunchingMessages.AbstractVMRunner_0, null, IRubyLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
+ }
+ return process;
+ }
+
+ /**
+ * Combines and returns VM arguments specified by the runner configuration,
+ * with those specified by the VM install, if any.
+ *
+ * @param configuration runner configuration
+ * @param vmInstall vm install
+ * @return combined VM arguments specified by the runner configuration
+ * and VM install
+ * @since 0.9.0
+ */
+ protected String[] combineVmArgs(VMRunnerConfiguration configuration, IVMInstall vmInstall) {
+ String[] launchVMArgs= configuration.getVMArguments();
+ String[] vmVMArgs = vmInstall.getVMArguments();
+ if (vmVMArgs == null || vmVMArgs.length == 0) {
+ return launchVMArgs;
+ }
+ String[] allVMArgs = new String[launchVMArgs.length + vmVMArgs.length];
+ System.arraycopy(launchVMArgs, 0, allVMArgs, 0, launchVMArgs.length);
+ System.arraycopy(vmVMArgs, 0, allVMArgs, launchVMArgs.length, vmVMArgs.length);
+ return allVMArgs;
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IRubyLaunchConfigurationConstants.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -1,10 +1,33 @@
package org.rubypeople.rdt.launching;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
+
public interface IRubyLaunchConfigurationConstants {
/**
+ * Status code indicating the specified working directory
+ * does not exist.
+ */
+ public static final int ERR_WORKING_DIRECTORY_DOES_NOT_EXIST = 108;
+
+ /**
* Status code indicating an unexpected internal error.
*/
- public static final int ERR_INTERNAL_ERROR = 150;
+ public static final int ERR_INTERNAL_ERROR = 150;
+ /**
+ * Identifier for the ruby process type, which is annotated on processes created
+ * by the local ruby application launch delegate.
+ *
+ * (value <code>"ruby"</code>).
+ */
+ public static final String ID_RUBY_PROCESS_TYPE = "ruby"; //$NON-NLS-1$
+
+ /**
+ * Attribute key for VM specific attributes found in the
+ * <code>ATTR_VM_INSTALL_TYPE_SPECIFIC_ATTRS_MAP</code>. The value is a String,
+ * indicating the String to use to invoke the Ruby VM.
+ */
+ public static final String ATTR_RUBY_COMMAND = LaunchingPlugin.getUniqueIdentifier() + ".RUBY_COMMAND"; //$NON-NLS-1$
+
}
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-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstall.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -20,10 +20,10 @@
/**
*
* @return
- * @throws IllegalCommandException
+ * @throws CoreException
* @deprecated
*/
- public String getCommand() throws IllegalCommandException;
+ public String getCommand() throws CoreException, IllegalCommandException;
/**
*
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMRunner.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMRunner.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMRunner.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -14,7 +14,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
-import org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration;
@@ -36,6 +35,6 @@
* @param monitor progress monitor or <code>null</code>
* @exception CoreException if an exception occurs while launching
*/
- public void run(InterpreterRunnerConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException;
+ public void run(VMRunnerConfiguration configuration, ILaunch launch, IProgressMonitor monitor) throws CoreException;
}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMRunnerConfiguration.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -0,0 +1,266 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.rubypeople.rdt.launching;
+
+
+import java.util.Map;
+
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
+
+/**
+ * Holder for various arguments passed to a VM runner.
+ * Mandatory parameters are passed in the constructor; optional arguments, via setters.
+ * <p>
+ * Clients may instantiate this class; it is not intended to be subclassed.
+ * </p>
+ */
+public class VMRunnerConfiguration {
+ private String fClassToLaunch;
+ private String[] fVMArgs;
+ private String[] fProgramArgs;
+ private String[] fEnvironment;
+ private String[] fClassPath;
+ private String[] fBootClassPath;
+ private String fWorkingDirectory;
+ private Map fVMSpecificAttributesMap;
+ private boolean fResume = true;
+
+ private static final String[] fgEmpty= new String[0];
+
+ /**
+ * Creates a new configuration for launching a VM to run the given main class
+ * using the given class path.
+ *
+ * @param classToLaunch The fully qualified name of the class to launch. May not be null.
+ * @param classPath The classpath. May not be null.
+ */
+ public VMRunnerConfiguration(String classToLaunch, String[] classPath) {
+ if (classToLaunch == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_classNotNull);
+ }
+ if (classPath == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_classPathNotNull);
+ }
+ fClassToLaunch= classToLaunch;
+ fClassPath= classPath;
+ }
+
+ /**
+ * Sets the <code>Map</code> that contains String name/value pairs that represent
+ * VM-specific attributes.
+ *
+ * @param map the <code>Map</code> of VM-specific attributes.
+ * @since 2.0
+ */
+ public void setVMSpecificAttributesMap(Map map) {
+ fVMSpecificAttributesMap = map;
+ }
+
+ /**
+ * Sets the custom VM arguments. These arguments will be appended to the list of
+ * VM arguments that a VM runner uses when launching a VM. Typically, these VM arguments
+ * are set by the user.
+ * These arguments will not be interpreted by a VM runner, the client is responsible for
+ * passing arguments compatible with a particular VM runner.
+ *
+ * @param args the list of VM arguments
+ */
+ public void setVMArguments(String[] args) {
+ if (args == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_vmArgsNotNull);
+ }
+ fVMArgs= args;
+ }
+
+ /**
+ * Sets the custom program arguments. These arguments will be appended to the list of
+ * program arguments that a VM runner uses when launching a VM (in general: none).
+ * Typically, these VM arguments are set by the user.
+ * These arguments will not be interpreted by a VM runner, the client is responsible for
+ * passing arguments compatible with a particular VM runner.
+ *
+ * @param args the list of arguments
+ */
+ public void setProgramArguments(String[] args) {
+ if (args == null) {
+ throw new IllegalArgumentException(LaunchingMessages.vmRunnerConfig_assert_programArgsNotNull);
+ }
+ fProgramArgs= args;
+ }
+
+ /**
+ * Sets the environment for the Java program. The Java VM will be
+ * launched in the given environment.
+ *
+ * @param environment the environment for the Java program specified as an array
+ * of strings, each element specifying an environment variable setting in the
+ * format <i>name</i>=<i>value</i>
+ * @since 3.0
+ */
+ public void setEnvironment(String[] environment) {
+ fEnvironment= environment;
+ }
+
+ /**
+ * Sets the boot classpath. Note that the boot classpath will be passed to the
+ * VM "as is". This means it has to be complete. Interpretation of the boot class path
+ * is up to the VM runner this object is passed to.
+ * <p>
+ * In release 3.0, support has been added for appending and prepending the
+ * boot classpath. Generally an <code>IVMRunner</code> should use the prepend,
+ * main, and append boot classpaths provided. However, in the case that an
+ * <code>IVMRunner</code> does not support these options, a complete bootpath
+ * should also be specified.
+ * </p>
+ * @param bootClassPath The boot classpath. An empty array indicates an empty
+ * bootpath and <code>null</code> indicates a default bootpath.
+ */
+ public void setBootClassPath(String[] bootClassPath) {
+ fBootClassPath= bootClassPath;
+ }
+
+ /**
+ * Returns the <code>Map</code> that contains String name/value pairs that represent
+ * VM-specific attributes.
+ *
+ * @return The <code>Map</code> of VM-specific attributes or <code>null</code>.
+ * @since 2.0
+ */
+ public Map getVMSpecificAttributesMap() {
+ return fVMSpecificAttributesMap;
+ }
+
+ /**
+ * Returns the name of the class to launch.
+ *
+ * @return The fully qualified name of the class to launch. Will not be <code>null</code>.
+ */
+ public String getClassToLaunch() {
+ return fClassToLaunch;
+ }
+
+ /**
+ * Returns the classpath.
+ *
+ * @return the classpath
+ */
+ public String[] getClassPath() {
+ return fClassPath;
+ }
+
+ /**
+ * Returns the boot classpath. An empty array indicates an empty
+ * bootpath and <code>null</code> indicates a default bootpath.
+ * <p>
+ * In 3.0, support has been added for prepending and appending to the
+ * boot classpath. The new attributes are stored in the VM specific
+ * attributes map using the following keys defined in
+ * <code>IJavaLaunchConfigurationConstants</code>:
+ * <ul>
+ * <li>ATTR_BOOTPATH_PREPEND</li>
+ * <li>ATTR_BOOTPATH_APPEND</li>
+ * <li>ATTR_BOOTPATH</li>
+ * </ul>
+ * </p>
+ * @return The boot classpath. An empty array indicates an empty
+ * bootpath and <code>null</code> indicates a default bootpath.
+ * @see #setBootClassPath(String[])
+ * @see IJavaLaunchConfigurationConstants
+ */
+ public String[] getBootClassPath() {
+ return fBootClassPath;
+ }
+
+ /**
+ * Returns the arguments to the VM itself.
+ *
+ * @return The VM arguments. Default is an empty array. Will not be <code>null</code>.
+ * @see #setVMArguments(String[])
+ */
+ public String[] getVMArguments() {
+ if (fVMArgs == null) {
+ return fgEmpty;
+ }
+ return fVMArgs;
+ }
+
+ /**
+ * Returns the arguments to the Java program.
+ *
+ * @return The Java program arguments. Default is an empty array. Will not be <code>null</code>.
+ * @see #setProgramArguments(String[])
+ */
+ public String[] getProgramArguments() {
+ if (fProgramArgs == null) {
+ return fgEmpty;
+ }
+ return fProgramArgs;
+ }
+
+ /**
+ * Returns the environment for the Java program or <code>null</code>
+ *
+ * @return The Java program environment. Default is <code>null</code>
+ * @since 3.0
+ */
+ public String[] getEnvironment() {
+ return fEnvironment;
+ }
+
+ /**
+ * Sets the working directory for a launched VM.
+ *
+ * @param path the absolute path to the working directory
+ * to be used by a launched VM, or <code>null</code> if
+ * the default working directory is to be inherited from the
+ * current process
+ * @since 2.0
+ */
+ public void setWorkingDirectory(String path) {
+ fWorkingDirectory = path;
+ }
+
+ /**
+ * Returns the working directory of a launched VM.
+ *
+ * @return the absolute path to the working directory
+ * of a launched VM, or <code>null</code> if the working
+ * directory is inherited from the current process
+ * @since 2.0
+ */
+ public String getWorkingDirectory() {
+ return fWorkingDirectory;
+ }
+
+ /**
+ * Sets whether the VM is resumed on startup when launched in
+ * debug mode. Has no effect when not in debug mode.
+ *
+ * @param resume whether to resume the VM on startup
+ * @since 3.0
+ */
+ public void setResumeOnStartup(boolean resume) {
+ fResume = resume;
+ }
+
+ /**
+ * Returns whether the VM is resumed on startup when launched
+ * in debug mode. Has no effect when no in debug mode. Default
+ * value is <code>true</code> for backwards compatibility.
+ *
+ * @return whether to resume the VM on startup
+ * @since 3.0
+ */
+ public boolean isResumeOnStartup() {
+ return fResume;
+ }
+}
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -65,7 +65,7 @@
RubyRuntime.saveVMConfiguration();
assertEquals(
"XML should indicate only one interpreter with it being the selected.",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings>\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"\" defaultVMConnector=\"\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
getVMsXML());
VMStandin standin2 = new VMStandin(vmType, "InterpreterTwo");
@@ -75,13 +75,13 @@
RubyRuntime.saveVMConfiguration();
assertEquals(
"XML should indicate both interpreters with the first one being selected.",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings>\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"\" defaultVMConnector=\"\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
getVMsXML());
RubyRuntime.setSelectedInterpreter(standin2);
assertEquals(
"XML should indicate both interpreters with the first one being selected.",
- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"" + RubyRuntime.getCompositeIdFromVM(standin2) + "\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<vmSettings defaultVM=\"" + RubyRuntime.getCompositeIdFromVM(standin2) + "\" defaultVMConnector=\"\">\r\n<vmType id=\"org.rubypeople.rdt.launching.StandardVMType\">\r\n<vm id=\"InterpreterOne\" name=\"InterpreterOne\" path=\"C:\\RubyInstallRootOne\"/>\r\n<vm id=\"InterpreterTwo\" name=\"InterpreterTwo\" path=\"C:\\RubyInstallRootTwo\"/>\r\n</vmType>\r\n</vmSettings>\r\n",
getVMsXML());
} finally {
vmType.disposeVMInstall("InterpreterOne");
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TS_InternalLaunching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TS_InternalLaunching.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TS_InternalLaunching.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -6,8 +6,7 @@
public class TS_InternalLaunching {
public static Test suite() {
- TestSuite suite = new TestSuite();
-
+ TestSuite suite = new TestSuite("Internal Launching");
suite.addTestSuite(TC_RubyInterpreter.class);
suite.addTestSuite(TC_RubyRuntime.class);
suite.addTestSuite(TC_RunnerLaunching.class) ;
Modified: trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/launching/tests/TS_Launching.java
===================================================================
--- trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/launching/tests/TS_Launching.java 2007-01-18 21:47:02 UTC (rev 1805)
+++ trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/launching/tests/TS_Launching.java 2007-01-19 15:44:11 UTC (rev 1806)
@@ -8,7 +8,7 @@
public class TS_Launching {
public static Test suite() {
- TestSuite suite = new TestSuite();
+ TestSuite suite = new TestSuite("Launching");
suite.addTest(TS_InternalLaunching.suite());
return suite;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 21:47:08
|
Revision: 1805
http://svn.sourceforge.net/rubyeclipse/?rev=1805&view=rev
Author: cawilliams
Date: 2007-01-18 13:47:02 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
renamed from EditInterpreterDialog
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/AddVMDialog.java
Added: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/AddVMDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/AddVMDialog.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/AddVMDialog.java 2007-01-18 21:47:02 UTC (rev 1805)
@@ -0,0 +1,390 @@
+package org.rubypeople.rdt.internal.debug.ui.preferences;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.rubypeople.rdt.internal.debug.ui.rubyvms.IAddVMDialogRequestor;
+import org.rubypeople.rdt.internal.debug.ui.rubyvms.RubyVMMessages;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusDialog;
+import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.ComboDialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
+import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringDialogField;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstall2;
+import org.rubypeople.rdt.launching.IVMInstallType;
+import org.rubypeople.rdt.launching.VMStandin;
+
+public class AddVMDialog extends StatusDialog {
+
+ protected IStatus[] allStatus = new IStatus[2];
+
+ protected IVMInstall fEditedVM;
+ private StringButtonDialogField fRubyVMRoot;
+ private StringDialogField fVMName;
+
+ private StringDialogField fVMArgs;
+
+ private IVMInstallType fSelectedVMType;
+ private IVMInstallType[] fVMTypes;
+ private ComboDialogField fVMTypeCombo;
+
+ private IStatus[] fStati;
+
+ private int fPrevIndex = -1;
+
+ private IAddVMDialogRequestor fRequestor;
+
+ public AddVMDialog(IAddVMDialogRequestor requestor, Shell shell, IVMInstallType[] vmInstallTypes, IVMInstall editedVM) {
+ super(shell);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ fRequestor= requestor;
+ fStati= new IStatus[5];
+ for (int i= 0; i < fStati.length; i++) {
+ fStati[i]= new StatusInfo();
+ }
+
+ fVMTypes= vmInstallTypes;
+ fSelectedVMType= editedVM != null ? editedVM.getVMInstallType() : vmInstallTypes[0];
+
+ fEditedVM= editedVM;
+ }
+
+ protected IStatus validateInterpreterLocationText() {
+ String locationName= fRubyVMRoot.getText();
+ IStatus s = null;
+ File file = null;
+ if (locationName.length() == 0) {
+ s = new StatusInfo(IStatus.INFO, RubyVMMessages.addVMDialog_enterLocation);
+ } else {
+ file= new File(locationName);
+ if (!file.exists()) {
+ s = new StatusInfo(IStatus.ERROR, RubyVMMessages.addVMDialog_locationNotExists);
+ } else {
+ final IStatus[] temp = new IStatus[1];
+ final File tempFile = file;
+ Runnable r = new Runnable() {
+ /**
+ * @see java.lang.Runnable#run()
+ */
+ public void run() {
+ temp[0] = getVMType().validateInstallLocation(tempFile);
+ }
+ };
+ BusyIndicator.showWhile(getShell().getDisplay(), r);
+ s = temp[0];
+ }
+ }
+ if (s.isOK()) {
+// fLibraryBlock.setHomeDirectory(file);
+ String name = fVMName.getText();
+ if (name == null || name.trim().length() == 0) {
+ // auto-generate VM name
+ try {
+ String genName = null;
+ IPath path = new Path(file.getCanonicalPath());
+ int segs = path.segmentCount();
+ if (segs == 1) {
+ genName = path.segment(0);
+ } else if (segs >= 2) {
+ String last = path.lastSegment();
+ if ("jre".equalsIgnoreCase(last)) { //$NON-NLS-1$
+ genName = path.segment(segs - 2);
+ } else {
+ genName = last;
+ }
+ }
+ if (genName != null) {
+ fVMName.setText(genName);
+ }
+ } catch (IOException e) {}
+ }
+ } else {
+// fLibraryBlock.setHomeDirectory(null);
+ }
+// fLibraryBlock.restoreDefaultLibraries();
+ return s;
+ }
+
+ private IVMInstallType getVMType() {
+ return fSelectedVMType;
+ }
+
+ protected void browseForInstallLocation() {
+ DirectoryDialog dialog= new DirectoryDialog(getShell());
+ dialog.setFilterPath(fRubyVMRoot.getText());
+ dialog.setMessage(RubyVMMessages.addVMDialog_pickJRERootDialog_message);
+ String newPath= dialog.open();
+ if (newPath != null) {
+ fRubyVMRoot.setText(newPath);
+ }
+ }
+
+ protected void okPressed() {
+ doOkPressed();
+ super.okPressed();
+ }
+
+ private void doOkPressed() {
+ if (fEditedVM == null) {
+ IVMInstall vm= new VMStandin(fSelectedVMType, createUniqueId(fSelectedVMType));
+ setFieldValuesToVM(vm);
+ fRequestor.vmAdded(vm);
+ } else {
+ setFieldValuesToVM(fEditedVM);
+ }
+ }
+
+ public void create() {
+ super.create();
+ fVMName.setFocus();
+ selectVMType();
+ }
+
+ private String createUniqueId(IVMInstallType vmType) {
+ String id= null;
+ do {
+ id= String.valueOf(System.currentTimeMillis());
+ } while (vmType.findVMInstall(id) != null);
+ return id;
+ }
+
+ private void selectVMType() {
+ for (int i= 0; i < fVMTypes.length; i++) {
+ if (fSelectedVMType == fVMTypes[i]) {
+ fVMTypeCombo.selectItem(i);
+ return;
+ }
+ }
+ }
+
+ private void updateVMType() {
+ int selIndex= fVMTypeCombo.getSelectionIndex();
+ if (selIndex == fPrevIndex) {
+ return;
+ }
+ fPrevIndex = selIndex;
+ if (selIndex >= 0 && selIndex < fVMTypes.length) {
+ fSelectedVMType= fVMTypes[selIndex];
+ }
+ setRubyVMLocationStatus(validateInterpreterLocationText());
+// fLibraryBlock.initializeFrom(fEditedVM, fSelectedVMType);
+ updateStatusLine();
+ }
+
+ private void setRubyVMLocationStatus(IStatus status) {
+ fStati[1]= status;
+ }
+
+ protected void updateStatusLine() {
+ IStatus max= null;
+ for (int i= 0; i < fStati.length; i++) {
+ IStatus curr= fStati[i];
+ if (curr.matches(IStatus.ERROR)) {
+ updateStatus(curr);
+ return;
+ }
+ if (max == null || curr.getSeverity() > max.getSeverity()) {
+ max= curr;
+ }
+ }
+ updateStatus(max);
+ }
+
+ protected Control createDialogArea(Composite ancestor) {
+ createDialogFields();
+ Composite parent = (Composite)super.createDialogArea(ancestor);
+ ((GridLayout)parent.getLayout()).numColumns= 3;
+
+ fVMTypeCombo.doFillIntoGrid(parent, 3);
+ ((GridData)fVMTypeCombo.getComboControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
+
+ fVMName.doFillIntoGrid(parent, 3);
+
+ fRubyVMRoot.doFillIntoGrid(parent, 3);
+
+ fVMArgs.doFillIntoGrid(parent, 3);
+ ((GridData)fVMArgs.getTextControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
+
+ Label l = new Label(parent, SWT.NONE);
+ l.setText(RubyVMMessages.AddVMDialog_JRE_system_libraries__1);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ gd.horizontalSpan = 3;
+ l.setLayoutData(gd);
+
+// fLibraryBlock = new VMLibraryBlock(this);
+// Control block = fLibraryBlock.createControl(parent);
+// gd = new GridData(GridData.FILL_BOTH);
+// gd.horizontalSpan = 3;
+// block.setLayoutData(gd);
+
+ Text t= fRubyVMRoot.getTextControl(parent);
+ gd= (GridData)t.getLayoutData();
+ gd.grabExcessHorizontalSpace=true;
+ gd.widthHint= convertWidthInCharsToPixels(50);
+
+ initializeFields();
+ createFieldListeners();
+ applyDialogFont(parent);
+ return parent;
+ }
+
+ private void initializeFields() {
+ fVMTypeCombo.setItems(getVMTypeNames());
+ if (fEditedVM == null) {
+ fVMName.setText(""); //$NON-NLS-1$
+ fRubyVMRoot.setText(""); //$NON-NLS-1$
+// fLibraryBlock.initializeFrom(null, fSelectedVMType);
+ fVMArgs.setText(""); //$NON-NLS-1$
+ } else {
+ fVMTypeCombo.setEnabled(false);
+ fVMName.setText(fEditedVM.getName());
+ fRubyVMRoot.setText(fEditedVM.getInstallLocation().getAbsolutePath());
+// fLibraryBlock.initializeFrom(fEditedVM, fSelectedVMType);
+ if (fEditedVM instanceof IVMInstall2) {
+ IVMInstall2 vm2 = (IVMInstall2) fEditedVM;
+ String vmArgs = vm2.getVMArgs();
+ if (vmArgs != null) {
+ fVMArgs.setText(vmArgs);
+ }
+ } else {
+ String[] vmArgs = fEditedVM.getVMArguments();
+ if (vmArgs != null) {
+ StringBuffer buffer = new StringBuffer();
+ int length= vmArgs.length;
+ if (length > 0) {
+ buffer.append(vmArgs[0]);
+ for (int i = 1; i < length; i++) {
+ buffer.append(' ').append(vmArgs[i]);
+ }
+ }
+ fVMArgs.setText(buffer.toString());
+ }
+ }
+ }
+ setVMNameStatus(validateVMName());
+ updateStatusLine();
+ }
+
+ private void setVMNameStatus(IStatus status) {
+ fStati[0]= status;
+ }
+
+ protected void createFieldListeners() {
+ fVMTypeCombo.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ updateVMType();
+ }
+ });
+
+ fVMName.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setVMNameStatus(validateVMName());
+ updateStatusLine();
+ }
+ });
+
+ fRubyVMRoot.setDialogFieldListener(new IDialogFieldListener() {
+ public void dialogFieldChanged(DialogField field) {
+ setRubyVMLocationStatus(validateInterpreterLocationText());
+ updateStatusLine();
+ }
+ });
+ }
+
+ private IStatus validateVMName() {
+ StatusInfo status= new StatusInfo();
+ String name= fVMName.getText();
+ if (name == null || name.trim().length() == 0) {
+ status.setInfo(RubyVMMessages.addVMDialog_enterName);
+ } else {
+ if (fRequestor.isDuplicateName(name) && (fEditedVM == null || !name.equals(fEditedVM.getName()))) {
+ status.setError(RubyVMMessages.addVMDialog_duplicateName);
+ } else {
+ IStatus s = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
+ if (!s.isOK()) {
+ status.setError(MessageFormat.format(RubyVMMessages.AddVMDialog_JRE_name_must_be_a_valid_file_name___0__1, new String[]{s.getMessage()}));
+ }
+ }
+ }
+ return status;
+ }
+
+ protected void createDialogFields() {
+ fVMTypeCombo= new ComboDialogField(SWT.READ_ONLY);
+ fVMTypeCombo.setLabelText(RubyVMMessages.addVMDialog_jreType);
+ fVMTypeCombo.setItems(getVMTypeNames());
+
+ fVMName= new StringDialogField();
+ fVMName.setLabelText(RubyVMMessages.addVMDialog_jreName);
+
+ fRubyVMRoot= new StringButtonDialogField(new IStringButtonAdapter() {
+ public void changeControlPressed(DialogField field) {
+ browseForInstallLocation();
+ }
+ });
+ fRubyVMRoot.setLabelText(RubyVMMessages.addVMDialog_jreHome);
+ fRubyVMRoot.setButtonLabel(RubyVMMessages.addVMDialog_browse1);
+
+ fVMArgs= new StringDialogField();
+ fVMArgs.setLabelText(RubyVMMessages.AddVMDialog_23);
+ }
+
+ private String[] getVMTypeNames() {
+ String[] names= new String[fVMTypes.length];
+ for (int i= 0; i < fVMTypes.length; i++) {
+ names[i]= fVMTypes[i].getName();
+ }
+ return names;
+ }
+
+ protected void setFieldValuesToVM(IVMInstall vm) {
+ File dir = new File(fRubyVMRoot.getText());
+ try {
+ vm.setInstallLocation(dir.getCanonicalFile());
+ } catch (IOException e) {
+ vm.setInstallLocation(dir.getAbsoluteFile());
+ }
+ vm.setName(fVMName.getText());
+
+ String argString = fVMArgs.getText().trim();
+ if (vm instanceof IVMInstall2) {
+ IVMInstall2 vm2 = (IVMInstall2) vm;
+ if (argString != null && argString.length() >0) {
+ vm2.setVMArgs(argString);
+ } else {
+ vm2.setVMArgs(null);
+ }
+ } else {
+ if (argString != null && argString.length() >0) {
+ vm.setVMArguments(DebugPlugin.parseArguments(argString));
+ } else {
+ vm.setVMArguments(null);
+ }
+ }
+
+
+// fLibraryBlock.performApply(vm);
+ }
+
+}
\ No newline at end of file
Property changes on: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/AddVMDialog.java
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 21:46:49
|
Revision: 1804
http://svn.sourceforge.net/rubyeclipse/?rev=1804&view=rev
Author: cawilliams
Date: 2007-01-18 13:46:46 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
moved to externally facing package
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMStandin.java
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMStandin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMStandin.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/VMStandin.java 2007-01-18 21:46:46 UTC (rev 1804)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2006 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.launching;
+
+import java.io.File;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.rubypeople.rdt.internal.launching.IllegalCommandException;
+
+
+
+/**
+ * An implementation of IVMInstall that is used for manipulating VMs without necessarily
+ * committing changes.
+ * <p>
+ * Instances of this class act like wrappers. All other instances of IVMInstall represent
+ * 'real live' VMs that may be used for building or launching. Instances of this class
+ * behave like 'temporary' VMs that are not visible and not available for building or launching.
+ * </p>
+ * <p>
+ * Instances of this class may be constructed as a preliminary step to creating a 'live' VM
+ * or as a preliminary step to making changes to a 'real' VM.
+ * </p>
+ * When <code>convertToRealVM</code> is called, a corresponding 'real' VM is created
+ * if one did not previously exist, or the corresponding 'real' VM is updated.
+ * </p>
+ * <p>
+ * Clients may instantiate this class; it is not intended to be subclassed.
+ * </p>
+ *
+ * @since 0.9.0
+ */
+public class VMStandin extends AbstractVMInstall {
+
+ /**
+ * <code>java.version</code> system property, or <code>null</code>
+ * @since 0.9.0
+ */
+ private String fRubyVersion = null;
+
+ /*
+ * @see org.eclipse.jdt.launching.AbstractVMInstall#AbstractVMInstall(org.eclipse.jdt.launching.IVMInstallType, java.lang.String)
+ */
+ public VMStandin(IVMInstallType type, String id) {
+ super(type, id);
+ setNotify(false);
+ }
+
+ /**
+ * Constructs a copy of the specified VM with the given identifier.
+ *
+ * @param sourceVM
+ * @param id
+ * @since 3.2
+ */
+ public VMStandin(IVMInstall sourceVM, String id) {
+ super(sourceVM.getVMInstallType(), id);
+ setNotify(false);
+ init(sourceVM);
+ }
+
+ /**
+ * Construct a <code>VMStandin</code> instance based on the specified <code>IVMInstall</code>.
+ * Changes to this standin will not be reflected in the 'real' VM until <code>convertToRealVM</code>
+ * is called.
+ *
+ * @param realVM the 'real' VM from which to construct this standin VM
+ */
+ public VMStandin(IVMInstall realVM) {
+ this (realVM.getVMInstallType(), realVM.getId());
+ init(realVM);
+ }
+
+ /**
+ * Initializes the settings of this standin based on the settings in the given
+ * VM install.
+ *
+ * @param realVM VM to copy settings from
+ */
+ private void init(IVMInstall realVM) {
+ setName(realVM.getName());
+ setInstallLocation(realVM.getInstallLocation());
+ setLibraryLocations(realVM.getLibraryLocations());
+ if (realVM instanceof IVMInstall2) {
+ IVMInstall2 vm2 = (IVMInstall2) realVM;
+ setVMArgs(vm2.getVMArgs());
+ fRubyVersion = vm2.getRubyVersion();
+ } else {
+ setVMArguments(realVM.getVMArguments());
+ fRubyVersion = null;
+ }
+ }
+
+ /**
+ * If no corresponding 'real' VM exists, create one and populate it from this standin instance.
+ * If a corresponding VM exists, update its attributes from this standin instance.
+ *
+ * @return IVMInstall the 'real' corresponding to this standin VM
+ */
+ public IVMInstall convertToRealVM() {
+ IVMInstallType vmType= getVMInstallType();
+ IVMInstall realVM= vmType.findVMInstall(getId());
+ boolean notify = true;
+
+ if (realVM == null) {
+ realVM= vmType.createVMInstall(getId());
+ notify = false;
+ }
+ // do not notify of property changes on new VMs
+ if (realVM instanceof AbstractVMInstall) {
+ ((AbstractVMInstall)realVM).setNotify(notify);
+ }
+ realVM.setName(getName());
+ realVM.setInstallLocation(getInstallLocation());
+ realVM.setLibraryLocations(getLibraryLocations());
+ if (realVM instanceof IVMInstall2) {
+ IVMInstall2 vm2 = (IVMInstall2) realVM;
+ vm2.setVMArgs(getVMArgs());
+ } else {
+ realVM.setVMArguments(getVMArguments());
+ }
+
+ if (realVM instanceof AbstractVMInstall) {
+ ((AbstractVMInstall)realVM).setNotify(true);
+ }
+ if (!notify) {
+ RubyRuntime.fireVMAdded(realVM);
+ }
+ return realVM;
+ }
+
+ /* (non-Javadoc)
+ * @see org.rubypeople.rdt.launching.IVMInstall#getRubyVersion()
+ */
+ public String getRubyVersion() {
+ return fRubyVersion;
+ }
+
+ public Process exec(List commandLine, File workingDirectory)
+ throws CoreException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public String getCommand() throws IllegalCommandException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 21:44:50
|
Revision: 1803
http://svn.sourceforge.net/rubyeclipse/?rev=1803&view=rev
Author: cawilliams
Date: 2007-01-18 13:44:46 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Lots of changes! More work towards modifying our interpreter setup/usage (so we can eventually support many types of VMs - JRuby, C Ruby, Rubinius, YARV)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.build/cruiseControl/plugin/cruiseControl.launch
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerLaunch.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyApplicationShortcut.java
trunk/org.rubypeople.rdt.launching/plugin.xml
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.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/VMDefinitionsContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstallType.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RubyRuntime.java
trunk/org.rubypeople.rdt.launching.tests/src/org/rubypeople/rdt/internal/launching/TC_RunnerLaunching.java
trunk/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/text/ruby/hover/RiDocHoverProvider.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/ui/PreferenceConstants.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java
trunk/org.rubypeople.rdt.launching/schema/
trunk/org.rubypeople.rdt.launching/schema/vmInstallTypes.exsd
trunk/org.rubypeople.rdt.launching/schema/vmInstalls.exsd
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LibraryInfo.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVM.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/StandardVMType.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMInstall.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractVMInstallType.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditInterpreterDialog.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMStandin.java
Modified: trunk/org.rubypeople.rdt.build/cruiseControl/plugin/cruiseControl.launch
===================================================================
--- trunk/org.rubypeople.rdt.build/cruiseControl/plugin/cruiseControl.launch 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.build/cruiseControl/plugin/cruiseControl.launch 2007-01-18 21:44:46 UTC (rev 1803)
@@ -1,7 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="CruiseControl"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="cruise-control-plugin"/>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/cruise-control-plugin"/>
+</listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:cruise-control-plugin/config}"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables" value="true"/>
</launchConfiguration>
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerLaunch.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerLaunch.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_DebuggerLaunch.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -16,48 +16,60 @@
import org.eclipse.debug.core.model.IProcess;
import org.rubypeople.eclipse.testutils.ResourceTools;
import org.rubypeople.rdt.internal.debug.core.RubyLineBreakpoint;
-import org.rubypeople.rdt.internal.launching.RubyInterpreter;
import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
-import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
+import org.rubypeople.rdt.launching.VMStandin;
/*
*
*/
public class FTC_DebuggerLaunch extends TestCase {
+ private static final String RUBY_INTERPRETER_ID = "RubyInterpreter";
+ private static final String VM_TYPE_ID = "org.rubypeople.rdt.launching.StandardVMType";
+ private static final boolean VERBOSE = false;
+ private IVMInstallType vmType;
+
public void setUp() {
- this.createInterpreter() ;
- }
-
- protected void createInterpreter() {
+ vmType = RubyRuntime.getVMInstallType(VM_TYPE_ID);
// We rely on the RUBY_INTERPRETER to be a full path to a valid ruby executable, therefore the property rdt.rubyInterpreter has
// to be set accordingly
- String rubyInterpreterPath = FTC_ClassicDebuggerCommunicationTest.RUBY_INTERPRETER ;
- System.out.println("Using interpreter: " + rubyInterpreterPath) ;
- IVMInstall rubyInterpreter = new RubyInterpreter("RubyInterpreter", new File(rubyInterpreterPath));
- RubyRuntime.getDefault().addInstalledInterpreter(rubyInterpreter) ;
+ String rubyInterpreterPath = FTC_ClassicDebuggerCommunicationTest.RUBY_INTERPRETER;
+ log("Using interpreter: " + rubyInterpreterPath);
+ VMStandin standin = new VMStandin(vmType, RUBY_INTERPRETER_ID);
+ standin.setInstallLocation(new File(rubyInterpreterPath));
+ standin.convertToRealVM();
+ }
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ vmType.disposeVMInstall(RUBY_INTERPRETER_ID);
}
protected void log(String label, ILaunch launch) throws Exception {
- System.out.println("Infos about " + label + ":");
+ log("Infos about " + label + ":");
IProcess process = launch.getProcesses()[0];
if (process.isTerminated()) {
- System.out.println("Process has finished with exit-value: " + process.getExitValue());
+ log("Process has finished with exit-value: " + process.getExitValue());
} else {
- System.out.println("Process still running.");
+ log("Process still running.");
}
String error = process.getStreamsProxy().getErrorStreamMonitor().getContents();
if (error != null && error.length() > 0) {
- System.out.println("Process stderr: " + error);
+ log("Process stderr: " + error);
}
String stdout = process.getStreamsProxy().getOutputStreamMonitor().getContents();
if (stdout != null && stdout.length() > 0) {
- System.out.println("Process stdout: " + stdout);
+ log("Process stdout: " + stdout);
}
}
+
+ private void log(String message) {
+ if (VERBOSE) System.out.println(message);
+ }
public void testTwoSessions() throws Exception {
@@ -71,7 +83,7 @@
wc.setAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, rubyFile.getProject().getName());
wc.setAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, rubyFile.getProjectRelativePath().toString());
//wc.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, RubyApplicationShortcut.getDefaultWorkingDirectory(rubyFile.getProject()));
- wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, "RubyInterpreter");
+ wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, RUBY_INTERPRETER_ID);
ILaunchConfiguration lc = wc.doSave() ;
DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(new RubyLineBreakpoint(rubyFile, 1)) ;
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -7,12 +7,6 @@
import org.rubypeople.rdt.internal.core.LoadpathEntry;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-/**
- * @author xp4
- *
- * To change this generated comment edit the template variable "typecomment":
- * Window>Preferences>Java>Templates.
- */
public class LoadPathEntryLabelProvider implements ILabelProvider {
/**
@@ -27,7 +21,7 @@
*/
public String getText(Object element) {
if (element != null && element.getClass() == LoadpathEntry.class) {
- IProject project = ((LoadpathEntry) element).getProject() ;
+ IProject project = ((LoadpathEntry) element).getProject();
if (project.isAccessible()) {
return project.getLocation().toOSString() ;
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyApplicationShortcut.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -119,7 +119,7 @@
}
protected ILaunchConfiguration createConfiguration(IFile rubyFile) {
- if (RubyRuntime.getDefault().getSelectedInterpreter() == null) {
+ if (RubyRuntime.getDefaultVMInstall() == null) {
this.showNoInterpreterDialog();
return null;
}
@@ -130,7 +130,8 @@
wc.setAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, rubyFile.getProject().getName());
wc.setAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, rubyFile.getProjectRelativePath().toString());
wc.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, RubyApplicationShortcut.getDefaultWorkingDirectory(rubyFile.getProject()));
- wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, RubyRuntime.getDefault().getSelectedInterpreter().getName());
+ wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, RubyRuntime.getCompositeIdFromVM(RubyRuntime.getDefaultVMInstall()));
+ // FIXME generate a composite id for the interpreter, not name!
wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.rubypeople.rdt.debug.ui.rubySourceLocator");
config = wc.doSave();
} catch (CoreException ce) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -33,13 +33,15 @@
import org.rubypeople.rdt.internal.core.RubyModelManager;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-import org.rubypeople.rdt.internal.debug.ui.preferences.EditInterpreterDialog;
+import org.rubypeople.rdt.internal.debug.ui.preferences.AddVMDialog;
import org.rubypeople.rdt.internal.debug.ui.rubyvms.IAddVMDialogRequestor;
import org.rubypeople.rdt.internal.debug.ui.rubyvms.RubyVMMessages;
import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
import org.rubypeople.rdt.internal.ui.RubyPluginImages;
import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
+import org.rubypeople.rdt.launching.VMStandin;
public class RubyEnvironmentTab extends AbstractLaunchConfigurationTab {
protected ListViewer loadPathListViewer;
@@ -156,7 +158,7 @@
}
public void widgetSelected(SelectionEvent evt) {
- EditInterpreterDialog dialog = new EditInterpreterDialog(this,
+ AddVMDialog dialog = new AddVMDialog(this,
fShell, RubyRuntime.getVMInstallTypes(),
null);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
@@ -166,12 +168,15 @@
}
public boolean isDuplicateName(String name) {
- // TODO Auto-generated method stub
return false;
}
public void vmAdded(IVMInstall vm) {
- RubyRuntime.getDefault().addInstalledInterpreter(vm);
+ // FIXME Use something like JREsUpdater?
+ if (vm instanceof VMStandin) {
+ VMStandin standin = (VMStandin) vm;
+ standin.convertToRealVM();
+ }
fCombo.add(vm.getName());
fCombo.select(fCombo.indexOf(vm.getName()));
}
@@ -195,7 +200,7 @@
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
IVMInstall defaultInterpreter = RubyRuntime.getDefault()
- .getSelectedInterpreter();
+ .getDefaultVMInstall();
if (defaultInterpreter != null) {
configuration.setAttribute(
RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER,
@@ -254,9 +259,18 @@
protected void initializeInterpreterCombo(Combo interpreterCombo) {
installedInterpretersWorkingCopy = new ArrayList();
- installedInterpretersWorkingCopy.addAll(RubyRuntime.getDefault()
- .getInstalledInterpreters());
-
+ List standins = new ArrayList();
+ IVMInstallType[] types = RubyRuntime.getVMInstallTypes();
+ for (int i = 0; i < types.length; i++) {
+ IVMInstallType type = types[i];
+ IVMInstall[] installs = type.getVMInstalls();
+ for (int j = 0; j < installs.length; j++) {
+ IVMInstall install = installs[j];
+ standins.add(new VMStandin(install));
+ }
+ }
+ installedInterpretersWorkingCopy.addAll(standins);
+
String[] interpreterNames = new String[installedInterpretersWorkingCopy
.size()];
for (int interpreterIndex = 0; interpreterIndex < installedInterpretersWorkingCopy
@@ -267,8 +281,7 @@
}
interpreterCombo.setItems(interpreterNames);
- IVMInstall selectedInterpreter = RubyRuntime.getDefault()
- .getSelectedInterpreter();
+ IVMInstall selectedInterpreter = RubyRuntime.getDefaultVMInstall();
if (selectedInterpreter != null)
interpreterCombo.select(interpreterCombo
.indexOf(selectedInterpreter.getName()));
Deleted: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditInterpreterDialog.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditInterpreterDialog.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/EditInterpreterDialog.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -1,345 +0,0 @@
-package org.rubypeople.rdt.internal.debug.ui.preferences;
-
-import java.io.File;
-import java.io.IOException;
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
-import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
-import org.rubypeople.rdt.internal.debug.ui.rubyvms.IAddVMDialogRequestor;
-import org.rubypeople.rdt.internal.debug.ui.rubyvms.RubyVMMessages;
-import org.rubypeople.rdt.internal.launching.VMStandin;
-import org.rubypeople.rdt.internal.ui.dialogs.StatusDialog;
-import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.ComboDialogField;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.DialogField;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IDialogFieldListener;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.IStringButtonAdapter;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringButtonDialogField;
-import org.rubypeople.rdt.internal.ui.wizards.dialogfields.StringDialogField;
-import org.rubypeople.rdt.launching.IVMInstall;
-import org.rubypeople.rdt.launching.IVMInstall2;
-import org.rubypeople.rdt.launching.IVMInstallType;
-
-public class EditInterpreterDialog extends StatusDialog {
-
- protected IStatus[] allStatus = new IStatus[2];
-
- protected IVMInstall fEditedVM;
- private StringButtonDialogField fJRERoot;
- private StringDialogField fVMName;
-
- private StringDialogField fVMArgs;
-
- private IVMInstallType fSelectedVMType;
- private IVMInstallType[] fVMTypes;
- private ComboDialogField fVMTypeCombo;
-
- private IStatus[] fStati;
-
- private int fPrevIndex = -1;
-
- private IAddVMDialogRequestor fRequestor;
-
- public EditInterpreterDialog(IAddVMDialogRequestor requestor, Shell shell, IVMInstallType[] vmInstallTypes, IVMInstall editedVM) {
- super(shell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- fRequestor= requestor;
- fStati= new IStatus[5];
- for (int i= 0; i < fStati.length; i++) {
- fStati[i]= new StatusInfo();
- }
-
- fVMTypes= vmInstallTypes;
- fSelectedVMType= editedVM != null ? editedVM.getVMInstallType() : vmInstallTypes[0];
-
- fEditedVM= editedVM;
- }
-
- protected IStatus validateInterpreterLocationText() {
- String locationName = fJRERoot.getText();
- if (locationName.length() == 0) {
- return new StatusInfo(IStatus.INFO, RubyVMMessages.addVMDialog_enterLocation);
- }
- File file = new File(locationName);
- if (!file.exists()) {
- return new StatusInfo(IStatus.ERROR, RubyVMMessages.addVMDialog_locationNotExists);
- }
- // FIXME We want the user to select a directory as the home of the ruby install!
- if(file.isFile()){
- return new Status(IStatus.OK, RdtDebugUiPlugin.PLUGIN_ID, 0, "", null);
- }
- return new Status(IStatus.ERROR, RdtDebugUiPlugin.PLUGIN_ID, 1, RdtDebugUiMessages.getString("EditInterpreterDialog.rubyInterpreter.path.error"), null);
- }
-
- protected void browseForInstallLocation() {
- FileDialog dialog = new FileDialog(getShell());
- dialog.setFilterPath(fJRERoot.getText());
- dialog.setText(RdtDebugUiMessages.getString("EditInterpreterDialog.rubyInterpreter.path.browse.message")); //$NON-NLS-1$
- String newPath = dialog.open();
- if (newPath != null)
- fJRERoot.setText(newPath);
- }
-
- protected void okPressed() {
- doOkPressed();
- super.okPressed();
- }
-
- private void doOkPressed() {
- if (fEditedVM == null) {
- IVMInstall vm= new VMStandin(fSelectedVMType, createUniqueId(fSelectedVMType));
- setFieldValuesToVM(vm);
- fRequestor.vmAdded(vm);
- } else {
- setFieldValuesToVM(fEditedVM);
- }
- }
-
- public void create() {
- super.create();
- fVMName.setFocus();
- selectVMType();
- }
-
- private String createUniqueId(IVMInstallType vmType) {
- String id= null;
- do {
- id= String.valueOf(System.currentTimeMillis());
- } while (vmType.findVMInstall(id) != null);
- return id;
- }
-
- private void selectVMType() {
- for (int i= 0; i < fVMTypes.length; i++) {
- if (fSelectedVMType == fVMTypes[i]) {
- fVMTypeCombo.selectItem(i);
- return;
- }
- }
- }
-
- private void updateVMType() {
- int selIndex= fVMTypeCombo.getSelectionIndex();
- if (selIndex == fPrevIndex) {
- return;
- }
- fPrevIndex = selIndex;
- if (selIndex >= 0 && selIndex < fVMTypes.length) {
- fSelectedVMType= fVMTypes[selIndex];
- }
- setJRELocationStatus(validateInterpreterLocationText());
-// fLibraryBlock.initializeFrom(fEditedVM, fSelectedVMType);
- updateStatusLine();
- }
-
- private void setJRELocationStatus(IStatus status) {
- fStati[1]= status;
- }
-
- protected void updateStatusLine() {
- IStatus max= null;
- for (int i= 0; i < fStati.length; i++) {
- IStatus curr= fStati[i];
- if (curr.matches(IStatus.ERROR)) {
- updateStatus(curr);
- return;
- }
- if (max == null || curr.getSeverity() > max.getSeverity()) {
- max= curr;
- }
- }
- updateStatus(max);
- }
-
- protected Control createDialogArea(Composite ancestor) {
- createDialogFields();
- Composite parent = (Composite)super.createDialogArea(ancestor);
- ((GridLayout)parent.getLayout()).numColumns= 3;
-
- fVMTypeCombo.doFillIntoGrid(parent, 3);
- ((GridData)fVMTypeCombo.getComboControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
-
- fVMName.doFillIntoGrid(parent, 3);
-
- fJRERoot.doFillIntoGrid(parent, 3);
-
- fVMArgs.doFillIntoGrid(parent, 3);
- ((GridData)fVMArgs.getTextControl(null).getLayoutData()).widthHint= convertWidthInCharsToPixels(50);
-
- Label l = new Label(parent, SWT.NONE);
- l.setText(RubyVMMessages.AddVMDialog_JRE_system_libraries__1);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 3;
- l.setLayoutData(gd);
-
-// fLibraryBlock = new VMLibraryBlock(this);
-// Control block = fLibraryBlock.createControl(parent);
-// gd = new GridData(GridData.FILL_BOTH);
-// gd.horizontalSpan = 3;
-// block.setLayoutData(gd);
-
- Text t= fJRERoot.getTextControl(parent);
- gd= (GridData)t.getLayoutData();
- gd.grabExcessHorizontalSpace=true;
- gd.widthHint= convertWidthInCharsToPixels(50);
-
- initializeFields();
- createFieldListeners();
- applyDialogFont(parent);
- return parent;
- }
-
- private void initializeFields() {
- fVMTypeCombo.setItems(getVMTypeNames());
- if (fEditedVM == null) {
- fVMName.setText(""); //$NON-NLS-1$
- fJRERoot.setText(""); //$NON-NLS-1$
-// fLibraryBlock.initializeFrom(null, fSelectedVMType);
- fVMArgs.setText(""); //$NON-NLS-1$
- } else {
- fVMTypeCombo.setEnabled(false);
- fVMName.setText(fEditedVM.getName());
- fJRERoot.setText(fEditedVM.getInstallLocation().getAbsolutePath());
-// fLibraryBlock.initializeFrom(fEditedVM, fSelectedVMType);
- if (fEditedVM instanceof IVMInstall2) {
- IVMInstall2 vm2 = (IVMInstall2) fEditedVM;
- String vmArgs = vm2.getVMArgs();
- if (vmArgs != null) {
- fVMArgs.setText(vmArgs);
- }
- } else {
- String[] vmArgs = fEditedVM.getVMArguments();
- if (vmArgs != null) {
- StringBuffer buffer = new StringBuffer();
- int length= vmArgs.length;
- if (length > 0) {
- buffer.append(vmArgs[0]);
- for (int i = 1; i < length; i++) {
- buffer.append(' ').append(vmArgs[i]);
- }
- }
- fVMArgs.setText(buffer.toString());
- }
- }
- }
- setVMNameStatus(validateVMName());
- updateStatusLine();
- }
-
- private void setVMNameStatus(IStatus status) {
- fStati[0]= status;
- }
-
- protected void createFieldListeners() {
- fVMTypeCombo.setDialogFieldListener(new IDialogFieldListener() {
- public void dialogFieldChanged(DialogField field) {
- updateVMType();
- }
- });
-
- fVMName.setDialogFieldListener(new IDialogFieldListener() {
- public void dialogFieldChanged(DialogField field) {
- setVMNameStatus(validateVMName());
- updateStatusLine();
- }
- });
-
- fJRERoot.setDialogFieldListener(new IDialogFieldListener() {
- public void dialogFieldChanged(DialogField field) {
- setJRELocationStatus(validateInterpreterLocationText());
- updateStatusLine();
- }
- });
- }
-
- private IStatus validateVMName() {
- StatusInfo status= new StatusInfo();
- String name= fVMName.getText();
- if (name == null || name.trim().length() == 0) {
- status.setInfo(RubyVMMessages.addVMDialog_enterName);
- } else {
- if (fRequestor.isDuplicateName(name) && (fEditedVM == null || !name.equals(fEditedVM.getName()))) {
- status.setError(RubyVMMessages.addVMDialog_duplicateName);
- } else {
- IStatus s = ResourcesPlugin.getWorkspace().validateName(name, IResource.FILE);
- if (!s.isOK()) {
- status.setError(MessageFormat.format(RubyVMMessages.AddVMDialog_JRE_name_must_be_a_valid_file_name___0__1, new String[]{s.getMessage()}));
- }
- }
- }
- return status;
- }
-
- protected void createDialogFields() {
- fVMTypeCombo= new ComboDialogField(SWT.READ_ONLY);
- fVMTypeCombo.setLabelText(RubyVMMessages.addVMDialog_jreType);
- fVMTypeCombo.setItems(getVMTypeNames());
-
- fVMName= new StringDialogField();
- fVMName.setLabelText(RubyVMMessages.addVMDialog_jreName);
-
- fJRERoot= new StringButtonDialogField(new IStringButtonAdapter() {
- public void changeControlPressed(DialogField field) {
- browseForInstallLocation();
- }
- });
- fJRERoot.setLabelText(RubyVMMessages.addVMDialog_jreHome);
- fJRERoot.setButtonLabel(RubyVMMessages.addVMDialog_browse1);
-
- fVMArgs= new StringDialogField();
- fVMArgs.setLabelText(RubyVMMessages.AddVMDialog_23);
- }
-
- private String[] getVMTypeNames() {
- String[] names= new String[fVMTypes.length];
- for (int i= 0; i < fVMTypes.length; i++) {
- names[i]= fVMTypes[i].getName();
- }
- return names;
- }
-
- protected void setFieldValuesToVM(IVMInstall vm) {
- File dir = new File(fJRERoot.getText());
- try {
- vm.setInstallLocation(dir.getCanonicalFile());
- } catch (IOException e) {
- vm.setInstallLocation(dir.getAbsoluteFile());
- }
- vm.setName(fVMName.getText());
-
- String argString = fVMArgs.getText().trim();
- if (vm instanceof IVMInstall2) {
- IVMInstall2 vm2 = (IVMInstall2) vm;
- if (argString != null && argString.length() >0) {
- vm2.setVMArgs(argString);
- } else {
- vm2.setVMArgs(null);
- }
- } else {
- if (argString != null && argString.length() >0) {
- vm.setVMArguments(DebugPlugin.parseArguments(argString));
- } else {
- vm.setVMArguments(null);
- }
- }
-
-
-// fLibraryBlock.performApply(vm);
- }
-
-}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -14,6 +14,7 @@
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -23,14 +24,16 @@
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiMessages;
import org.rubypeople.rdt.internal.debug.ui.rubyvms.IAddVMDialogRequestor;
import org.rubypeople.rdt.internal.debug.ui.rubyvms.RubyVMMessages;
+import org.rubypeople.rdt.internal.debug.ui.rubyvms.RubyVMsUpdater;
import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
+import org.rubypeople.rdt.launching.VMStandin;
public class RubyInterpreterPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, IAddVMDialogRequestor {
@@ -54,10 +57,11 @@
Composite composite = createPageRoot(parent);
Table table = createInstalledInterpretersTable(composite);
createInstalledInterpretersTableViewer(table);
- createButtonGroup(composite);
+ createButtonGroup(composite);
- fVMList.setInput(RubyRuntime.getDefault().getInstalledInterpreters());
- IVMInstall selectedInterpreter = RubyRuntime.getDefault().getSelectedInterpreter();
+ fillWithWorkspaceRubyVMs();
+
+ IVMInstall selectedInterpreter = RubyRuntime.getDefaultVMInstall();
if (selectedInterpreter != null)
fVMList.setChecked(selectedInterpreter, true);
@@ -65,7 +69,36 @@
return composite;
}
+
+ private void fillWithWorkspaceRubyVMs() {
+// fill with Ruby VMs
+ List standins = new ArrayList();
+ IVMInstallType[] types = RubyRuntime.getVMInstallTypes();
+ for (int i = 0; i < types.length; i++) {
+ IVMInstallType type = types[i];
+ IVMInstall[] installs = type.getVMInstalls();
+ for (int j = 0; j < installs.length; j++) {
+ IVMInstall install = installs[j];
+ standins.add(new VMStandin(install));
+ }
+ }
+ setJREs((IVMInstall[])standins.toArray(new IVMInstall[standins.size()]));
+ }
+ /**
+ * Sets the JREs to be displayed in this block
+ *
+ * @param vms JREs to be displayed
+ */
+ protected void setJREs(IVMInstall[] vms) {
+ fVMs.clear();
+ for (int i = 0; i < vms.length; i++) {
+ fVMs.add(vms[i]);
+ }
+ fVMList.setInput(fVMs);
+ fVMList.refresh();
+ }
+
protected void createButtonGroup(Composite composite) {
Composite buttons = new Composite(composite, SWT.NULL);
buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
@@ -155,7 +188,7 @@
}
protected void addInterpreter() {
- EditInterpreterDialog dialog = new EditInterpreterDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), null);
+ AddVMDialog dialog = new AddVMDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), null);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
if (dialog.open() != Window.OK) {
return;
@@ -195,7 +228,7 @@
// VMDetailsDialog dialog= new VMDetailsDialog(getShell(), vm);
// dialog.open();
// } else {
- EditInterpreterDialog dialog= new EditInterpreterDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), vm);
+ AddVMDialog dialog= new AddVMDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), vm);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_8);
if (dialog.open() != Window.OK) {
return;
@@ -209,19 +242,47 @@
return (IVMInstall) selection.getFirstElement();
}
- public boolean performOk() {
- TableItem[] tableItems = fVMList.getTable().getItems();
- List installedInterpreters = new ArrayList(tableItems.length);
- for (int i = 0; i < tableItems.length; i++)
- installedInterpreters.add(tableItems[i].getData());
- RubyRuntime.getDefault().setInstalledInterpreters(installedInterpreters);
-
- Object[] checkedElements = fVMList.getCheckedElements();
- if (checkedElements.length > 0)
- RubyRuntime.getDefault().setSelectedInterpreter((IVMInstall) checkedElements[0]);
-
- return super.performOk();
+ public boolean performOk() {
+ final boolean[] canceled = new boolean[] {false};
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ IVMInstall defaultVM = getCheckedRubyVM();
+ IVMInstall[] vms = getRubyVMs();
+ RubyVMsUpdater updater = new RubyVMsUpdater();
+ if (!updater.updateJRESettings(vms, defaultVM)) {
+ canceled[0] = true;
+ }
+ }
+ });
+
+ if(canceled[0]) {
+ return false;
+ }
+
+ return super.performOk();
}
+
+ /**
+ * Returns the checked RubyVM or <code>null</code> if none.
+ *
+ * @return the checked RubyVM or <code>null</code> if none
+ */
+ public IVMInstall getCheckedRubyVM() {
+ Object[] objects = fVMList.getCheckedElements();
+ if (objects.length == 0) {
+ return null;
+ }
+ return (IVMInstall)objects[0];
+ }
+
+ /**
+ * Returns the RubyVMs currently being displayed in this block
+ *
+ * @return RubyVMs currently being displayed in this block
+ */
+ public IVMInstall[] getRubyVMs() {
+ return (IVMInstall[])fVMs.toArray(new IVMInstall[fVMs.size()]);
+ }
public boolean isDuplicateName(String name) {
for (int i= 0; i < fVMs.size(); i++) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -7,7 +7,6 @@
public static String addVMDialog_enterLocation;
public static String addVMDialog_locationNotExists;
-
public static String AddVMDialog_JRE_system_libraries__1;
public static String addVMDialog_jreType;
public static String addVMDialog_jreName;
@@ -19,6 +18,8 @@
public static String AddVMDialog_JRE_name_must_be_a_valid_file_name___0__1;
public static String InstalledJREsBlock_7;
public static String InstalledJREsBlock_8;
+ public static String JREsUpdater_0;
+ public static String addVMDialog_pickJRERootDialog_message;
static {
// load message values from bundle file
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMMessages.properties 2007-01-18 21:44:46 UTC (rev 1803)
@@ -1,2 +1,19 @@
+addVMDialog_pickJRERootDialog_message=Select the root directory of the Ruby installation:
addVMDialog_enterLocation=Enter the location of the Ruby VM.
-addVMDialog_locationNotExists=The location does not exist.
\ No newline at end of file
+addVMDialog_locationNotExists=The location does not exist.
+
+AddVMDialog_JRE_system_libraries__1=RubyVM system libraries:
+
+AddVMDialog_JRE_name_must_be_a_valid_file_name___0__1=RubyVM name must be a valid file name: {0}
+addVMDialog_browse1=&Browse...
+addVMDialog_duplicateName=The name is already used.
+addVMDialog_enterName=Enter a name for the RubyVM.
+addVMDialog_jreHome=&RubyVM home directory:
+addVMDialog_jreName=RubyVM &name:
+addVMDialog_jreType=RubyVM &type:
+AddVMDialog_23=Default &VM Arguments:
+
+InstalledJREsBlock_7=Add RubyVM
+InstalledJREsBlock_8=Edit RubyVM
+
+JREsUpdater_0=Save VM Definitions
\ No newline at end of file
Added: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java (rev 0)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/rubyvms/RubyVMsUpdater.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.rubypeople.rdt.internal.debug.ui.rubyvms;
+
+import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.TransformerException;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
+import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+/**
+ * Processes add/removed/changed VMs.
+ */
+public class RubyVMsUpdater {
+
+ // the VMs defined when this updated is instantiated
+ private VMDefinitionsContainer fOriginalVMs;
+
+ /**
+ * Contstructs a new VM updater to update VM install settings.
+ */
+ public RubyVMsUpdater() {
+ fOriginalVMs = new VMDefinitionsContainer();
+ IVMInstall def = RubyRuntime.getDefaultVMInstall();
+ if (def != null) {
+ fOriginalVMs.setDefaultVMInstallCompositeID(RubyRuntime.getCompositeIdFromVM(def));
+ }
+
+ IVMInstallType[] types = RubyRuntime.getVMInstallTypes();
+ for (int i = 0; i < types.length; i++) {
+ IVMInstall[] vms = types[i].getVMInstalls();
+ for (int j = 0; j < vms.length; j++) {
+ fOriginalVMs.addVM(vms[j]);
+ }
+ }
+ }
+
+ /**
+ * Updates VM settings and returns whether the update was successful.
+ *
+ * @param jres new installed JREs
+ * @param defaultJRE new default VM
+ * @return whether the update was successful
+ */
+ public boolean updateJRESettings(IVMInstall[] jres, IVMInstall defaultJRE) {
+
+ // Create a VM definition container
+ VMDefinitionsContainer vmContainer = new VMDefinitionsContainer();
+
+ // Set the default VM Id on the container
+ String defaultVMId = RubyRuntime.getCompositeIdFromVM(defaultJRE);
+ vmContainer.setDefaultVMInstallCompositeID(defaultVMId);
+
+ // Set the VMs on the container
+ for (int i = 0; i < jres.length; i++) {
+ vmContainer.addVM(jres[i]);
+ }
+
+
+ // Generate XML for the VM defs and save it as the new value of the VM preference
+ saveVMDefinitions(vmContainer);
+
+ return true;
+ }
+
+ private void saveVMDefinitions(final VMDefinitionsContainer container) {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ monitor.beginTask(RubyVMMessages.JREsUpdater_0, 100);
+ String vmDefXML = container.getAsXML();
+ monitor.worked(40);
+ RubyRuntime.getPreferences().setValue(RubyRuntime.PREF_VM_XML, vmDefXML);
+ monitor.worked(30);
+ RubyRuntime.savePreferences();
+ monitor.worked(30);
+ } catch (IOException ioe) {
+ RdtDebugUiPlugin.log(ioe);
+ } catch (ParserConfigurationException e) {
+ RdtDebugUiPlugin.log(e);
+ } catch (TransformerException e) {
+ RdtDebugUiPlugin.log(e);
+ } finally {
+ monitor.done();
+ }
+
+ }
+ };
+ try {
+ RdtDebugUiPlugin.getDefault().getWorkbench().getProgressService().busyCursorWhile(runnable);
+ } catch (InvocationTargetException e) {
+ RdtDebugUiPlugin.log(e);
+ } catch (InterruptedException e) {
+ RdtDebugUiPlugin.log(e);
+ }
+ }
+}
Modified: trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyApplicationShortcut.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyApplicationShortcut.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.debug.ui.tests/src/org/rubypeople/rdt/internal/debug/ui/launcher/TC_RubyApplicationShortcut.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -1,7 +1,6 @@
package org.rubypeople.rdt.internal.debug.ui.launcher;
import java.io.File;
-import java.util.Arrays;
import junit.framework.Assert;
@@ -22,14 +21,18 @@
import org.rubypeople.rdt.core.tests.ModifyingResourceTest;
import org.rubypeople.rdt.internal.debug.ui.RdtDebugUiPlugin;
import org.rubypeople.rdt.internal.debug.ui.RubySourceLocator;
-import org.rubypeople.rdt.internal.launching.RubyInterpreter;
import org.rubypeople.rdt.internal.launching.RubyLaunchConfigurationAttribute;
-import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.IVMInstallType;
import org.rubypeople.rdt.launching.RubyRuntime;
+import org.rubypeople.rdt.launching.VMStandin;
import org.rubypeople.rdt.ui.IRubyConstants;
public class TC_RubyApplicationShortcut extends ModifyingResourceTest {
+ private static final String VM_ID = "vm_id";
+
+ private static final String VM_TYPE_ID = "org.rubypeople.rdt.launching.StandardVMType";
+
protected ShamRubyApplicationShortcut shortcut;
protected IFile rubyFile, nonRubyFile;
private static String SHAM_LAUNCH_CONFIG_TYPE = "org.rubypeople.rdt.debug.ui.tests.launching.LaunchConfigurationTypeSham";
@@ -46,7 +49,7 @@
wc.setAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, pFile.getProject().getName());
wc.setAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, pFile.getProjectRelativePath().toString());
wc.setAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
- wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, RubyRuntime.getDefault().getSelectedInterpreter().getName());
+ wc.setAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, RubyRuntime.getCompositeIdFromVM(RubyRuntime.getDefaultVMInstall()));
wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.rubypeople.rdt.debug.ui.rubySourceLocator");
config = wc.doSave();
} catch (CoreException ce) {
@@ -59,6 +62,8 @@
ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
return launchManager.getLaunchConfigurations(launchManager.getLaunchConfigurationType(SHAM_LAUNCH_CONFIG_TYPE));
}
+
+ private IVMInstallType vmType;
protected void setUp() throws Exception {
shortcut = new ShamRubyApplicationShortcut();
@@ -76,9 +81,12 @@
Assert.assertEquals("All configurations deleted.", 0, this.getLaunchConfigurations().length);
ShamApplicationLaunchConfigurationDelegate.resetLaunches();
- IVMInstall interpreterOne = new RubyInterpreter("InterpreterOne", new File("C:/RubyInstallRootOne"));
- RubyRuntime.getDefault().setInstalledInterpreters(Arrays.asList(new IVMInstall[] { interpreterOne}));
-
+
+ vmType = RubyRuntime.getVMInstallType(VM_TYPE_ID);
+ VMStandin standin = new VMStandin(vmType, VM_ID);
+ standin.setInstallLocation(new File("C:/RubyInstallRootOne"));
+ standin.setName("InterpreterOne");
+ standin.convertToRealVM();
super.setUp();
}
@@ -90,7 +98,8 @@
public void testNoInterpreterInstalled() throws Exception {
- RubyRuntime.getDefault().setInstalledInterpreters(Arrays.asList(new IVMInstall[] { }));
+ vmType.disposeVMInstall(VM_ID);
+
ISelection selection = new StructuredSelection(rubyFile);
shortcut.launch(selection, ILaunchManager.RUN_MODE);
@@ -102,7 +111,7 @@
shortcut.launch(selection, ILaunchManager.RUN_MODE);
- assertEquals("A configuration has been created", 1, this.getLaunchConfigurations().length);
+ assertEquals("A configuration has been created", 1, getLaunchConfigurations().length);
assertEquals("A launch took place.", 1, shortcut.launchCount());
assertTrue("The shortcut should not log a message when asked to launch the correct file type.", !shortcut.didLog());
}
@@ -118,8 +127,8 @@
}
public void testLaunchWithSelectionMultipleConfigurationsExist() throws Exception {
- this.createConfiguration(rubyFile);
- this.createConfiguration(rubyFile);
+ createConfiguration(rubyFile);
+ createConfiguration(rubyFile);
ISelection selection = new StructuredSelection(rubyFile);
shortcut.launch(selection, ILaunchManager.RUN_MODE);
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-18 21:44:46 UTC (rev 1803)
@@ -21,8 +21,19 @@
<import plugin="org.eclipse.core.runtime"/>
<import plugin="org.eclipse.core.variables"/>
</requires>
-
+
+ <!-- Extension point definitions -->
+ <extension-point id="vmInstallTypes" name="%vmInstallTypes" schema="schema/vmInstallTypes.exsd"/>
+ <extension-point id="vmInstalls" name="%vmInstalls" schema="schema/vmInstalls.exsd"/>
+
<extension
+ point="org.rubypeople.rdt.launching.vmInstallTypes">
+ <vmInstallType
+ class="org.rubypeople.rdt.internal.launching.StandardVMType"
+ id="org.rubypeople.rdt.launching.StandardVMType">
+ </vmInstallType>
+ </extension>
+ <extension
point="org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
name="%LaunchConfigurationTypeRubyApplication.name"
Added: trunk/org.rubypeople.rdt.launching/schema/vmInstallTypes.exsd
===================================================================
--- trunk/org.rubypeople.rdt.launching/schema/vmInstallTypes.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.launching/schema/vmInstallTypes.exsd 2007-01-18 21:44:46 UTC (rev 1803)
@@ -0,0 +1,111 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.launching">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.launching" id="vmInstallTypes" name="Ruby VM Install Types"/>
+ </appInfo>
+ <documentation>
+ This extension point represents different kinds of Java runtime environments and development kits.
+Each extension must implement <code>org.eclipse.jdt.launching.IVMInstallType</code>.
+An <code>IVMInstallType</code> is responsible for creating and managing a set of instances of its corresponding <code>IVMInstall</code> class.
+Through creating different <code>IVMInstall</code> objects, an <code>IVMInstallType</code> allows for specific behaviour for various Java VMs.
+A UI for managing <code>IVMInstall</code>s is provided by the Java Debug UI plug-in.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="vmInstallType" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="vmInstallType">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique identifier that can be used to reference this IVMInstallType.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ the class that implements this VM install type. The class must implement IVMInstallType.
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.launching.AbstractVMInstallType"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The following is an example of an IVMInstallType for the J9 VM:
+
+<p>
+<pre>
+ <extension point="org.eclipse.jdt.launching.vmInstallTypes">
+ <vmInstallType
+ class="org.eclipse.jdt.internal.launching.j9.J9VMInstallType"
+ id="org.eclipse.jdt.internal.launching.j9.J9Type">
+ </vmInstallType>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ Abstract implementations of IVMInstall and IVMInstallType are provided. The Java Development Tools Launching Support plug-in defines a VM
+install type for the standard 1.1.* and 1.2/1.3/1.4 level <b>JRE</b>.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ Copyright (c) 2000, 2005 IBM Corporation and others.<br>
+All rights reserved. This program and the accompanying materials are made
+available under the terms of the Eclipse Public License v1.0 which
+accompanies this distribution, and is available at
+<a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>
+ </documentation>
+ </annotation>
+
+</schema>
Added: trunk/org.rubypeople.rdt.launching/schema/vmInstalls.exsd
===================================================================
--- trunk/org.rubypeople.rdt.launching/schema/vmInstalls.exsd (rev 0)
+++ trunk/org.rubypeople.rdt.launching/schema/vmInstalls.exsd 2007-01-18 21:44:46 UTC (rev 1803)
@@ -0,0 +1,147 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.rubypeople.rdt.launching">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.rubypeople.rdt.launching" id="vmInstalls" name="Ruby VM Installs"/>
+ </appInfo>
+ <documentation>
+ Allows specific configurations of Ruby runtime environments and development kits to be contributed to the Java development tooling.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <complexType>
+ <sequence>
+ <element ref="vmInstall" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="vmInstall">
+ <complexType>
+ <sequence>
+ <element ref="library" minOccurs="0" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique identifier for this VM install
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="vmInstallType" type="string" use="required">
+ <annotation>
+ <documentation>
+ References a registered VM install type via the corresponding vmInstallType's id
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ Human readable name for this VM install
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="home" type="string" use="required">
+ <annotation>
+ <documentation>
+ Path to the home installation directory for this VM install. Paths must be absolute and may use string substitution variables such as ${eclipse_home}.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="vmArgs" type="string">
+ <annotation>
+ <documentation>
+ Default VM arguments used when launching this VM install as they should appear on the command line.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="library">
+ <complexType>
+ <attribute name="path" type="string" use="required">
+ <annotation>
+ <documentation>
+ File system path to a system library, relative to the VM install's home directory.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ 3.2
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ Following is an example vm install definition.
+<p>
+<pre>
+<extension point="org.eclipse.jdt.launching.vmInstalls">
+ <vmInstall
+ home="${eclipse_home}/jre"
+ id="com.example.vm.id"
+ name="JRE-1.4"
+ vmInstallType="com.example.vm.type"/>
+</extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ JDT does not provide any specific VM installs.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+
+ </documentation>
+ </annotation>
+
+</schema>
Modified: 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-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -99,7 +99,7 @@
selectedInterpreter = configuration.getAttribute(RubyLaunchConfigurationAttribute.SELECTED_INTERPRETER, "");
} catch(CoreException e) {}
- return RubyRuntime.getDefault().getInterpreter(selectedInterpreter);
+ return RubyRuntime.getVMFromCompositeId(selectedInterpreter);
}
protected void addToLoadPath(List<String> loadPath, IProject project) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-18 21:44:46 UTC (rev 1803)
@@ -23,6 +23,13 @@
public static String AbstractInterpreterInstall_4;
public static String LaunchingPlugin_33;
public static String LaunchingPlugin_34;
+ public static String RubyRuntime_exceptionsOccurred;
+ public static String vmInstallType_duplicateVM;
+ public static String StandardVMType_Standard_VM_3;
+ public static String StandardVMType_Standard_VM_not_supported_on_MacOS__1;
+ public static String StandardVMType_Not_a_JDK_Root__Java_executable_was_not_found_1;
+ public static String StandardVMType_ok_2;
+ public static String StandardVMType_Not_a_JDK_root__System_library_was_not_found__1;
private LaunchingMessages() {}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-18 16:35:31 UTC (rev 1802)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-18 21:44:46 UTC (rev 1803)
@@ -11,4 +11,25 @@
RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection=Ruby process terminated because no connection to the debugger could me made
RdtLaunchingPlugin_interpreterNotFound=Please check the location of the following interpreter: {0}
RdtLaunchingPlugin_noInterpreterSelectedTitle=No interpreter selected
-RdtLaunchingPlugin_noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
\ No newline at end of file
+RdtLaunchingPlugin_noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
+
+RubyRuntime_badFormat=Invalid format
+RubyRuntime_VM_type_element_with_unknown_id_1=VM type element with unknown id
+RubyRuntime_VM_element_specified_with_no_id_attribute_2=id attribute missing from VM element specification
+RubyRuntime_exceptionOccurred=Exceptions occurred
+RubyRuntime_exceptionsOccurred=Exceptions occurred while saving VMs
+
+vmInstall_assert_idNotNull=id cannot be null
+vmInstall_assert_typeNotNull=VM type cannot be null
+AbstractInterpreterInstall_0=Unable to retrieve system properties
+AbstractInterpreterInstall_1=Evaluating system properties
+AbstractInterpreterInstall_3=Reading system properties
+AbstractInterpreterInstall_4=Exception retrieving system properties
+LaunchingPlugin_33=Unable to create XML parser.
+LaunchingPlugin_34=Unable to create XML parser.
+vmInstallType_duplicateVM=Duplicate VM: {0}
+StandardVMType_Standard_VM_3=Standard VM
+StandardVMType_Standard_VM_not_supported_on_MacOS__1=Standard VM not supported on MacOS.
+StandardVMType_Not_a_JDK_Root__Java_executable_was_not_found_1=Target is not a Ruby installation root. Ruby executable was not found
+StandardVMType_ok_2=ok
+StandardVMType_Not_a_JDK_root__System_library_was_not_found__1=Target is not a Ruby installation root. System library was not found.
\ No newlin...
[truncated message content] |
|
From: <caw...@us...> - 2007-01-18 16:35:39
|
Revision: 1802
http://svn.sourceforge.net/rubyeclipse/?rev=1802&view=rev
Author: cawilliams
Date: 2007-01-18 08:35:31 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
more renaming
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyContainerInitializer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/LoadPathEntryLabelProvider.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -60,7 +60,7 @@
}
/**
- * @see IBaseLabelProvider#removeInterpreterInstallChangedListener(ILabelProviderListener)
+ * @see IBaseLabelProvider#removeVMInstallChangedListener(ILabelProviderListener)
*/
public void removeListener(ILabelProviderListener listener) {
}
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEnvironmentTab.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -157,7 +157,7 @@
public void widgetSelected(SelectionEvent evt) {
EditInterpreterDialog dialog = new EditInterpreterDialog(this,
- fShell, RubyRuntime.getInterpreterInstallTypes(),
+ fShell, RubyRuntime.getVMInstallTypes(),
null);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
if (dialog.open() != Window.OK) {
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/preferences/RubyInterpreterPreferencePage.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -155,7 +155,7 @@
}
protected void addInterpreter() {
- EditInterpreterDialog dialog = new EditInterpreterDialog(this, getShell(), RubyRuntime.getInterpreterInstallTypes(), null);
+ EditInterpreterDialog dialog = new EditInterpreterDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), null);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_7);
if (dialog.open() != Window.OK) {
return;
@@ -195,7 +195,7 @@
// VMDetailsDialog dialog= new VMDetailsDialog(getShell(), vm);
// dialog.open();
// } else {
- EditInterpreterDialog dialog= new EditInterpreterDialog(this, getShell(), RubyRuntime.getInterpreterInstallTypes(), vm);
+ EditInterpreterDialog dialog= new EditInterpreterDialog(this, getShell(), RubyRuntime.getVMInstallTypes(), vm);
dialog.setTitle(RubyVMMessages.InstalledJREsBlock_8);
if (dialog.open() != Window.OK) {
return;
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyContainerInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyContainerInitializer.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyContainerInitializer.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -42,13 +42,13 @@
String vmTypeId = getInterpreterTypeId(containerPath);
String vmName = getInterpreterName(containerPath);
IVMInstallType vmType = RubyRuntime
- .getInterpreterInstallType(vmTypeId);
+ .getVMInstallType(vmTypeId);
if (vmType != null) {
vm = vmType.findVMInstallByName(vmName);
}
} else {
// workspace default Ruby VM
- vm = RubyRuntime.getDefaultInterpreterInstall();
+ vm = RubyRuntime.getDefaultVMInstall();
}
return vm;
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -18,7 +18,7 @@
@Override
public void initialize(String variable) {
- IVMInstall vmInstall= RubyRuntime.getDefaultInterpreterInstall();
+ IVMInstall vmInstall= RubyRuntime.getDefaultVMInstall();
if (vmInstall != null) {
IPath newPath= null;
IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyVMContainer.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -60,7 +60,7 @@
fgLoadpathEntries.remove(removedVm);
}
};
- RubyRuntime.addInterpreterInstallChangedListener(listener);
+ RubyRuntime.addVMInstallChangedListener(listener);
}
ILoadpathEntry[] entries = (ILoadpathEntry[])fgLoadpathEntries.get(vm);
if (entries == null) {
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -422,7 +422,7 @@
// Retrieve the 'id' attribute and the corresponding VM type object
String id = vmTypeElement.getAttribute("id"); //$NON-NLS-1$
- IVMInstallType vmType= RubyRuntime.getInterpreterInstallType(id);
+ IVMInstallType vmType= RubyRuntime.getVMInstallType(id);
if (vmType != null) {
// For each VM child node, populate the container with a subordinate node
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -83,7 +83,7 @@
PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_NAME, fName, name);
fName= name;
if (fNotify) {
- RubyRuntime.fireInterpreterChanged(event);
+ RubyRuntime.fireVMChanged(event);
}
}
}
@@ -105,7 +105,7 @@
PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_INSTALL_LOCATION, fInstallLocation, installLocation);
fInstallLocation= installLocation;
if (fNotify) {
- RubyRuntime.fireInterpreterChanged(event);
+ RubyRuntime.fireVMChanged(event);
}
}
}
@@ -164,7 +164,7 @@
PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS, prevLocations, newLocations);
fSystemLibraryDescriptions = locations;
if (fNotify) {
- RubyRuntime.fireInterpreterChanged(event);
+ RubyRuntime.fireVMChanged(event);
}
}
@@ -253,7 +253,7 @@
PropertyChangeEvent event = new PropertyChangeEvent(this, IVMInstallChangedListener.PROPERTY_VM_ARGUMENTS, fInterpreterArgs, vmArgs);
fInterpreterArgs = vmArgs;
if (fNotify) {
- RubyRuntime.fireInterpreterChanged(event);
+ RubyRuntime.fireVMChanged(event);
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -125,7 +125,7 @@
return runtime;
}
- public static void removeInterpreterInstallChangedListener(IVMInstallChangedListener listener) {
+ public static void removeVMInstallChangedListener(IVMInstallChangedListener listener) {
fgVMListeners.remove(listener);
}
@@ -151,11 +151,7 @@
IVMInstall oldInterpreter = selectedInterpreter;
selectedInterpreter = anInterpreter;
saveRuntimeConfiguration();
- Object[] listeners = fgVMListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- IVMInstallChangedListener listener = (IVMInstallChangedListener)listeners[i];
- listener.defaultVMInstallChanged(oldInterpreter, anInterpreter);
- }
+ notifyDefaultVMChanged(oldInterpreter, anInterpreter);
}
public void addInstalledInterpreter(IVMInstall anInterpreter) {
@@ -281,18 +277,26 @@
return new File(fileLocation.toOSString());
}
- public static void addInterpreterInstallChangedListener(IVMInstallChangedListener listener) {
+ public static void addVMInstallChangedListener(IVMInstallChangedListener listener) {
fgVMListeners.add(listener);
}
+ private static void notifyDefaultVMChanged(IVMInstall previous, IVMInstall current) {
+ Object[] listeners = fgVMListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ IVMInstallChangedListener listener = (IVMInstallChangedListener)listeners[i];
+ listener.defaultVMInstallChanged(previous, current);
+ }
+ }
+
/**
* Returns the VM install type with the given unique id.
* @param id the VM install type unique id
* @return The VM install type for the given id, or <code>null</code> if no
* VM install type with the given id is registered.
*/
- public static IVMInstallType getInterpreterInstallType(String id) {
- IVMInstallType[] vmTypes= getInterpreterInstallTypes();
+ public static IVMInstallType getVMInstallType(String id) {
+ IVMInstallType[] vmTypes= getVMInstallTypes();
for (int i= 0; i < vmTypes.length; i++) {
if (vmTypes[i].getId().equals(id)) {
return vmTypes[i];
@@ -308,12 +312,12 @@
*
* @return the list of registered VM types
*/
- public static IVMInstallType[] getInterpreterInstallTypes() {
- initializeInterpreters();
+ public static IVMInstallType[] getVMInstallTypes() {
+ initializeVMs();
return fgInterpreterTypes;
}
- public static IVMInstall getDefaultInterpreterInstall() {
+ public static IVMInstall getDefaultVMInstall() {
// TODO Auto-generated method stub
return null;
}
@@ -322,9 +326,9 @@
* Perform VM type and VM install initialization. Does not hold locks
* while performing change notification.
*
- * @since 3.2
+ * @since 0.9.0
*/
- private static void initializeInterpreters() {
+ private static void initializeVMs() {
VMDefinitionsContainer vmDefs = null;
boolean setPref = false;
synchronized (fgVMLock) {
@@ -384,12 +388,12 @@
}
if (vmDefs != null) {
// notify of initial VMs for backwards compatibility
- IVMInstallType[] installTypes = getInterpreterInstallTypes();
+ IVMInstallType[] installTypes = getVMInstallTypes();
for (int i = 0; i < installTypes.length; i++) {
IVMInstallType type = installTypes[i];
IVMInstall[] installs = type.getVMInstalls();
for (int j = 0; j < installs.length; j++) {
- fireInterpreterAdded(installs[j]);
+ fireVMAdded(installs[j]);
}
}
@@ -527,7 +531,7 @@
abort(MessageFormat.format("Missing required id attribute for vmInstall contributed by {0}", //$NON-NLS-1$
(Object[]) new String[]{element.getContributor().getName()}), null);
}
- IVMInstallType installType = getInterpreterInstallType(vmType);
+ IVMInstallType installType = getVMInstallType(vmType);
if (installType == null) {
abort(MessageFormat.format("vmInstall {0} contributed by {1} references undefined VM install type {2}", //$NON-NLS-1$
(Object[]) new String[]{id, element.getContributor().getName(), vmType}), null);
@@ -634,15 +638,37 @@
throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), code, message, exception));
}
- private static void fireInterpreterAdded(IVMInstall interpreter) {
- // TODO Actually notify IInterpreterInstallChangedListeners
-
+ private static void fireVMAdded(IVMInstall vm) {
+ if (!fgInitializingVMs) {
+ Object[] listeners = fgVMListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ IVMInstallChangedListener listener = (IVMInstallChangedListener)listeners[i];
+ listener.vmAdded(vm);
+ }
+ }
}
- public static void fireInterpreterChanged(PropertyChangeEvent event) {
- // TODO Actually notify IInterpreterInstallChangedListeners
-
+ public static void fireVMChanged(PropertyChangeEvent event) {
+ Object[] listeners = fgVMListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ IVMInstallChangedListener listener = (IVMInstallChangedListener)listeners[i];
+ listener.vmChanged(event);
+ }
}
+
+ /**
+ * Notifies all VM install changed listeners of the VM removal
+ *
+ * @param vm the VM that has been removed
+ * @since 0.9.0
+ */
+ public static void fireVMRemoved(IVMInstall vm) {
+ Object[] listeners = fgVMListeners.getListeners();
+ for (int i = 0; i < listeners.length; i++) {
+ IVMInstallChangedListener listener = (IVMInstallChangedListener)listeners[i];
+ listener.vmRemoved(vm);
+ }
+ }
/**
* Evaluates library locations for a IVMInstall. If no library locations are set on the install, a default
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-01-18 16:30:20 UTC (rev 1801)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-01-18 16:35:31 UTC (rev 1802)
@@ -152,7 +152,7 @@
public void vmRemoved(IVMInstall removedVm) {
}
};
- RubyRuntime.addInterpreterInstallChangedListener(runtimeListener);
+ RubyRuntime.addVMInstallChangedListener(runtimeListener);
RubyPlugin.getDefault().getPreferenceStore().addPropertyChangeListener(new IPropertyChangeListener() {
public void propertyChange(org.eclipse.jface.util.PropertyChangeEvent event) {
@@ -202,7 +202,7 @@
public void dispose() {
descriptionUpdater.requestStop();
- RubyRuntime.removeInterpreterInstallChangedListener(runtimeListener);
+ RubyRuntime.removeVMInstallChangedListener(runtimeListener);
super.dispose();
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 16:30:23
|
Revision: 1801
http://svn.sourceforge.net/rubyeclipse/?rev=1801&view=rev
Author: cawilliams
Date: 2007-01-18 08:30:20 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
fixing the loadpathVariableInitializer stuff
Modified Paths:
--------------
trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
Modified: trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd
===================================================================
--- trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd 2007-01-18 16:05:57 UTC (rev 1800)
+++ trunk/org.rubypeople.rdt.core/schema/loadpathVariableInitializer.exsd 2007-01-18 16:30:20 UTC (rev 1801)
@@ -3,7 +3,7 @@
<schema targetNamespace="org.rubypeople.rdt.core">
<annotation>
<appInfo>
- <meta.schema plugin="org.rubypeople.rdt.core" id="loadpathVariableInitializer" name="loadpathVariableInitializer"/>
+ <meta.schema plugin="org.rubypeople.rdt.core" id="loadpathVariableInitializer" name="Loadpath Variable Initializers"/>
</appInfo>
<documentation>
This extension point allows clients to contribute custom loadpath variable initializers,
@@ -13,7 +13,8 @@
<element name="extension">
<complexType>
- <sequence minOccurs="0" maxOccurs="unbounded">
+ <sequence>
+ <element ref="loadpathVariableInitializer" minOccurs="0" maxOccurs="unbounded"/>
</sequence>
<attribute name="point" type="string" use="required">
<annotation>
@@ -58,7 +59,7 @@
This class must implement a public subclass of &lt;code&gt;org.rubypeople.rdt.core.LoadpathVariableInitializer&lt;/code&gt; with a public 0-argument constructor.
</documentation>
<appInfo>
- <meta.attribute kind="ruby" basedOn="org.rubypeople.rdt.core.LoadpathVariableInitializer"/>
+ <meta.attribute kind="java" basedOn="org.rubypeople.rdt.core.LoadpathVariableInitializer"/>
</appInfo>
</annotation>
</attribute>
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-18 16:05:57 UTC (rev 1800)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/core/RubyCore.java 2007-01-18 16:30:20 UTC (rev 1801)
@@ -1250,4 +1250,66 @@
}
+ /**
+ * Sets the value of the given classpath variable.
+ * The path must not be null.
+ * <p>
+ * This functionality cannot be used while the resource tree is locked.
+ * <p>
+ * Classpath variable values are persisted locally to the workspace, and
+ * are preserved from session to session.
+ * <p>
+ * Updating a variable with the same value has no effect.
+ *
+ * @param variableName the name of the classpath variable
+ * @param path the path
+ * @param monitor a monitor to report progress
+ * @throws RubyModelException
+ * @see #getLoadpathVariable(String)
+ */
+ public static void setLoadpathVariable(
+ String variableName,
+ IPath path,
+ IProgressMonitor monitor)
+ throws RubyModelException {
+
+ if (path == null) Assert.isTrue(false, "Variable path cannot be null"); //$NON-NLS-1$
+ setLoadpathVariables(new String[]{variableName}, new IPath[]{ path }, monitor);
+ }
+
+ /**
+ * Sets the values of all the given classpath variables at once.
+ * Null paths can be used to request corresponding variable removal.
+ * <p>
+ * A combined Java element delta will be notified to describe the corresponding
+ * classpath changes resulting from the variables update. This operation is batched,
+ * and automatically eliminates unnecessary updates (new variable is same as old one).
+ * This operation acquires a lock on the workspace's root.
+ * <p>
+ * This functionality cannot be used while the workspace is locked, since
+ * it may create/remove some resource markers.
+ * <p>
+ * Classpath variable values are persisted locally to the workspace, and
+ * are preserved from session to session.
+ * <p>
+ * Updating a variable with the same value has no effect.
+ *
+ * @param variableNames an array of names for the updated classpath variables
+ * @param paths an array of path updates for the modified classpath variables (null
+ * meaning that the corresponding value will be removed
+ * @param monitor a monitor to report progress
+ * @throws RubyModelException
+ * @see #getLoadpathVariable(String)
+ * @since 0.9.0
+ */
+ public static void setLoadpathVariables(
+ String[] variableNames,
+ IPath[] paths,
+ IProgressMonitor monitor)
+ throws RubyModelException {
+
+ if (variableNames.length != paths.length) Assert.isTrue(false, "Variable names and paths collections should have the same size"); //$NON-NLS-1$
+ RubyModelManager.getRubyModelManager().updateVariableValues(variableNames, paths, true/*update preferences*/, monitor);
+ }
+
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-01-18 16:05:57 UTC (rev 1800)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/compiler/util/Util.java 2007-01-18 16:30:20 UTC (rev 1801)
@@ -102,4 +102,17 @@
return contents;
}
+ /**
+ * Converts an array of Objects into String.
+ */
+ public static String toString(Object[] objects) {
+ return toString(objects,
+ new Displayable(){
+ public String displayString(Object o) {
+ if (o == null) return "null"; //$NON-NLS-1$
+ return o.toString();
+ }
+ });
+ }
+
}
Modified: trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java
===================================================================
--- trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-01-18 16:05:57 UTC (rev 1800)
+++ trunk/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/RubyModelManager.java 2007-01-18 16:30:20 UTC (rev 1801)
@@ -44,11 +44,13 @@
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IPreferencesService;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.osgi.service.prefs.BackingStoreException;
import org.rubypeople.rdt.core.ILoadpathContainer;
import org.rubypeople.rdt.core.ILoadpathEntry;
import org.rubypeople.rdt.core.IParent;
import org.rubypeople.rdt.core.IProblemRequestor;
import org.rubypeople.rdt.core.IRubyElement;
+import org.rubypeople.rdt.core.IRubyModel;
import org.rubypeople.rdt.core.IRubyProject;
import org.rubypeople.rdt.core.IRubyScript;
import org.rubypeople.rdt.core.ISourceFolder;
@@ -176,6 +178,9 @@
public static final IRubyScript[] NO_WORKING_COPY = new IRubyScript[0];
public static final boolean VERBOSE = false;
+
+ public final static String CP_VARIABLE_PREFERENCES_PREFIX = RubyCore.PLUGIN_ID+".loadpathVariable."; //$NON-NLS-1$
+
/**
* Special value used for recognizing ongoing initialization and breaking initialization cycles
*/
@@ -1657,4 +1662,197 @@
return true;
}
+ /*
+ * Internal updating of a variable values (null path meaning removal), allowing to change multiple variable values at once.
+ */
+ public void updateVariableValues(
+ String[] variableNames,
+ IPath[] variablePaths,
+ boolean updatePreferences,
+ IProgressMonitor monitor) throws RubyModelException {
+
+ if (monitor != null && monitor.isCanceled()) return;
+
+ if (CP_RESOLVE_VERBOSE){
+ Util.verbose(
+ "CPVariable SET - setting variables\n" + //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(variableNames) + '\n' +//$NON-NLS-1$
+ " values: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(variablePaths)); //$NON-NLS-1$
+ }
+
+ if (variablePutIfInitializingWithSameValue(variableNames, variablePaths))
+ return;
+
+ int varLength = variableNames.length;
+
+ // gather classpath information for updating
+ final HashMap affectedProjectClasspaths = new HashMap(5);
+ IRubyModel model = getRubyModel();
+
+ // filter out unmodified variables
+ int discardCount = 0;
+ for (int i = 0; i < varLength; i++){
+ String variableName = variableNames[i];
+ IPath oldPath = this.variableGet(variableName); // if reentering will provide previous session value
+ if (oldPath == VARIABLE_INITIALIZATION_IN_PROGRESS){
+// IPath previousPath = (IPath)this.previousSessionVariables.get(variableName);
+// if (previousPath != null){
+// if (CP_RESOLVE_VERBOSE){
+// Util.verbose(
+// "CPVariable INIT - reentering access to variable during its initialization, will see previous value\n" +
+// " variable: "+ variableName + '\n' +
+// " previous value: " + previousPath);
+// }
+// this.variablePut(variableName, previousPath); // replace value so reentering calls are seeing old value
+// }
+ oldPath = null; //33695 - cannot filter out restored variable, must update affected project to reset cached CP
+ }
+ if (oldPath != null && oldPath.equals(variablePaths[i])){
+ variableNames[i] = null;
+ discardCount++;
+ }
+ }
+ if (discardCount > 0){
+ if (discardCount == varLength) return;
+ int changedLength = varLength - discardCount;
+ String[] changedVariableNames = new String[changedLength];
+ IPath[] changedVariablePaths = new IPath[changedLength];
+ for (int i = 0, index = 0; i < varLength; i++){
+ if (variableNames[i] != null){
+ changedVariableNames[index] = variableNames[i];
+ changedVariablePaths[index] = variablePaths[i];
+ index++;
+ }
+ }
+ variableNames = changedVariableNames;
+ variablePaths = changedVariablePaths;
+ varLength = changedLength;
+ }
+
+ if (monitor != null && monitor.isCanceled()) return;
+
+ if (model != null) {
+ IRubyProject[] projects = model.getRubyProjects();
+ nextProject : for (int i = 0, projectLength = projects.length; i < projectLength; i++){
+ RubyProject project = (RubyProject) projects[i];
+
+ // check to see if any of the modified variables is present on the loadpath
+ ILoadpathEntry[] classpath = project.getRawLoadpath();
+ for (int j = 0, cpLength = classpath.length; j < cpLength; j++){
+
+ ILoadpathEntry entry = classpath[j];
+ for (int k = 0; k < varLength; k++){
+
+ String variableName = variableNames[k];
+ if (entry.getEntryKind() == ILoadpathEntry.CPE_VARIABLE){
+
+ if (variableName.equals(entry.getPath().segment(0))){
+ affectedProjectClasspaths.put(project, project.getResolvedLoadpath(true/*ignoreUnresolvedEntry*/, false/*don't generateMarkerOnError*/, false/*don't returnResolutionInProgress*/));
+ continue nextProject;
+ }
+ }
+ }
+ }
+ }
+ }
+ // update variables
+ for (int i = 0; i < varLength; i++){
+ variablePut(variableNames[i], variablePaths[i]);
+ if (updatePreferences)
+ variablePreferencesPut(variableNames[i], variablePaths[i]);
+ }
+ final String[] dbgVariableNames = variableNames;
+
+ // update affected project loadpaths
+ if (!affectedProjectClasspaths.isEmpty()) {
+ try {
+ final boolean canChangeResources = !ResourcesPlugin.getWorkspace().isTreeLocked();
+ RubyCore.run(
+ new IWorkspaceRunnable() {
+ public void run(IProgressMonitor progressMonitor) throws CoreException {
+ // propagate loadpath change
+ Iterator projectsToUpdate = affectedProjectClasspaths.keySet().iterator();
+ while (projectsToUpdate.hasNext()) {
+
+ if (progressMonitor != null && progressMonitor.isCanceled()) return;
+
+ RubyProject affectedProject = (RubyProject) projectsToUpdate.next();
+
+ if (CP_RESOLVE_VERBOSE){
+ Util.verbose(
+ "CPVariable SET - updating affected project due to setting variables\n" + //$NON-NLS-1$
+ " project: " + affectedProject.getElementName() + '\n' + //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(dbgVariableNames)); //$NON-NLS-1$
+ }
+
+ affectedProject
+ .setRawLoadpath(
+ affectedProject.getRawLoadpath(),
+ SetLoadpathOperation.DO_NOT_SET_OUTPUT,
+ null, // don't call beginTask on the monitor (see http://bugs.eclipse.org/bugs/show_bug.cgi?id=3717)
+ canChangeResources,
+ (ILoadpathEntry[]) affectedProjectClasspaths.get(affectedProject),
+ false, // updating - no need for early validation
+ false); // updating - no need to save
+ }
+ }
+ },
+ null/*no need to lock anything*/,
+ monitor);
+ } catch (CoreException e) {
+ if (CP_RESOLVE_VERBOSE){
+ Util.verbose(
+ "CPVariable SET - FAILED DUE TO EXCEPTION\n" + //$NON-NLS-1$
+ " variables: " + org.rubypeople.rdt.internal.compiler.util.Util.toString(dbgVariableNames), //$NON-NLS-1$
+ System.err);
+ e.printStackTrace();
+ }
+ if (e instanceof RubyModelException) {
+ throw (RubyModelException)e;
+ } else {
+ throw new RubyModelException(e);
+ }
+ }
+ }
+ }
+
+ private void variablePreferencesPut(String variableName, IPath variablePath) {
+ String variableKey = CP_VARIABLE_PREFERENCES_PREFIX+variableName;
+ if (variablePath == null) {
+ this.variablesWithInitializer.remove(variableName);
+ getInstancePreferences().remove(variableKey);
+ } else {
+ getInstancePreferences().put(variableKey, variablePath.toString());
+ }
+ try {
+ getInstancePreferences().flush();
+ } catch (BackingStoreException e) {
+ // ignore exception
+ }
+ }
+
+ /**
+ * Get workpsace eclipse preference for JavaCore plugin.
+ */
+ public IEclipsePreferences getInstancePreferences() {
+ return preferencesLookup[PREF_INSTANCE];
+ }
+
+ /*
+ * Optimize startup case where 1 variable is initialized at a time with the same value as on shutdown.
+ */
+ public boolean variablePutIfInitializingWithSameValue(String[] variableNames, IPath[] variablePaths) {
+ if (variableNames.length != 1)
+ return false;
+ String variableName = variableNames[0];
+ IPath oldPath = getPreviousSessionVariable(variableName);
+ if (oldPath == null)
+ return false;
+ IPath newPath = variablePaths[0];
+ if (!oldPath.equals(newPath))
+ return false;
+ variablePut(variableName, newPath);
+ return true;
+ }
+
}
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLoadpathVariablesInitializer.java 2007-01-18 16:30:20 UTC (rev 1801)
@@ -0,0 +1,95 @@
+package org.rubypeople.rdt.internal.launching;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceDescription;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.rubypeople.rdt.core.LoadpathVariableInitializer;
+import org.rubypeople.rdt.core.RubyCore;
+import org.rubypeople.rdt.launching.IVMInstall;
+import org.rubypeople.rdt.launching.RubyRuntime;
+
+public class RubyLoadpathVariablesInitializer extends LoadpathVariableInitializer {
+
+ private IProgressMonitor fMonitor;
+
+ @Override
+ public void initialize(String variable) {
+ IVMInstall vmInstall= RubyRuntime.getDefaultInterpreterInstall();
+ if (vmInstall != null) {
+ IPath newPath= null;
+ IPath[] locations= RubyRuntime.getLibraryLocations(vmInstall);
+ // FIXME What should we be looking for?!
+ // look for rt.jar or classes.zip (both may exist, so do exhaustive search)
+ IPath rtjar = null;
+ IPath classeszip = null;
+ for (int i = 0; i < locations.length; i++) {
+ IPath location = locations[i];
+ String name = location.lastSegment();
+ if (name.equalsIgnoreCase("rt.jar")) { //$NON-NLS-1$
+ rtjar = location;
+ } else if (name.equalsIgnoreCase("classes.zip")) { //$NON-NLS-1$
+ classeszip = location;
+ }
+ }
+ // rt.jar if present, then classes.zip, else the first library
+ IPath systemLib = rtjar;
+ if (systemLib == null) {
+ systemLib = classeszip;
+ }
+ if (systemLib == null && locations.length > 0) {
+ systemLib = locations[0];
+ }
+ if (systemLib != null) {
+ if (variable.equals(RubyRuntime.RUBYLIB_VARIABLE)) {
+ newPath= systemLib;
+ }
+ if (newPath == null) {
+ return;
+ }
+ IWorkspace workspace= ResourcesPlugin.getWorkspace();
+ IWorkspaceDescription wsDescription= workspace.getDescription();
+ boolean wasAutobuild= wsDescription.isAutoBuilding();
+ try {
+ setAutobuild(workspace, false);
+ setRubyVMVariable(newPath, variable);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ return;
+ } finally {
+ try {
+ setAutobuild(workspace, wasAutobuild);
+ } catch (CoreException ce) {
+ LaunchingPlugin.log(ce);
+ }
+ }
+ }
+ }
+
+ }
+
+ private void setRubyVMVariable(IPath newPath, String var) throws CoreException {
+ RubyCore.setLoadpathVariable(var, newPath, getMonitor());
+ }
+
+ private boolean setAutobuild(IWorkspace ws, boolean newState) throws CoreException {
+ IWorkspaceDescription wsDescription= ws.getDescription();
+ boolean oldState= wsDescription.isAutoBuilding();
+ if (oldState != newState) {
+ wsDescription.setAutoBuilding(newState);
+ ws.setDescription(wsDescription);
+ }
+ return oldState;
+ }
+
+ protected IProgressMonitor getMonitor() {
+ if (fMonitor == null) {
+ return new NullProgressMonitor();
+ }
+ return fMonitor;
+ }
+
+}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:05:57 UTC (rev 1800)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:30:20 UTC (rev 1801)
@@ -35,9 +35,9 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.core.variables.VariablesPlugin;
import org.rubypeople.rdt.internal.launching.CompositeId;
-import org.rubypeople.rdt.internal.launching.ListenerList;
import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.ListenerList;
import org.rubypeople.rdt.internal.launching.RubyInterpreter;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
import org.rubypeople.rdt.internal.launching.VMStandin;
@@ -89,6 +89,13 @@
* @since 0.9.0
*/
public static final String EXTENSION_POINT_VM_INSTALLS = "vmInstalls"; //$NON-NLS-1$
+
+ /**
+ * Classpath variable name used for the default RubyVM's library
+ * (value <code>"RUBY_LIB"</code>).
+ */
+ public static final String RUBYLIB_VARIABLE= "RUBY_LIB"; //$NON-NLS-1$
+
private static IVMInstallType[] fgInterpreterTypes= null;
@@ -636,4 +643,25 @@
// TODO Actually notify IInterpreterInstallChangedListeners
}
+
+ /**
+ * Evaluates library locations for a IVMInstall. If no library locations are set on the install, a default
+ * location is evaluated and checked if it exists.
+ * @return library locations with paths that exist or are empty
+ * @since 0.9.0
+ */
+ public static IPath[] getLibraryLocations(IVMInstall vm) {
+ IPath[] locations= vm.getLibraryLocations();
+ if (locations != null) return locations;
+
+ IPath[] dflts= vm.getVMInstallType().getDefaultLibraryLocations(vm.getInstallLocation());
+ IPath[] libraryPaths = new IPath[dflts.length];
+ for (int i = 0; i < dflts.length; i++) {
+ libraryPaths[i]= dflts[i];
+ if (!libraryPaths[i].toFile().isFile()) {
+ libraryPaths[i]= Path.EMPTY;
+ }
+ }
+ return libraryPaths;
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 16:06:07
|
Revision: 1800
http://svn.sourceforge.net/rubyeclipse/?rev=1800&view=rev
Author: cawilliams
Date: 2007-01-18 08:05:57 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Modified 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/LaunchingPlugin.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.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties
Modified: 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-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -38,7 +38,7 @@
debugTarget.terminate();
}
} else {
- LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
+ LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, LaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
debugTarget.terminate();
}
return process;
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -0,0 +1,32 @@
+package org.rubypeople.rdt.internal.launching;
+
+import org.eclipse.osgi.util.NLS;
+
+public class LaunchingMessages {
+
+ private static final String BUNDLE_NAME = LaunchingMessages.class.getName();
+
+ public static String RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection;
+ public static String RdtLaunchingPlugin_internalErrorOccurred;
+ public static String RdtLaunchingPlugin_noInterpreterSelected;
+ public static String RdtLaunchingPlugin_interpreterNotFound;
+ public static String RdtLaunchingPlugin_noInterpreterSelectedTitle;
+ public static String RubyRuntime_badFormat;
+ public static String RubyRuntime_VM_type_element_with_unknown_id_1;
+ public static String RubyRuntime_VM_element_specified_with_no_id_attribute_2;
+ public static String RubyRuntime_exceptionOccurred;
+ public static String vmInstall_assert_typeNotNull;
+ public static String vmInstall_assert_idNotNull;
+ public static String AbstractInterpreterInstall_0;
+ public static String AbstractInterpreterInstall_1;
+ public static String AbstractInterpreterInstall_3;
+ public static String AbstractInterpreterInstall_4;
+ public static String LaunchingPlugin_33;
+ public static String LaunchingPlugin_34;
+
+ private LaunchingMessages() {}
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, LaunchingMessages.class);
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.java
___________________________________________________________________
Name: svn:eol-style
+ native
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties 2007-01-18 16:05:57 UTC (rev 1800)
@@ -0,0 +1,14 @@
+#########################################
+# (c) Copyright RubyPeople, Inc. 2002.
+# All Rights Reserved.
+#########################################
+
+#########################################
+# RdtLaunchingPlugin
+#########################################
+
+RdtLaunchingPlugin_internalErrorOccurred=Internal error occurred
+RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection=Ruby process terminated because no connection to the debugger could me made
+RdtLaunchingPlugin_interpreterNotFound=Please check the location of the following interpreter: {0}
+RdtLaunchingPlugin_noInterpreterSelectedTitle=No interpreter selected
+RdtLaunchingPlugin_noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
\ No newline at end of file
Property changes on: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingMessages.properties
___________________________________________________________________
Name: svn:eol-style
+ native
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -58,7 +58,7 @@
}
public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_internalErrorOccurred, e));
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, LaunchingMessages.RdtLaunchingPlugin_internalErrorOccurred, e));
}
public static void debug(String message) {
@@ -127,9 +127,9 @@
fgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
fgXMLParser.setErrorHandler(new DefaultHandler());
} catch (ParserConfigurationException e) {
- abort(RdtLaunchingMessages.LaunchingPlugin_33, e);
+ abort(LaunchingMessages.LaunchingPlugin_33, e);
} catch (FactoryConfigurationError e) {
- abort(RdtLaunchingMessages.LaunchingPlugin_34, e);
+ abort(LaunchingMessages.LaunchingPlugin_34, e);
}
}
return fgXMLParser;
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -1,32 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import org.eclipse.osgi.util.NLS;
-
-public class RdtLaunchingMessages {
-
- private static final String BUNDLE_NAME = RdtLaunchingMessages.class.getName();
-
- public static String RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection;
- public static String RdtLaunchingPlugin_internalErrorOccurred;
- public static String RdtLaunchingPlugin_noInterpreterSelected;
- public static String RdtLaunchingPlugin_interpreterNotFound;
- public static String RdtLaunchingPlugin_noInterpreterSelectedTitle;
- public static String RubyRuntime_badFormat;
- public static String RubyRuntime_VM_type_element_with_unknown_id_1;
- public static String RubyRuntime_VM_element_specified_with_no_id_attribute_2;
- public static String RubyRuntime_exceptionOccurred;
- public static String vmInstall_assert_typeNotNull;
- public static String vmInstall_assert_idNotNull;
- public static String AbstractInterpreterInstall_0;
- public static String AbstractInterpreterInstall_1;
- public static String AbstractInterpreterInstall_3;
- public static String AbstractInterpreterInstall_4;
- public static String LaunchingPlugin_33;
- public static String LaunchingPlugin_34;
-
- private RdtLaunchingMessages() {}
-
- static {
- NLS.initializeMessages(BUNDLE_NAME, RdtLaunchingMessages.class);
- }
-}
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingMessages.properties 2007-01-18 16:05:57 UTC (rev 1800)
@@ -1,14 +0,0 @@
-#########################################
-# (c) Copyright RubyPeople, Inc. 2002.
-# All Rights Reserved.
-#########################################
-
-#########################################
-# RdtLaunchingPlugin
-#########################################
-
-RdtLaunchingPlugin_internalErrorOccurred=Internal error occurred
-RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection=Ruby process terminated because no connection to the debugger could me made
-RdtLaunchingPlugin_interpreterNotFound=Please check the location of the following interpreter: {0}
-RdtLaunchingPlugin_noInterpreterSelectedTitle=No interpreter selected
-RdtLaunchingPlugin_noInterpreterSelected=There is currently no ruby interpreter defined. Use preferences to define and select the active interpreter.
\ No newline at end of file
Modified: 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-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -22,7 +22,7 @@
*/
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (RubyRuntime.getDefault().getSelectedInterpreter() == null) {
- throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
+ throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, LaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
}
if (mode.equals("debug")) {
Modified: 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-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -57,7 +57,7 @@
if( installLocation.isFile() ){
return installLocation.getAbsolutePath();
}
- String errorMessage = MessageFormat.format(RdtLaunchingMessages.RdtLaunchingPlugin_interpreterNotFound, new Object[] {this.getName()}) ;
+ String errorMessage = MessageFormat.format(LaunchingMessages.RdtLaunchingPlugin_interpreterNotFound, new Object[] {this.getName()}) ;
throw new IllegalCommandException(errorMessage) ;
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -382,17 +382,17 @@
parser.setErrorHandler(new DefaultHandler());
config = parser.parse(new InputSource(stream)).getDocumentElement();
} catch (SAXException e) {
- throw new IOException(RdtLaunchingMessages.RubyRuntime_badFormat);
+ throw new IOException(LaunchingMessages.RubyRuntime_badFormat);
} catch (ParserConfigurationException e) {
stream.close();
- throw new IOException(RdtLaunchingMessages.RubyRuntime_badFormat);
+ throw new IOException(LaunchingMessages.RubyRuntime_badFormat);
} finally {
stream.close();
}
// If the top-level node wasn't what we expected, bail out
if (!config.getNodeName().equalsIgnoreCase("vmSettings")) { //$NON-NLS-1$
- throw new IOException(RdtLaunchingMessages.RubyRuntime_badFormat);
+ throw new IOException(LaunchingMessages.RubyRuntime_badFormat);
}
// Populate the default VM-related fields
@@ -438,7 +438,7 @@
}
}
} else {
- LaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
+ LaunchingPlugin.log(LaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
}
}
@@ -490,7 +490,7 @@
vmStandin.setVMArgs(vmArgs);
}
} else {
- LaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2);
+ LaunchingPlugin.log(LaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2);
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -17,7 +17,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingMessages;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
/**
* Abstract implementation of a Interpreter install.
@@ -51,9 +51,9 @@
*/
public AbstractInterpreter(IVMInstallType type, String id) {
if (type == null)
- throw new IllegalArgumentException(RdtLaunchingMessages.vmInstall_assert_typeNotNull);
+ throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_typeNotNull);
if (id == null)
- throw new IllegalArgumentException(RdtLaunchingMessages.vmInstall_assert_idNotNull);
+ throw new IllegalArgumentException(LaunchingMessages.vmInstall_assert_idNotNull);
fType= type;
fId= id;
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -36,7 +36,7 @@
import org.eclipse.core.variables.VariablesPlugin;
import org.rubypeople.rdt.internal.launching.CompositeId;
import org.rubypeople.rdt.internal.launching.ListenerList;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingMessages;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.launching.RubyInterpreter;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
@@ -409,7 +409,7 @@
private static void initializeVMTypeExtensions() {
IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, "vmInstallTypes"); //$NON-NLS-1$
IConfigurationElement[] configs= extensionPoint.getConfigurationElements();
- MultiStatus status= new MultiStatus(LaunchingPlugin.getUniqueIdentifier(), IStatus.OK, RdtLaunchingMessages.RubyRuntime_exceptionOccurred, null);
+ MultiStatus status= new MultiStatus(LaunchingPlugin.getUniqueIdentifier(), IStatus.OK, LaunchingMessages.RubyRuntime_exceptionOccurred, null);
fgInterpreterTypes= new IVMInstallType[configs.length];
for (int i= 0; i < configs.length; i++) {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java 2007-01-18 16:03:38 UTC (rev 1799)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/rdocexport/RDocUtility.java 2007-01-18 16:05:57 UTC (rev 1800)
@@ -16,7 +16,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingMessages;
+import org.rubypeople.rdt.internal.launching.LaunchingMessages;
import org.rubypeople.rdt.internal.ui.RubyPlugin;
import org.rubypeople.rdt.internal.ui.RubyUIMessages;
import org.rubypeople.rdt.internal.ui.dialogs.StatusInfo;
@@ -87,7 +87,7 @@
IVMInstall interpreter = RubyRuntime.getDefault().getSelectedInterpreter();
if (interpreter == null) {
- MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelectedTitle, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected);
+ MessageDialog.openInformation(RubyPlugin.getActiveWorkbenchShell(), LaunchingMessages.RdtLaunchingPlugin_noInterpreterSelectedTitle, LaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected);
return ;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 16:03:46
|
Revision: 1799
http://svn.sourceforge.net/rubyeclipse/?rev=1799&view=rev
Author: cawilliams
Date: 2007-01-18 08:03:38 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
Strip off Rdt prefix on our plugin name (makes it easier when we're dealing with modifying JDT code, and Rdt is sort of redundant)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java
trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
trunk/org.rubypeople.rdt.launching/plugin.xml
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.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchConfigurationAttribute.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstallChangedListener.java
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java
Added Paths:
-----------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
Removed Paths:
-------------
trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_ClassicDebuggerCommunicationTest.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -7,7 +7,7 @@
import org.rubypeople.rdt.internal.debug.core.model.RubyVariable;
import org.rubypeople.rdt.internal.debug.core.model.ThreadInfo;
import org.rubypeople.rdt.internal.debug.core.parsing.LoadResultReader;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
public class FTC_ClassicDebuggerCommunicationTest extends
FTC_AbstractDebuggerCommunicationTest {
@@ -82,9 +82,9 @@
private String createIncludeDir() {
String includeDir;
- if (RdtLaunchingPlugin.getDefault() != null) {
+ if (LaunchingPlugin.getDefault() != null) {
// being run as JUnit Plug-in Test, Eclipse is running
- includeDir = RubyCore.getOSDirectory(RdtLaunchingPlugin.getDefault()) + "ruby" ;
+ includeDir = RubyCore.getOSDirectory(LaunchingPlugin.getDefault()) + "ruby" ;
}
else {
// being run as "pure" JUnit Test without Eclipse running
Modified: trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.debug.core.tests/src/org/rubypeople/rdt/debug/core/tests/FTC_RubyDebugCommunicationTest.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -3,7 +3,7 @@
import org.rubypeople.rdt.core.RubyCore;
import org.rubypeople.rdt.internal.debug.core.SuspensionPoint;
import org.rubypeople.rdt.internal.launching.DebuggerRunner;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
public class FTC_RubyDebugCommunicationTest extends FTC_ClassicDebuggerCommunicationTest {
@@ -86,7 +86,7 @@
if (RubyCore.getPlugin() != null) {
result = DebuggerRunner.getDirectoryOfRubyDebuggerFile();
} else {
- result = RdtLaunchingPlugin.class.getResource(".").getPath() + "/../../../../../../ruby";
+ result = LaunchingPlugin.class.getResource(".").getPath() + "/../../../../../../ruby";
}
return result;
}
Modified: trunk/org.rubypeople.rdt.launching/plugin.xml
===================================================================
--- trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/plugin.xml 2007-01-18 16:03:38 UTC (rev 1799)
@@ -5,7 +5,7 @@
name="%Plugin.name"
version="0.0.0"
provider-name="RubyPeople, Inc."
- class="org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin">
+ class="org.rubypeople.rdt.internal.launching.LaunchingPlugin">
<runtime>
<library name="launching.jar">
Modified: 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-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/DebuggerRunner.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -34,11 +34,11 @@
proxy.start();
launch.addDebugTarget(debugTarget);
} catch (Exception e) {
- RdtLaunchingPlugin.log(new Status(IStatus.ERROR, RdtLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
+ LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
debugTarget.terminate();
}
} else {
- RdtLaunchingPlugin.log(new Status(IStatus.ERROR, RdtLaunchingPlugin.PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
+ LaunchingPlugin.log(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_processTerminatedBecauseNoDebuggerConnection, null));
debugTarget.terminate();
}
return process;
@@ -68,20 +68,20 @@
commandLine.add("-reclipseDebug");
}
commandLine.add("-I");
- commandLine.add(RdtLaunchingPlugin.osDependentPath(DebuggerRunner.getDirectoryOfRubyDebuggerFile().replace('/', File.separatorChar)));
+ commandLine.add(LaunchingPlugin.osDependentPath(DebuggerRunner.getDirectoryOfRubyDebuggerFile().replace('/', File.separatorChar)));
}
}
public static String getDirectoryOfRubyDebuggerFile() {
- return RubyCore.getOSDirectory(RdtLaunchingPlugin.getDefault()) + "ruby";
+ return RubyCore.getOSDirectory(LaunchingPlugin.getDefault()) + "ruby";
}
public boolean isUseRubyDebug() {
- return RdtLaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.USE_RUBY_DEBUG);
+ return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.USE_RUBY_DEBUG);
}
public boolean isDebuggerVerbose() {
- return RdtLaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.VERBOSE_DEBUGGER);
+ return LaunchingPlugin.getDefault().getPluginPreferences().getBoolean(PreferenceConstants.VERBOSE_DEBUGGER);
}
protected IVMInstall convertInterpreter(IVMInstall rubyInterpreter) {
Modified: 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-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunner.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -25,7 +25,7 @@
Map defaultAttributes = new HashMap();
defaultAttributes.put(IProcess.ATTR_PROCESS_TYPE, "ruby");
IProcess process = DebugPlugin.newProcess(launch, nativeRubyProcess, renderLabel(configuration), defaultAttributes);
- process.setAttribute(RdtLaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine.toString());
+ process.setAttribute(LaunchingPlugin.PLUGIN_ID + ".launcher.cmdline", commandLine.toString());
return process ;
}
@@ -56,7 +56,7 @@
commandLine.addAll(configuration.renderLoadPath());
commandLine.addAll(ArgumentSplitter.split(configuration.getInterpreterArguments()));
commandLine.add(RubyInterpreter.END_OF_OPTIONS_DELIMITER);
- commandLine.add(RdtLaunchingPlugin.osDependentPath(configuration.getAbsoluteFileName()));
+ commandLine.add(LaunchingPlugin.osDependentPath(configuration.getAbsoluteFileName()));
commandLine.addAll(ArgumentSplitter.split(configuration.getProgramArguments()));
return commandLine;
Modified: 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-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/InterpreterRunnerConfiguration.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -53,12 +53,12 @@
try {
projectName = configuration.getAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, "");
} catch(CoreException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
RubyProject rubyProject = new RubyProject();
if (projectName.length() > 0 ) {
- IProject project = RdtLaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
+ IProject project = LaunchingPlugin.getWorkspace().getRoot().getProject(projectName);
rubyProject.setProject(project);
}
@@ -70,7 +70,7 @@
try {
file = configuration.getAttribute(RubyLaunchConfigurationAttribute.WORKING_DIRECTORY, "");
} catch(CoreException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
// it is valid not to specify a working directroy by returning null
// whereas new File("") would specify an invalid directory
@@ -111,7 +111,7 @@
private void addToLoadPath(List<String> loadPath, String pathDirectory) {
loadPath.add("-I");
- loadPath.add(RdtLaunchingPlugin.osDependentPath(pathDirectory));
+ loadPath.add(LaunchingPlugin.osDependentPath(pathDirectory));
}
protected List<String> renderLoadPath() {
Added: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java (rev 0)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -0,0 +1,149 @@
+package org.rubypeople.rdt.internal.launching;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.osgi.framework.BundleContext;
+import org.rubypeople.rdt.core.RubyCore;
+import org.w3c.dom.Document;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class LaunchingPlugin extends Plugin {
+ public static final String PLUGIN_ID = "org.rubypeople.rdt.launching"; //$NON-NLS-1$
+ public static String osDependentPath(String aPath) {
+ if (Platform.getOS().equals(Platform.OS_WIN32)) {
+ if (aPath.startsWith(File.separator)) {
+ aPath = aPath.substring(1) ;
+ }
+ }
+
+ return aPath;
+ }
+ protected static LaunchingPlugin plugin;
+ private static DocumentBuilder fgXMLParser;
+
+ public LaunchingPlugin() {
+ super();
+ plugin = this;
+ }
+
+ public static Plugin getDefault() {
+ return plugin;
+ }
+
+ public static IWorkspace getWorkspace() {
+ return RubyCore.getWorkspace();
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ public static void log(Throwable e) {
+ log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_internalErrorOccurred, e));
+ }
+
+ public static void debug(String message) {
+ if (getDefault().isDebugging()) {
+ System.out.println(message);
+ }
+ }
+ @Override
+ public void stop(BundleContext arg0) throws Exception {
+ super.stop(arg0);
+ savePluginPreferences() ;
+ }
+
+ public static String getUniqueIdentifier() {
+ return PLUGIN_ID;
+ }
+
+ /**
+ * Returns a Document that can be used to build a DOM tree
+ * @return the Document
+ * @throws ParserConfigurationException if an exception occurs creating the document builder
+ */
+ public static Document getDocument() throws ParserConfigurationException {
+ DocumentBuilderFactory dfactory= DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder= dfactory.newDocumentBuilder();
+ Document doc= docBuilder.newDocument();
+ return doc;
+ }
+
+ /**
+ * Serializes a XML document into a string - encoded in UTF8 format,
+ * with platform line separators.
+ *
+ * @param doc document to serialize
+ * @return the document as a string
+ */
+ public static String serializeDocument(Document doc) throws IOException, TransformerException {
+ ByteArrayOutputStream s= new ByteArrayOutputStream();
+
+ TransformerFactory factory= TransformerFactory.newInstance();
+ Transformer transformer= factory.newTransformer();
+ transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
+ transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
+
+ DOMSource source= new DOMSource(doc);
+ StreamResult outputTarget= new StreamResult(s);
+ transformer.transform(source, outputTarget);
+
+ return s.toString("UTF8"); //$NON-NLS-1$
+ }
+
+ public static void log(String message) {
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
+ }
+
+ /**
+ * Returns a shared XML parser.
+ *
+ * @return an XML parser
+ * @throws CoreException if unable to create a parser
+ * @since 3.0
+ */
+ public static DocumentBuilder getParser() throws CoreException {
+ if (fgXMLParser == null) {
+ try {
+ fgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ fgXMLParser.setErrorHandler(new DefaultHandler());
+ } catch (ParserConfigurationException e) {
+ abort(RdtLaunchingMessages.LaunchingPlugin_33, e);
+ } catch (FactoryConfigurationError e) {
+ abort(RdtLaunchingMessages.LaunchingPlugin_34, e);
+ }
+ }
+ return fgXMLParser;
+ }
+
+ /**
+ * Throws an exception with the given message and underlying exception.
+ *
+ * @param message error message
+ * @param exception underlying exception or <code>null</code> if none
+ * @throws CoreException
+ */
+ protected static void abort(String message, Throwable exception) throws CoreException {
+ IStatus status = new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), 0, message, exception);
+ throw new CoreException(status);
+ }
+}
Property changes on: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/LaunchingPlugin.java
___________________________________________________________________
Name: svn:eol-style
+ native
Deleted: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RdtLaunchingPlugin.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -1,149 +0,0 @@
-package org.rubypeople.rdt.internal.launching;
-
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.transform.OutputKeys;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.dom.DOMSource;
-import javax.xml.transform.stream.StreamResult;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.core.runtime.Status;
-import org.osgi.framework.BundleContext;
-import org.rubypeople.rdt.core.RubyCore;
-import org.w3c.dom.Document;
-import org.xml.sax.helpers.DefaultHandler;
-
-public class RdtLaunchingPlugin extends Plugin {
- public static final String PLUGIN_ID = "org.rubypeople.rdt.launching"; //$NON-NLS-1$
- public static String osDependentPath(String aPath) {
- if (Platform.getOS().equals(Platform.OS_WIN32)) {
- if (aPath.startsWith(File.separator)) {
- aPath = aPath.substring(1) ;
- }
- }
-
- return aPath;
- }
- protected static RdtLaunchingPlugin plugin;
- private static DocumentBuilder fgXMLParser;
-
- public RdtLaunchingPlugin() {
- super();
- plugin = this;
- }
-
- public static Plugin getDefault() {
- return plugin;
- }
-
- public static IWorkspace getWorkspace() {
- return RubyCore.getWorkspace();
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public static void log(Throwable e) {
- log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.ERROR, RdtLaunchingMessages.RdtLaunchingPlugin_internalErrorOccurred, e));
- }
-
- public static void debug(String message) {
- if (getDefault().isDebugging()) {
- System.out.println(message);
- }
- }
- @Override
- public void stop(BundleContext arg0) throws Exception {
- super.stop(arg0);
- savePluginPreferences() ;
- }
-
- public static String getUniqueIdentifier() {
- return PLUGIN_ID;
- }
-
- /**
- * Returns a Document that can be used to build a DOM tree
- * @return the Document
- * @throws ParserConfigurationException if an exception occurs creating the document builder
- */
- public static Document getDocument() throws ParserConfigurationException {
- DocumentBuilderFactory dfactory= DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder= dfactory.newDocumentBuilder();
- Document doc= docBuilder.newDocument();
- return doc;
- }
-
- /**
- * Serializes a XML document into a string - encoded in UTF8 format,
- * with platform line separators.
- *
- * @param doc document to serialize
- * @return the document as a string
- */
- public static String serializeDocument(Document doc) throws IOException, TransformerException {
- ByteArrayOutputStream s= new ByteArrayOutputStream();
-
- TransformerFactory factory= TransformerFactory.newInstance();
- Transformer transformer= factory.newTransformer();
- transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
- transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
-
- DOMSource source= new DOMSource(doc);
- StreamResult outputTarget= new StreamResult(s);
- transformer.transform(source, outputTarget);
-
- return s.toString("UTF8"); //$NON-NLS-1$
- }
-
- public static void log(String message) {
- log(new Status(IStatus.ERROR, getUniqueIdentifier(), IStatus.ERROR, message, null));
- }
-
- /**
- * Returns a shared XML parser.
- *
- * @return an XML parser
- * @throws CoreException if unable to create a parser
- * @since 3.0
- */
- public static DocumentBuilder getParser() throws CoreException {
- if (fgXMLParser == null) {
- try {
- fgXMLParser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- fgXMLParser.setErrorHandler(new DefaultHandler());
- } catch (ParserConfigurationException e) {
- abort(RdtLaunchingMessages.LaunchingPlugin_33, e);
- } catch (FactoryConfigurationError e) {
- abort(RdtLaunchingMessages.LaunchingPlugin_34, e);
- }
- }
- return fgXMLParser;
- }
-
- /**
- * Throws an exception with the given message and underlying exception.
- *
- * @param message error message
- * @param exception underlying exception or <code>null</code> if none
- * @throws CoreException
- */
- protected static void abort(String message, Throwable exception) throws CoreException {
- IStatus status = new Status(IStatus.ERROR, RdtLaunchingPlugin.getUniqueIdentifier(), 0, message, exception);
- throw new CoreException(status);
- }
-}
Modified: 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-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyApplicationLaunchConfigurationDelegate.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -22,7 +22,7 @@
*/
public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
if (RubyRuntime.getDefault().getSelectedInterpreter() == null) {
- throw new CoreException(new Status(IStatus.ERROR, RdtLaunchingPlugin.PLUGIN_ID, IStatus.OK, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
+ throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, RdtLaunchingMessages.RdtLaunchingPlugin_noInterpreterSelected, null));
}
if (mode.equals("debug")) {
Modified: 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-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyInterpreter.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -63,19 +63,19 @@
public Process exec(List args, File workingDirectory) throws CoreException {
try {
- RdtLaunchingPlugin.debug("Launching: " + args) ;
- RdtLaunchingPlugin.debug("Working Dir: " + workingDirectory) ;
+ 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, RdtLaunchingPlugin.PLUGIN_ID, IStatus.OK,
+ 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, RdtLaunchingPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
+ IStatus errorStatus = new Status(IStatus.ERROR, LaunchingPlugin.PLUGIN_ID, IStatus.OK, e.getMessage(), e);
throw new CoreException(errorStatus) ;
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchConfigurationAttribute.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchConfigurationAttribute.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/RubyLaunchConfigurationAttribute.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -5,14 +5,14 @@
public interface RubyLaunchConfigurationAttribute {
static final String RUBY_LAUNCH_CONFIGURATION_TYPE = "org.rubypeople.rdt.launching.LaunchConfigurationTypeRubyApplication";
- static final String CUSTOM_LOAD_PATH = RdtLaunchingPlugin.PLUGIN_ID + ".CUSTOM_LOAD_PATH";
- static final String FILE_NAME = RdtLaunchingPlugin.PLUGIN_ID + ".FILE_NAME";
- static final String INTERPRETER_ARGUMENTS = RdtLaunchingPlugin.PLUGIN_ID + ".INTERPRETER_ARGUMENTS";
- static final String MODULE_NAME = RdtLaunchingPlugin.PLUGIN_ID + ".MODULE_NAME";
- static final String PROGRAM_ARGUMENTS = RdtLaunchingPlugin.PLUGIN_ID + ".PROGRAM_ARGUMENTS";
- static final String PROJECT_NAME = RdtLaunchingPlugin.PLUGIN_ID + ".PROJECT_NAME";
- static final String SELECTED_INTERPRETER = RdtLaunchingPlugin.PLUGIN_ID + ".SELECTED_INTERPRETER";
- static final String WORKING_DIRECTORY = RdtLaunchingPlugin.PLUGIN_ID + ".WORKING_DIRECTORY";
- static final String USE_DEFAULT_LOAD_PATH = RdtLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_LOAD_PATH";
- static final String USE_DEFAULT_WORKING_DIRECTORY = RdtLaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_WORKING_DIRECTORY";
+ static final String CUSTOM_LOAD_PATH = LaunchingPlugin.PLUGIN_ID + ".CUSTOM_LOAD_PATH";
+ static final String FILE_NAME = LaunchingPlugin.PLUGIN_ID + ".FILE_NAME";
+ static final String INTERPRETER_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".INTERPRETER_ARGUMENTS";
+ static final String MODULE_NAME = LaunchingPlugin.PLUGIN_ID + ".MODULE_NAME";
+ static final String PROGRAM_ARGUMENTS = LaunchingPlugin.PLUGIN_ID + ".PROGRAM_ARGUMENTS";
+ static final String PROJECT_NAME = LaunchingPlugin.PLUGIN_ID + ".PROJECT_NAME";
+ static final String SELECTED_INTERPRETER = LaunchingPlugin.PLUGIN_ID + ".SELECTED_INTERPRETER";
+ static final String WORKING_DIRECTORY = LaunchingPlugin.PLUGIN_ID + ".WORKING_DIRECTORY";
+ static final String USE_DEFAULT_LOAD_PATH = LaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_LOAD_PATH";
+ static final String USE_DEFAULT_WORKING_DIRECTORY = LaunchingPlugin.PLUGIN_ID + ".USE_DEFAULT_WORKING_DIRECTORY";
}
\ No newline at end of file
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/internal/launching/VMDefinitionsContainer.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -234,7 +234,7 @@
public String getAsXML() throws ParserConfigurationException, IOException, TransformerException {
// Create the Document and the top-level node
- Document doc = RdtLaunchingPlugin.getDocument();
+ Document doc = LaunchingPlugin.getDocument();
Element config = doc.createElement("vmSettings"); //$NON-NLS-1$
doc.appendChild(config);
@@ -258,7 +258,7 @@
}
// Serialize the Document and return the resulting String
- return RdtLaunchingPlugin.serializeDocument(doc);
+ return LaunchingPlugin.serializeDocument(doc);
}
/**
@@ -438,7 +438,7 @@
}
}
} else {
- RdtLaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
+ LaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_type_element_with_unknown_id_1);
}
}
@@ -490,7 +490,7 @@
vmStandin.setVMArgs(vmArgs);
}
} else {
- RdtLaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2);
+ LaunchingPlugin.log(RdtLaunchingMessages.RubyRuntime_VM_element_specified_with_no_id_attribute_2);
}
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/AbstractInterpreter.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -18,7 +18,7 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.rubypeople.rdt.internal.launching.RdtLaunchingMessages;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
/**
* Abstract implementation of a Interpreter install.
* <p>
@@ -277,7 +277,7 @@
* @since 3.2
*/
protected void abort(String message, Throwable exception, int code) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, RdtLaunchingPlugin
+ throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin
.getUniqueIdentifier(), code, message, exception));
}
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstallChangedListener.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstallChangedListener.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/IVMInstallChangedListener.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -1,6 +1,6 @@
package org.rubypeople.rdt.launching;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
public interface IVMInstallChangedListener {
@@ -9,19 +9,19 @@
* Property constant indicating the name associated
* with a VM install has changed.
*/
- public static final String PROPERTY_NAME = RdtLaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_NAME"; //$NON-NLS-1$
+ public static final String PROPERTY_NAME = LaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_NAME"; //$NON-NLS-1$
/**
* Property constant indicating the install location of
* a VM install has changed.
*/
- public static final String PROPERTY_INSTALL_LOCATION = RdtLaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_INSTALL_LOCATION"; //$NON-NLS-1$
+ public static final String PROPERTY_INSTALL_LOCATION = LaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_INSTALL_LOCATION"; //$NON-NLS-1$
/**
* Property constant indicating the library locations associated
* with a VM install have changed.
*/
- public static final String PROPERTY_LIBRARY_LOCATIONS = RdtLaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_LIBRARY_LOCATIONS"; //$NON-NLS-1$
+ public static final String PROPERTY_LIBRARY_LOCATIONS = LaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_LIBRARY_LOCATIONS"; //$NON-NLS-1$
/**
* Property constant indicating the VM arguments associated
@@ -29,7 +29,7 @@
*
* @since 0.9.0
*/
- public static final String PROPERTY_VM_ARGUMENTS = RdtLaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_VM_ARGUMENTS"; //$NON-NLS-1$
+ public static final String PROPERTY_VM_ARGUMENTS = LaunchingPlugin.getUniqueIdentifier() + ".PROPERTY_VM_ARGUMENTS"; //$NON-NLS-1$
public void defaultVMInstallChanged(IVMInstall previous, IVMInstall current);
Modified: trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java
===================================================================
--- trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.launching/src/org/rubypeople/rdt/launching/RubyRuntime.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -37,7 +37,7 @@
import org.rubypeople.rdt.internal.launching.CompositeId;
import org.rubypeople.rdt.internal.launching.ListenerList;
import org.rubypeople.rdt.internal.launching.RdtLaunchingMessages;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.launching.RubyInterpreter;
import org.rubypeople.rdt.internal.launching.VMDefinitionsContainer;
import org.rubypeople.rdt.internal.launching.VMStandin;
@@ -73,14 +73,14 @@
* </ol>
* @since 0.9.0
*/
- public static final String RUBY_CONTAINER = RdtLaunchingPlugin.getUniqueIdentifier() + "RUBY_CONTAINER"; //$NON-NLS-1$
+ public static final String RUBY_CONTAINER = LaunchingPlugin.getUniqueIdentifier() + "RUBY_CONTAINER"; //$NON-NLS-1$
/**
* Preference key for the String of XML that defines all installed VMs.
*
* @since 0.9.0
*/
- public static final String PREF_VM_XML = RdtLaunchingPlugin.getUniqueIdentifier() + ".PREF_VM_XML"; //$NON-NLS-1$
+ public static final String PREF_VM_XML = LaunchingPlugin.getUniqueIdentifier() + ".PREF_VM_XML"; //$NON-NLS-1$
/**
* Simple identifier constant (value <code>"vmInstalls"</code>) for the
@@ -198,7 +198,7 @@
}
reader.parse(new InputSource(fileReader));
} catch(Exception e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
}
@@ -239,7 +239,7 @@
writer.write("</runtimeconfig>");
writer.flush();
} catch(IOException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
}
@@ -269,7 +269,7 @@
}
protected File getRuntimeConfigurationFile() {
- IPath stateLocation = RdtLaunchingPlugin.getDefault().getStateLocation();
+ IPath stateLocation = LaunchingPlugin.getDefault().getStateLocation();
IPath fileLocation = stateLocation.append("runtimeConfiguration.xml");
return new File(fileLocation.toOSString());
}
@@ -368,7 +368,7 @@
} catch (IOException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
} finally {
fgInitializingVMs = false;
@@ -390,13 +390,13 @@
if (setPref) {
try {
String xml = vmDefs.getAsXML();
- RdtLaunchingPlugin.getDefault().getPluginPreferences().setValue(PREF_VM_XML, xml);
+ LaunchingPlugin.getDefault().getPluginPreferences().setValue(PREF_VM_XML, xml);
} catch (ParserConfigurationException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
} catch (IOException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
} catch (TransformerException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
}
@@ -407,9 +407,9 @@
* Initializes vm type extensions.
*/
private static void initializeVMTypeExtensions() {
- IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(RdtLaunchingPlugin.PLUGIN_ID, "vmInstallTypes"); //$NON-NLS-1$
+ IExtensionPoint extensionPoint= Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, "vmInstallTypes"); //$NON-NLS-1$
IConfigurationElement[] configs= extensionPoint.getConfigurationElements();
- MultiStatus status= new MultiStatus(RdtLaunchingPlugin.getUniqueIdentifier(), IStatus.OK, RdtLaunchingMessages.RubyRuntime_exceptionOccurred, null);
+ MultiStatus status= new MultiStatus(LaunchingPlugin.getUniqueIdentifier(), IStatus.OK, RdtLaunchingMessages.RubyRuntime_exceptionOccurred, null);
fgInterpreterTypes= new IVMInstallType[configs.length];
for (int i= 0; i < configs.length; i++) {
@@ -422,7 +422,7 @@
}
if (!status.isOK()) {
//only happens on a CoreException
- RdtLaunchingPlugin.log(status);
+ LaunchingPlugin.log(status);
//cleanup null entries in fgVMTypes
List<IVMInstallType> temp= new ArrayList<IVMInstallType>(fgInterpreterTypes.length);
for (int i = 0; i < fgInterpreterTypes.length; i++) {
@@ -454,11 +454,11 @@
VMDefinitionsContainer.parseXMLIntoContainer(inputStream, vmDefs);
return false;
} catch (IOException ioe) {
- RdtLaunchingPlugin.log(ioe);
+ LaunchingPlugin.log(ioe);
}
} else {
// Otherwise, look for the old file that previously held the VM definitions
- IPath stateLocation= RdtLaunchingPlugin.getDefault().getStateLocation();
+ IPath stateLocation= LaunchingPlugin.getDefault().getStateLocation();
IPath stateFile= stateLocation.append("vmConfiguration.xml"); //$NON-NLS-1$
File file = new File(stateFile.toOSString());
@@ -479,7 +479,7 @@
* @since 0.9.0
*/
public static Preferences getPreferences() {
- return RdtLaunchingPlugin.getDefault().getPluginPreferences();
+ return LaunchingPlugin.getDefault().getPluginPreferences();
}
/**
@@ -504,7 +504,7 @@
* @since 3.2
*/
private static void addVMExtensions(VMDefinitionsContainer vmDefs) {
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(RdtLaunchingPlugin.PLUGIN_ID, RubyRuntime.EXTENSION_POINT_VM_INSTALLS);
+ IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(LaunchingPlugin.PLUGIN_ID, RubyRuntime.EXTENSION_POINT_VM_INSTALLS);
IConfigurationElement[] configs= extensionPoint.getConfigurationElements();
for (int i = 0; i < configs.length; i++) {
IConfigurationElement element = configs[i];
@@ -586,7 +586,7 @@
(Object[]) new String[]{element.getName(), element.getContributor().getName()}), null);
}
} catch (CoreException e) {
- RdtLaunchingPlugin.log(e);
+ LaunchingPlugin.log(e);
}
}
}
@@ -624,7 +624,7 @@
* error, or <code>null</code> if none
*/
private static void abort(String message, int code, Throwable exception) throws CoreException {
- throw new CoreException(new Status(IStatus.ERROR, RdtLaunchingPlugin.getUniqueIdentifier(), code, message, exception));
+ throw new CoreException(new Status(IStatus.ERROR, LaunchingPlugin.getUniqueIdentifier(), code, message, exception));
}
private static void fireInterpreterAdded(IVMInstall interpreter) {
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java 2007-01-18 15:56:16 UTC (rev 1798)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/preferences/DebuggerPreferencePage.java 2007-01-18 16:03:38 UTC (rev 1799)
@@ -16,14 +16,14 @@
import org.eclipse.swt.widgets.Label;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.rubypeople.rdt.internal.launching.RdtLaunchingPlugin;
+import org.rubypeople.rdt.internal.launching.LaunchingPlugin;
import org.rubypeople.rdt.internal.ui.text.PreferencesAdapter;
public class DebuggerPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
public DebuggerPreferencePage() {
super(GRID);
- Preferences launchingPreferences = RdtLaunchingPlugin.getDefault().getPluginPreferences();
+ Preferences launchingPreferences = LaunchingPlugin.getDefault().getPluginPreferences();
setPreferenceStore(new PreferencesAdapter(launchingPreferences));
setDescription(PreferencesMessages.DebuggerPreferencePage_description_label);
}
@@ -36,7 +36,7 @@
protected Control createContents(Composite parent) {
Control result = super.createContents(parent);
Label label = new Label(parent, SWT.WRAP);
- URL entry = RdtLaunchingPlugin.getDefault().getBundle().getEntry("/");
+ URL entry = LaunchingPlugin.getDefault().getBundle().getEntry("/");
String installLocation;
try {
installLocation = FileLocator.resolve(entry).toString();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <caw...@us...> - 2007-01-18 15:56:19
|
Revision: 1798
http://svn.sourceforge.net/rubyeclipse/?rev=1798&view=rev
Author: cawilliams
Date: 2007-01-18 07:56:16 -0800 (Thu, 18 Jan 2007)
Log Message:
-----------
doing some renaming back to what JDT uses - it's easier
Modified Paths:
--------------
trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
Modified: trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java
===================================================================
--- trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-01-18 15:56:04 UTC (rev 1797)
+++ trunk/org.rubypeople.rdt.ui/src/org/rubypeople/rdt/internal/ui/infoviews/RIView.java 2007-01-18 15:56:16 UTC (rev 1798)
@@ -45,7 +45,7 @@
import org.rubypeople.rdt.internal.ui.rdocexport.RDocUtility;
import org.rubypeople.rdt.internal.ui.rdocexport.RdocListener;
import org.rubypeople.rdt.launching.IVMInstall;
-import org.rubypeople.rdt.launching.IInterpreterInstallChangedListener;
+import org.rubypeople.rdt.launching.IVMInstallChangedListener;
import org.rubypeople.rdt.launching.PropertyChangeEvent;
import org.rubypeople.rdt.launching.RubyRuntime;
import org.rubypeople.rdt.ui.PreferenceConstants;
@@ -62,7 +62,7 @@
private List possibleMatches = new ArrayList();
private SearchValue itemToSearch = new SearchValue();
private DescriptionUpdater descriptionUpdater = new DescriptionUpdater();
- private IInterpreterInstallChangedListener runtimeListener;
+ private IVMInstallChangedListener runtimeListener;
private ListContentProvider contentProvider = new ListContentProvider();
/**
@@ -137,19 +137,19 @@
form.setWeights(new int[]{1, 3});
- runtimeListener = new IInterpreterInstallChangedListener() {
- public void defaultInterpreterInstallChanged(IVMInstall previous,
+ runtimeListener = new IVMInstallChangedListener() {
+ public void defaultVMInstallChanged(IVMInstall previous,
IVMInstall current) {
updatePage();
}
- public void interpreterAdded(IVMInstall newVm) {
+ public void vmAdded(IVMInstall newVm) {
}
- public void interpreterChanged(PropertyChangeEvent event) {
+ public void vmChanged(PropertyChangeEvent event) {
}
- public void interpreterRemoved(IVMInstall removedVm) {
+ public void vmRemoved(IVMInstall removedVm) {
}
};
RubyRuntime.addInterpreterInstallChangedListener(runtimeListener);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|