diff --git a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ProjectRenameChange.java b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ProjectRenameChange.java index 6682fcb03c8..9a97c0f4729 100644 --- a/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ProjectRenameChange.java +++ b/launch/org.eclipse.cdt.launch/src/org/eclipse/cdt/launch/internal/refactoring/ProjectRenameChange.java @@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.MultiStatus; +import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunchConfiguration; import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; @@ -122,6 +123,16 @@ class ProjectRenameChange extends AbstractLaunchConfigChange { copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME, newName); + // Update the program name if it corresponds to the project name + IPath pathProgName = new Path(launchConfig.getAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, "")); //$NON-NLS-1$ + String progExtension = pathProgName.getFileExtension(); + String progName = pathProgName.removeFileExtension().lastSegment(); + if (progName.equals(oldName)) { + pathProgName = pathProgName.removeLastSegments(1).append(newName).addFileExtension(progExtension); + } + copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROGRAM_NAME, + pathProgName.toOSString()); + try { // Note: for non-local LCs, this will end up updating the .launch // file on disk but Eclipse's in memory representation will not