diff options
author | Mikhail Khodjaiants | 2006-03-15 18:44:36 +0000 |
---|---|---|
committer | Mikhail Khodjaiants | 2006-03-15 18:44:36 +0000 |
commit | cb1be70bed9fe870b9937efa13c3a77bdaa74853 (patch) | |
tree | e70e480105ab098e37c610e48a477ea2c8cba7e9 /launch | |
parent | 5f63b203d29a90b5d0391f9f02ef19deb8d3ac7e (diff) | |
download | org.eclipse.cdt-cb1be70bed9fe870b9937efa13c3a77bdaa74853.tar.gz org.eclipse.cdt-cb1be70bed9fe870b9937efa13c3a77bdaa74853.tar.xz org.eclipse.cdt-cb1be70bed9fe870b9937efa13c3a77bdaa74853.zip |
The new "getExecutable" method is added to replace deprecated "getProgramFile".
Diffstat (limited to 'launch')
-rw-r--r-- | launch/org.eclipse.cdt.launch/ChangeLog | 4 | ||||
-rw-r--r-- | launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java | 36 |
2 files changed, 39 insertions, 1 deletions
diff --git a/launch/org.eclipse.cdt.launch/ChangeLog b/launch/org.eclipse.cdt.launch/ChangeLog index 9fa345a17f2..83071a6f8ef 100644 --- a/launch/org.eclipse.cdt.launch/ChangeLog +++ b/launch/org.eclipse.cdt.launch/ChangeLog @@ -1,3 +1,7 @@ +2006-03-15 Mikhail Khodjaiants + The new "getExecutable" method is added to replace deprecated "getProgramFile". + * AbstractCLaunchDelegate.java + 2006-03-06 Mikhail Khodjaiants Fix for Bug 93777: Postmortem and Local launch need a default preference for selected debugger. * CApplicationLaunchShortcut.java diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java index 2704cc662c8..17d644e4fd7 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/AbstractCLaunchDelegate.java @@ -327,7 +327,7 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat * @param config * @return * @throws CoreException - * @deprecated + * @deprecated Use <code>getExecutable</code> instead. */ protected IFile getProgramFile(ILaunchConfiguration config) throws CoreException { ICProject cproject = verifyCProject(config); @@ -349,6 +349,40 @@ abstract public class AbstractCLaunchDelegate extends LaunchConfigurationDelegat return programPath; } + /** + * Returns the file based on the path specified in the Main tab of the launch + * configguration dialog. If the original path is relative, it is assumed to + * be relative to the project location. + * + * @since 3.1 + */ + protected File getExecutable(ILaunchConfiguration config) throws CoreException { + ICProject cproject = verifyCProject(config); + String fileName = getProgramName(config); + if (fileName == null) { + abort(LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_not_specified"), null, //$NON-NLS-1$ + ICDTLaunchConfigurationConstants.ERR_UNSPECIFIED_PROGRAM); + } + IPath path = new Path(fileName); + File result = null; + if (!path.isAbsolute()) { + IFile programPath = ((IProject)cproject.getResource()).getFile(fileName); + if (programPath == null || !programPath.exists() || !programPath.getLocation().toFile().exists()) { + abort( + LaunchMessages.getString("AbstractCLaunchDelegate.Program_file_does_not_exist"), //$NON-NLS-1$ + new FileNotFoundException( + LaunchMessages.getFormattedString( + "AbstractCLaunchDelegate.PROGRAM_PATH_not_found", programPath.getLocation().toOSString())), //$NON-NLS-1$ + ICDTLaunchConfigurationConstants.ERR_PROGRAM_NOT_EXIST); + } + result = programPath.getLocation().toFile(); + } + else { + result = path.toFile(); + } + return result; + } + protected ICProject verifyCProject(ILaunchConfiguration config) throws CoreException { String name = getProjectName(config); if (name == null) { |