use of net.sourceforge.usbdm.deviceEditor.information.IndexedCategoryVariable in project usbdm-eclipse-plugins by podonoghue.
the class ParseMenuXML method parseIndexedCategoryOption.
private void parseIndexedCategoryOption(BaseModel parent, Element element) throws Exception {
IndexedCategoryModel model = (IndexedCategoryModel) parseCommonAttributes(parent, element, IndexedCategoryVariable.class);
IndexedCategoryVariable variable = model.getVariable();
variable.setValue(element.getAttribute("value"));
int dimension = getIntAttribute(element, "dim");
model.setDimension(dimension);
parseChildModels(model, element);
for (int index = 1; index < dimension; index++) {
IndexedCategoryModel newModel = model.clone(parent, fProvider, index);
if (newModel.getName() == model.getName()) {
newModel.setName(model.getName() + "[" + index + "]");
}
IndexedCategoryVariable newVariable = newModel.getVariable();
newVariable.setValue(newVariable.getValueAsString().replaceAll("\\.$", Integer.toString(index)));
}
variable.setValue(variable.getValueAsString().replaceAll("\\.$", Integer.toString(0)));
}
Aggregations