|
From: <caw...@us...> - 2007-09-17 13:52:11
|
Revision: 3192
http://rubyeclipse.svn.sourceforge.net/rubyeclipse/?rev=3192&view=rev
Author: cawilliams
Date: 2007-09-17 06:52:09 -0700 (Mon, 17 Sep 2007)
Log Message:
-----------
fix filename handling (before it would add the eclipse directory prefix to relative names which messed everything up!)
Modified Paths:
--------------
trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
Modified: trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java
===================================================================
--- trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-09-14 21:44:59 UTC (rev 3191)
+++ trunk/org.rubypeople.rdt.debug.ui/src/org/rubypeople/rdt/internal/debug/ui/launcher/RubyEntryPointTab.java 2007-09-17 13:52:09 UTC (rev 3192)
@@ -4,6 +4,7 @@
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.Path;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -62,7 +63,7 @@
public void setDefaults(ILaunchConfigurationWorkingCopy configuration) {
- IResource selectedResource = RubyPlugin.getDefault().getSelectedResource() ;
+ IResource selectedResource = RubyPlugin.getDefault().getSelectedResource();
if (!RubyPlugin.getDefault().isRubyFile(selectedResource)) {
return ;
}
@@ -90,8 +91,30 @@
public void performApply(ILaunchConfigurationWorkingCopy configuration) {
configuration.setAttribute(IRubyLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectSelector.getSelectionText());
- File file = fileSelector.getSelection();
- configuration.setAttribute(IRubyLaunchConfigurationConstants.ATTR_FILE_NAME, file == null ? "" : file.getAbsolutePath());
+ String text = fileSelector.getSelectionText();
+ File test = new File(text);
+ if (!test.exists()) {
+ try {
+ String workingDirectory = configuration.getAttribute(IRubyLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
+ if (workingDirectory != null && !workingDirectory.trim().equals("")) {
+ String blah = workingDirectory + text;
+ test = new File(blah);
+ }
+ } catch (CoreException e) {
+ RdtDebugUiPlugin.log(e);
+ }
+ if (!test.exists()) {
+ String projectName = projectSelector.getSelectionText();
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null) {
+ test = project.getLocation().append(text).toFile();
+ }
+ }
+ if (!test.exists()) {
+ text = "";
+ }
+ }
+ configuration.setAttribute(IRubyLaunchConfigurationConstants.ATTR_FILE_NAME, text);
}
protected Composite createPageRoot(Composite parent) {
@@ -120,6 +143,27 @@
setErrorMessage(RdtDebugUiMessages.LaunchConfigurationTab_RubyEntryPoint_invalidFileSelectionMessage);
return false;
}
+ File test = new File(fileName);
+ if (!test.exists()) {
+ try {
+ String workingDirectory = launchConfig.getAttribute(IRubyLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, (String)null);
+ if (workingDirectory != null && !workingDirectory.trim().equals("")) {
+ String blah = workingDirectory + fileName;
+ test = new File(blah);
+ }
+ } catch (CoreException e) {
+ RdtDebugUiPlugin.log(e);
+ }
+ if (!test.exists()) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ if (project != null) {
+ test = project.getLocation().append(fileName).toFile();
+ }
+ }
+ if (!test.exists()) {
+ return false;
+ }
+ }
setErrorMessage(null);
return true;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|