mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-02 22:05:44 +02:00
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.
This commit is contained in:
parent
8e64dbaaa5
commit
43c51f933f
1 changed files with 16 additions and 4 deletions
|
@ -14,6 +14,8 @@ package org.eclipse.cdt.launch.ui;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.CCorePlugin;
|
import org.eclipse.cdt.core.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IBinaryParser;
|
import org.eclipse.cdt.core.IBinaryParser;
|
||||||
import org.eclipse.cdt.core.ICDescriptor;
|
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.launch.internal.ui.LaunchUIPlugin;
|
||||||
import org.eclipse.cdt.ui.CElementLabelProvider;
|
import org.eclipse.cdt.ui.CElementLabelProvider;
|
||||||
import org.eclipse.cdt.utils.pty.PTY;
|
import org.eclipse.cdt.utils.pty.PTY;
|
||||||
|
import org.eclipse.core.resources.IFile;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.resources.IResource;
|
import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.ResourcesPlugin;
|
import org.eclipse.core.resources.ResourcesPlugin;
|
||||||
|
@ -475,7 +478,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
*/
|
*/
|
||||||
protected ICProject[] getCProjects() throws CModelException {
|
protected ICProject[] getCProjects() throws CModelException {
|
||||||
ICProject cproject[] = CoreModel.getDefault().getCModel().getCProjects();
|
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++) {
|
for (int i = 0; i < cproject.length; i++) {
|
||||||
ICDescriptor cdesciptor = null;
|
ICDescriptor cdesciptor = null;
|
||||||
|
@ -495,7 +498,7 @@ public class CMainTab extends CLaunchConfigurationTab {
|
||||||
list.add(cproject[i]);
|
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);
|
IPath exePath = new Path(name);
|
||||||
if (!exePath.isAbsolute()) {
|
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$
|
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
exePath = project.getFile(name).getLocation();
|
exePath = projFile.getLocation();
|
||||||
} else {
|
} else {
|
||||||
if (!exePath.toFile().exists()) {
|
if (!exePath.toFile().exists()) {
|
||||||
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
setErrorMessage(LaunchMessages.getString("CMainTab.Program_does_not_exist")); //$NON-NLS-1$
|
||||||
|
|
Loading…
Add table
Reference in a new issue