Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Rennie2009-09-28 15:55:06 +0000
committerMichael Rennie2009-09-28 15:55:06 +0000
commit224b991a93cedd544ca1ff9cec2a30a47729bd55 (patch)
tree82eb46402a7bbb278de329d4dfb94d0186f54afe /org.eclipse.debug.ui/ui/org
parent819f593395137640fa5faf8124751f93e40a4f78 (diff)
downloadeclipse.platform.debug-224b991a93cedd544ca1ff9cec2a30a47729bd55.tar.gz
eclipse.platform.debug-224b991a93cedd544ca1ff9cec2a30a47729bd55.tar.xz
eclipse.platform.debug-224b991a93cedd544ca1ff9cec2a30a47729bd55.zip
Bug 267130 - [launching] ILaunchManager.generateUniqueLaunchConfigurationNameFrom -- either reject badly-named prefixes or fix them
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java48
1 files changed, 11 insertions, 37 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
index 5a7a055d3..e61568368 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java
@@ -19,13 +19,13 @@ import java.util.Set;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchDelegate;
+import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
import org.eclipse.debug.internal.core.LaunchConfigurationWorkingCopy;
import org.eclipse.debug.internal.ui.DebugUIPlugin;
@@ -73,20 +73,6 @@ import com.ibm.icu.text.MessageFormat;
* buttons.
*/
public class LaunchConfigurationTabGroupViewer {
-
- /**
- * Listing of invalid names for launch configurations
- * @since 3.5
- */
- static final String[] INVALID_CONFIG_NAMES = new String[] {"aux", "clock$", "com1", "com2", "com3", "com4", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "com5", "com6", "com7", "com8", "com9", "con", "lpt1", "lpt2", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$
- "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", "nul", "prn"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
-
- /**
- * Listing of characters that cannot appear in launch configuration names
- * @since 3.5
- */
- static final char[] INVALID_CONFIG_NAME_CHARS = new char[] { '@', '&','\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' };
/**
* Containing launch dialog
@@ -1232,6 +1218,7 @@ public class LaunchConfigurationTabGroupViewer {
*/
protected void verifyName() throws CoreException {
if (fNameWidget.isVisible()) {
+ ILaunchManager mgr = DebugPlugin.getDefault().getLaunchManager();
String currentName = fNameWidget.getText().trim();
// If there is no name, complain
@@ -1242,33 +1229,20 @@ public class LaunchConfigurationTabGroupViewer {
LaunchConfigurationsMessages.LaunchConfigurationDialog_Name_required_for_launch_configuration_11,
null));
}
- if(Platform.OS_WIN32.equals(Platform.getOS())) {
- for(int i = 0; i < INVALID_CONFIG_NAMES.length; i++) {
- if(currentName.equals(INVALID_CONFIG_NAMES[i])) {
- throw new CoreException(new Status(IStatus.ERROR,
- DebugUIPlugin.getUniqueIdentifier(),
- 0,
- MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_19, new String[] { currentName }),
- null));
- }
- }
+ try {
+ mgr.isValidLaunchConfigurationName(currentName);
}
- // See if name contains any characters that we deem illegal.
- // '@' and '&' are disallowed because they corrupt menu items
- for (int i = 0; i < INVALID_CONFIG_NAME_CHARS.length; i++) {
- char c = INVALID_CONFIG_NAME_CHARS[i];
- if (currentName.indexOf(c) > -1) {
- throw new CoreException(new Status(IStatus.ERROR,
- DebugUIPlugin.getUniqueIdentifier(),
- 0,
- MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationTabGroupViewer_0, new String[] { new String(new char[] {c}) }),
- null));
- }
+ catch(IllegalArgumentException iae) {
+ throw new CoreException(new Status(IStatus.ERROR,
+ DebugUIPlugin.getUniqueIdentifier(),
+ 0,
+ iae.getMessage(),
+ null));
}
// Otherwise, if there's already a config with the same name, complain
if (fOriginal != null && !fOriginal.getName().equals(currentName)) {
Set reservednames = ((LaunchConfigurationsDialog)getLaunchConfigurationDialog()).getReservedNameSet();
- if (DebugPlugin.getDefault().getLaunchManager().isExistingLaunchConfigurationName(currentName) || (reservednames != null ? reservednames.contains(currentName) : false)) {
+ if (mgr.isExistingLaunchConfigurationName(currentName) || (reservednames != null ? reservednames.contains(currentName) : false)) {
throw new CoreException(new Status(IStatus.ERROR,
DebugUIPlugin.getUniqueIdentifier(),
0,

Back to the top