1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-15 04:55:22 +02:00

[244051] JJ: Environment Variables property page allows duplicates (apply patch from Justin Lin)

This commit is contained in:
Martin Oberhuber 2008-11-12 13:59:58 +00:00
parent 586f16b958
commit cde5c0f2bc

View file

@ -12,7 +12,8 @@
* *
* Contributors: * Contributors:
* Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType * Martin Oberhuber (Wind River) - [175262] IHost.getSystemType() should return IRSESystemType
* Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty() * Martin Oberhuber (Wind River) - [186640] Add IRSESystemType.testProperty()
* Justin Lin (IBM) - [244051] JJ: Environment Variables property page allows duplicates...
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.ui.widgets; package org.eclipse.rse.ui.widgets;
@ -591,16 +592,15 @@ public class EnvironmentVariablesForm extends SystemBaseForm implements Selectio
} }
// next check for duplicate env var names // next check for duplicate env var names
int numberFound = 0;
int itemCount = envVarTable.getItemCount(); int itemCount = envVarTable.getItemCount();
for (int i = 0; i < itemCount; i++) { for (int i = 0; i < itemCount; i++) {
TableItem item = envVarTable.getItem(i); TableItem item = envVarTable.getItem(i);
String itemName = item.getText(0); String itemName = item.getText(0);
if (itemName.equals(name)) numberFound++; if (itemName.equals(name) && i != envVarTable.getSelectionIndex()) {
} msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE);
if (numberFound > 1) { msg.makeSubstitution(name);
msg = RSEUIPlugin.getPluginMessage(ISystemMessages.MSG_COMM_ENVVAR_DUPLICATE); break;
msg.makeSubstitution(name); }
} }
} }
} }