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:
parent
2c9a404d44
commit
f03ce33b71
1 changed files with 11 additions and 0 deletions
|
@ -23,6 +23,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IProgressMonitor;
|
import org.eclipse.core.runtime.IProgressMonitor;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.MultiStatus;
|
import org.eclipse.core.runtime.MultiStatus;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||||
|
@ -122,6 +123,16 @@ class ProjectRenameChange extends AbstractLaunchConfigChange {
|
||||||
copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
|
copy.setAttribute(ICDTLaunchConfigurationConstants.ATTR_PROJECT_NAME,
|
||||||
newName);
|
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 {
|
try {
|
||||||
// Note: for non-local LCs, this will end up updating the .launch
|
// Note: for non-local LCs, this will end up updating the .launch
|
||||||
// file on disk but Eclipse's in memory representation will not
|
// file on disk but Eclipse's in memory representation will not
|
||||||
|
|
Loading…
Add table
Reference in a new issue