diff options
author | John Cortell | 2008-08-19 19:40:23 +0000 |
---|---|---|
committer | John Cortell | 2008-08-19 19:40:23 +0000 |
commit | 43c51f933f4ee121529a189a9cb21c07b665e860 (patch) | |
tree | 96dfbac25465896e6432f2f84995810db6db9ec1 /launch/org.eclipse.cdt.launch/src | |
parent | 8e64dbaaa53392df30aa7d0f55e51294d8971ea4 (diff) | |
download | org.eclipse.cdt-43c51f933f4ee121529a189a9cb21c07b665e860.tar.gz org.eclipse.cdt-43c51f933f4ee121529a189a9cb21c07b665e860.tar.xz org.eclipse.cdt-43c51f933f4ee121529a189a9cb21c07b665e860.zip |
Fix for 244605. User looses use of LC editor if user stores a progam path in launch configuration that points outside the project directory ("../something", e.g.). Also, fixed Generics warnings.
Diffstat (limited to 'launch/org.eclipse.cdt.launch/src')
-rw-r--r-- | launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java index 4160cfdab93..a9edcf14cf5 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/ui/CMainTab.java @@ -14,6 +14,8 @@ package org.eclipse.cdt.launch.ui; import java.io.IOException; import java.util.ArrayList; +import java.util.List; + import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.IBinaryParser; import org.eclipse.cdt.core.ICDescriptor; @@ -31,6 +33,7 @@ import org.eclipse.cdt.launch.internal.ui.LaunchMessages; import org.eclipse.cdt.launch.internal.ui.LaunchUIPlugin; import org.eclipse.cdt.ui.CElementLabelProvider; import org.eclipse.cdt.utils.pty.PTY; +import org.eclipse.core.resources.IFile; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; @@ -475,7 +478,7 @@ public class CMainTab extends CLaunchConfigurationTab { */ protected ICProject[] getCProjects() throws CModelException { ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects(); - ArrayList list = new ArrayList(cproject.length); + List<ICProject> list = new ArrayList<ICProject>(cproject.length); for (int i = 0; i < cproject.length; i++) { ICDescriptor cdesciptor = null; @@ -495,7 +498,7 @@ public class CMainTab extends CLaunchConfigurationTab { list.add(cproject[i]); } } - return (ICProject[])list.toArray(new ICProject[list.size()]); + return list.toArray(new ICProject[list.size()]); } /** @@ -549,11 +552,20 @@ public class CMainTab extends CLaunchConfigurationTab { } IPath exePath = new Path(name); if (!exePath.isAbsolute()) { - if (!project.getFile(name).exists()) { + IFile projFile = null; + try { + projFile = project.getFile(name); + } + catch (Exception exc) { + // throws an exception if it's a relative path pointing outside project + setErrorMessage(LaunchMessages.getString("CMainTab.Program_invalid_proj_path")); //$NON-NLS-1$ + return false; + } + if (projFile == null || !projFile.exists()) { setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ return false; } - exePath = project.getFile(name).getLocation(); + exePath = projFile.getLocation(); } else { if (!exePath.toFile().exists()) { setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$ |