1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

[457699]. Update C/C++ Application path at project rename

Change-Id: Ia9a2cd7c57a12bb74346915f22b6617fbb42a309
Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=457699
Signed-off-by: Dan Ungureanu <dan.ungureanu@freescale.com>
This commit is contained in:
Ungureanu Dan-B07892 2015-01-16 16:54:30 +02:00 committed by Gerrit Code Review @ Eclipse.org
parent 2c9a404d44
commit f03ce33b71

View file

@ -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