*/
private void addVariables(List results, CMNode node, ITextRegionCollection customTag) {
List list = ((TLDElementDeclaration) node).getVariables();
Iterator it = list.iterator();
while (it.hasNext()) {
TLDVariable var = (TLDVariable) it.next();
if (!var.getDeclare())
continue;
String varName = var.getNameGiven();
if (varName == null) {
// 2.0
varName = var.getAlias();
}
if (varName == null) {
String attrName = var.getNameFromAttribute();
/*
* Iterate through the document region to find the
* corresponding attribute name, and then use its value
*/
ITextRegionList regions = customTag.getRegions();
boolean attrNameFound = false;
for (int i = 2; i < regions.size(); i++) {
ITextRegion region = regions.get(i);
if (DOMRegionContext.XML_TAG_ATTRIBUTE_NAME.equals(region.getType())) {
attrNameFound = attrName.equals(customTag.getText(region));
}
if (attrNameFound && DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE.equals(region.getType())) {
varName = StringUtils.strip(customTag.getText(region));
}
}
}
if (varName != null) {
String varClass = "java.lang.String"; // the default
// class...//$NON-NLS-1$
if (var.getVariableClass() != null) {
varClass = var.getVariableClass();
}
results.add(new TaglibVariable(varClass, varName, var.getScope(), var.getDescription()));
}
}
}