mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-06 09:16:02 +02:00
This commit is contained in:
parent
13b7aeb128
commit
14df45f11f
2 changed files with 9 additions and 8 deletions
|
@ -5,6 +5,7 @@
|
||||||
package org.eclipse.cdt.launch;
|
package org.eclipse.cdt.launch;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.text.MessageFormat;
|
import java.text.MessageFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -246,7 +247,7 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
|
||||||
*/
|
*/
|
||||||
protected void abort(String message, Throwable exception, int code) throws CoreException {
|
protected void abort(String message, Throwable exception, int code) throws CoreException {
|
||||||
MultiStatus status = new MultiStatus(getPluginID(),code, message,exception);
|
MultiStatus status = new MultiStatus(getPluginID(),code, message,exception);
|
||||||
status.add(new Status(IStatus.ERROR,getPluginID(),code,exception.getLocalizedMessage(),exception));
|
status.add(new Status(IStatus.ERROR,getPluginID(),code, exception == null ? "" : exception.getLocalizedMessage(),exception));
|
||||||
throw new CoreException(status);
|
throw new CoreException(status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,16 +383,16 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
|
||||||
protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
|
protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException {
|
||||||
String name = getProjectName(config);
|
String name = getProjectName(config);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
abort("C project not specified", null, ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
|
abort("C Project not specified", null, ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROJECT);
|
||||||
}
|
}
|
||||||
ICProject cproject = getCProject(config);
|
ICProject cproject = getCProject(config);
|
||||||
if (cproject == null) {
|
if (cproject == null) {
|
||||||
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
|
IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
|
||||||
if (!project.exists()) {
|
if (!project.exists()) {
|
||||||
abort("Project does not exist", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
abort("Project '"+ name + "' does not exist", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||||
}
|
}
|
||||||
else if (!project.isOpen()) {
|
else if (!project.isOpen()) {
|
||||||
abort("Project is closed", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
abort("Project '"+ name + "' is closed", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||||
}
|
}
|
||||||
abort("Project is not a C/C++ project", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
abort("Project is not a C/C++ project", null, ICDTLaunchConfigurationConstants.ERR_NOT_A_C_PROJECT);
|
||||||
}
|
}
|
||||||
|
@ -407,7 +408,7 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
|
||||||
|
|
||||||
IFile programPath = ((IProject) cproject.getResource()).getFile(fileName);
|
IFile programPath = ((IProject) cproject.getResource()).getFile(fileName);
|
||||||
if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
|
if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) {
|
||||||
abort("Program file does not exist", null, ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
|
abort("Program file does not exist", new FileNotFoundException(programPath.getLocation() + " not found."), ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST);
|
||||||
}
|
}
|
||||||
return programPath;
|
return programPath;
|
||||||
}
|
}
|
||||||
|
@ -445,7 +446,7 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
|
||||||
else {
|
else {
|
||||||
abort(
|
abort(
|
||||||
"Working directory does not exist",
|
"Working directory does not exist",
|
||||||
null,
|
new FileNotFoundException(path.toOSString() + " not found."),
|
||||||
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
|
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +458,7 @@ abstract public class AbstractCLaunchDelegate implements ILaunchConfigurationDel
|
||||||
else {
|
else {
|
||||||
abort(
|
abort(
|
||||||
"Working directory does not exist",
|
"Working directory does not exist",
|
||||||
null,
|
new FileNotFoundException(path.toOSString() + "Does not exsit."),
|
||||||
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
|
ICDTLaunchConfigurationConstants.ERR_WORKING_DIRECTORY_DOES_NOT_EXIST);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ public class CoreFileLaunchDelegate extends AbstractCLaunchDelegate {
|
||||||
final Shell shell = LaunchUIPlugin.getShell();
|
final Shell shell = LaunchUIPlugin.getShell();
|
||||||
final String res[] = { null };
|
final String res[] = { null };
|
||||||
if (shell == null) {
|
if (shell == null) {
|
||||||
abort("No Shell availible in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
|
abort("No Shell available in Launch", null, ICDTLaunchConfigurationConstants.ERR_INTERNAL_ERROR);
|
||||||
}
|
}
|
||||||
Display display = shell.getDisplay();
|
Display display = shell.getDisplay();
|
||||||
display.syncExec(new Runnable() {
|
display.syncExec(new Runnable() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue