diff options
author | jszursze | 2002-05-30 22:48:32 +0000 |
---|---|---|
committer | jszursze | 2002-05-30 22:48:32 +0000 |
commit | ca9acdb500315fb21dbed277a4beb67831d2aec6 (patch) | |
tree | d15c898cb9415813f75f56efe7701115fca750e8 /org.eclipse.debug.ui | |
parent | dbe0fd0849f13cb4f4f64fd0f165ece28e46736e (diff) | |
download | eclipse.platform.debug-ca9acdb500315fb21dbed277a4beb67831d2aec6.tar.gz eclipse.platform.debug-ca9acdb500315fb21dbed277a4beb67831d2aec6.tar.xz eclipse.platform.debug-ca9acdb500315fb21dbed277a4beb67831d2aec6.zip |
fix for 18159
Diffstat (limited to 'org.eclipse.debug.ui')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java | 42 |
1 files changed, 5 insertions, 37 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java index d4bcdafd4..ac30384ef 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationDialog.java @@ -680,7 +680,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog protected ILaunchConfiguration createConfigOfType(ILaunchConfigurationType configType) {
ILaunchConfigurationWorkingCopy workingCopy = null;
try {
- workingCopy = configType.newInstance(null, generateUniqueNameFrom(DEFAULT_NEW_CONFIG_NAME));
+ workingCopy = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(DEFAULT_NEW_CONFIG_NAME));
} catch (CoreException ce) {
DebugUIPlugin.log(ce);
return null;
@@ -1954,7 +1954,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog // Duplicate the selected config and select the dupe in the tree
ILaunchConfiguration copyFromConfig = (ILaunchConfiguration) selectedElement;
- String newName = generateUniqueNameFrom(copyFromConfig.getName());
+ String newName = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(copyFromConfig.getName());
try {
ILaunchConfigurationWorkingCopy newWorkingCopy = copyFromConfig.copy(newName);
setLaunchConfiguration(newWorkingCopy, false);
@@ -1977,7 +1977,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog * Make a copy of the specified configuration and select it in the tree.
*/
protected void doHandleCopyConfiguration(ILaunchConfiguration copyFromConfig) {
- String newName = generateUniqueNameFrom(copyFromConfig.getName());
+ String newName = getLaunchManager().generateUniqueLaunchConfigurationNameFrom(copyFromConfig.getName());
try {
ILaunchConfigurationWorkingCopy newWorkingCopy = copyFromConfig.copy(newName);
setLaunchConfiguration(newWorkingCopy, false);
@@ -1996,7 +1996,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog */
protected void constructNewConfig(ILaunchConfigurationType configType) {
try {
- ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, generateUniqueNameFrom(DEFAULT_NEW_CONFIG_NAME));
+ ILaunchConfigurationWorkingCopy wc = configType.newInstance(null, getLaunchManager().generateUniqueLaunchConfigurationNameFrom(DEFAULT_NEW_CONFIG_NAME));
setLastSavedName(null);
setLaunchConfiguration(wc, true);
doSave();
@@ -2082,38 +2082,6 @@ public class LaunchConfigurationDialog extends TitleAreaDialog }
/**
- * Construct a new config name using the name of the given config as a starting point.
- * The new name is guaranteed not to collide with any existing config name.
- */
- protected String generateUniqueNameFrom(String startingName) {
- int index = 1;
- String baseName = startingName;
- int copyIndex = baseName.lastIndexOf(" (");
- if (copyIndex > -1) {
- String trailer = baseName.substring(copyIndex + 1);
- try {
- index = Integer.parseInt(trailer);
- baseName = startingName.substring(0, copyIndex);
- } catch (NumberFormatException nfe) {
- }
- }
- String newName = baseName;
- try {
- while (getLaunchManager().isExistingLaunchConfigurationName(newName)) {
- StringBuffer buffer = new StringBuffer(baseName);
- buffer.append(" (");
- buffer.append(String.valueOf(index));
- index++;
- buffer.append(')');
- newName = buffer.toString();
- }
- } catch (CoreException e) {
- DebugUIPlugin.log(e);
- }
- return newName;
- }
-
- /**
* Notification the 'Close' button has been pressed.
*/
protected void handleClosePressed() {
@@ -2842,7 +2810,7 @@ public class LaunchConfigurationDialog extends TitleAreaDialog if (name == null) {
name = ""; //$NON-NLS-1$
}
- return generateUniqueNameFrom(name);
+ return getLaunchManager().generateUniqueLaunchConfigurationNameFrom(name);
}
/**
|