use of org.eclipse.wst.xsl.core.model.Parameter in project webtools.sourceediting by eclipse.
the class XSLValidator method checkParameters.
private void checkParameters(XSLValidationReport report, Function function) throws MaxErrorsExceededException {
List<Parameter> parameters = new ArrayList<Parameter>(function.getParameters());
// reverse the parameters order for checking - for duplicate parameters
// the first one is valid
Collections.reverse(parameters);
Set<Parameter> duplicateParameters = new HashSet<Parameter>();
// check parameters
for (Parameter param : parameters) {
if (param.getName() == null) {
// name is required
createMarker(report, param, getPreference(ValidationPreferences.NAME_ATTRIBUTE_MISSING), Messages.XSLValidator_14);
} else if (param.getName().trim().length() == 0) {
// name value is
// required
createMarker(report, param, getPreference(ValidationPreferences.NAME_ATTRIBUTE_EMPTY), Messages.XSLValidator_15);
} else if (duplicateParameters.contains(param)) {
// the parameter
continue;
} else {
// check a parameter with the same name does not exist
for (Parameter checkParam : parameters) {
if (param != checkParam) {
if (param.getName().equals(checkParam.getName())) {
duplicateParameters.add(checkParam);
createMarker(report, param, getPreference(ValidationPreferences.DUPLICATE_PARAMETER), Messages.XSLValidator_16);
}
}
}
}
}
}
Aggregations