diff options
author | Michael Rennie | 2009-03-05 19:34:30 +0000 |
---|---|---|
committer | Michael Rennie | 2009-03-05 19:34:30 +0000 |
commit | 2548cd408579921eab9022b0ca57f0c04747f7de (patch) | |
tree | 40e8d85ae9aeec3277e97efce8e045da43cd23ca /org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java | |
parent | 44433a581ddbcbe404c151cf45677c6ba2ad5129 (diff) | |
download | eclipse.platform.debug-2548cd408579921eab9022b0ca57f0c04747f7de.tar.gz eclipse.platform.debug-2548cd408579921eab9022b0ca57f0c04747f7de.tar.xz eclipse.platform.debug-2548cd408579921eab9022b0ca57f0c04747f7de.zip |
moved name validation (performance)
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTabGroupViewer.java | 31 |
1 files changed, 20 insertions, 11 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 f83878e8e..63fa1aba7 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2008 IBM Corporation and others. + * Copyright (c) 2000, 2009 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -75,6 +75,20 @@ import com.ibm.icu.text.MessageFormat; 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 */ private ILaunchConfigurationDialog fDialog; @@ -1213,11 +1227,8 @@ public class LaunchConfigurationTabGroupViewer { null)); } if(Platform.OS_WIN32.equals(Platform.getOS())) { - String[] badnames = 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$ - for(int i = 0; i < badnames.length; i++) { - if(currentName.equals(badnames[i])) { + 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, @@ -1227,10 +1238,9 @@ public class LaunchConfigurationTabGroupViewer { } } // See if name contains any characters that we deem illegal. - // '@' and '&' are disallowed because they corrupt menu items. - char[] disallowedChars = new char[] { '@', '&','\\', '/', ':', '*', '?', '"', '<', '>', '|', '\0' }; - for (int i = 0; i < disallowedChars.length; i++) { - char c = disallowedChars[i]; + // '@' 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(), @@ -1239,7 +1249,6 @@ public class LaunchConfigurationTabGroupViewer { 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(); |