1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-16 21:45:22 +02:00

[238158]][cleanup] Simplify iterating over name validators

This commit is contained in:
Martin Oberhuber 2008-07-10 17:10:10 +00:00
parent 6a9ebc1362
commit 3f65e6f954

View file

@ -43,7 +43,7 @@ import org.eclipse.swt.widgets.Text;
/** /**
* Second page of the New Filter wizard that prompts for the name of the filter. * Second page of the New Filter wizard that prompts for the name of the filter.
* *
* @since 3.0 moved from internal to API * @since 3.0 moved from internal to API
*/ */
public class SystemNewFilterWizardNamePage public class SystemNewFilterWizardNamePage
@ -362,10 +362,9 @@ public class SystemNewFilterWizardNamePage
} }
if ((errorMessage == null) && (nameValidators != null)) if ((errorMessage == null) && (nameValidators != null))
{ {
int i = 0; String nameToValidate = nameText.getText().trim();
while (errorMessage == null && i < nameValidators.length){ for (int i = 0; errorMessage == null && i < nameValidators.length; i++) {
errorMessage = nameValidators[i].validate(nameText.getText().trim()); errorMessage = nameValidators[i].validate(nameToValidate);
i++;
} }
controlInError = nameText; controlInError = nameText;
} }
@ -387,10 +386,9 @@ public class SystemNewFilterWizardNamePage
{ {
errorMessage= null; errorMessage= null;
if (nameValidators != null){ if (nameValidators != null){
int i = 0; String nameToValidate = nameText.getText().trim();
while (errorMessage == null && i < nameValidators.length){ for (int i = 0; errorMessage == null && i < nameValidators.length; i++) {
errorMessage = nameValidators[i].validate(nameText.getText().trim()); errorMessage = nameValidators[i].validate(nameToValidate);
i++;
} }
} }
if ((errorMessage == null) && (filterPoolSelectionValidator != null)) if ((errorMessage == null) && (filterPoolSelectionValidator != null))