use of net.sourceforge.usbdm.deviceEditor.model.ParametersModel in project usbdm-eclipse-plugins by podonoghue.
the class ParseMenuXML method parsePage.
/**
* Parse: <br>
* <ul>
* <li><fragment> referencing a one of the below elements<br>
* <li><peripheralPage><br>
* <li><list><br>
* </ul>
* @param element Element to parse
*
* @throws Exception
*/
private void parsePage(Element element) throws Exception {
String name = element.getAttribute("name");
if (name.equalsIgnoreCase("_instance")) {
name = fProvider.getName();
}
// System.err.println("parsePage(<" + element.getTagName() + " name="+ name + ">)");
String tooltip = getToolTip(element);
String tagName = element.getTagName();
if (tagName == "fragment") {
/*
* Parse fragment as if it was a continuation of the parent elements
* This handles fragments that just include a href include a <peripheralPage>
*/
for (Node node = element.getFirstChild(); node != null; node = node.getNextSibling()) {
if (node.getNodeType() != Node.ELEMENT_NODE) {
continue;
}
parsePage((Element) node);
}
} else if (tagName == "peripheralPage") {
fRootModel = new ParametersModel(null, name, tooltip);
parseSectionsOrOtherContents(fRootModel, element);
} else if (tagName == "list") {
fRootModel = new ListModel(null, name);
parseSectionsOrOtherContents(fRootModel, element);
} else {
throw new Exception("Expected <peripheralPage> or <list>");
}
}
use of net.sourceforge.usbdm.deviceEditor.model.ParametersModel in project usbdm-eclipse-plugins by podonoghue.
the class ParseMenuXML method parseChildModel.
/**
* Parse element containing: <ul>
* <li> <fragment> referencing only elements below
* <li> <intOption>
* <li> <bitmaskOption>
* <li> <floatOption>
* <li> <binaryOption>
* <li> <irqOption>
* <li> <choiceOption>
* <li> <stringOption>
* <li> <numericListOption>
* <li> <pinListOption>
* <li> <aliasOption>
* <li> <constant>
* <li> <section>
* <li> <signals>
* <li> Control items...
*</ul>
*
* Elements found are added as children of the parentModel
*
* @param parentModel Model to attach children to
* @param menuElement Menu element to parse
*
* @throws Exception
*/
void parseChildModel(BaseModel parentModel, Element element) throws Exception {
String tagName = element.getTagName();
String name = element.getAttribute("name");
String toolTip = getToolTip(element);
// System.err.println("parseChildModel(): " + tagName + ", " + element.getAttribute("name"));
if (tagName == "fragment") {
parseChildModels(parentModel, element);
} else if (tagName == "category") {
BaseModel model = new CategoryModel(parentModel, name, toolTip);
parseChildModels(model, element);
} else if (tagName == "indexedCategory") {
parseIndexedCategoryOption(parentModel, element);
} else if (tagName == "intOption") {
parseLongOption(parentModel, element);
} else if (tagName == "bitmaskOption") {
parseBitmaskOption(parentModel, element);
} else if (tagName == "floatOption") {
parseDoubleOption(parentModel, element);
} else if (tagName == "binaryOption") {
parseBinaryOption(parentModel, element);
} else if (tagName == "irqOption") {
parseIrqOption(parentModel, element);
} else if (tagName == "choiceOption") {
parseChoiceOption(parentModel, element);
} else if (tagName == "stringOption") {
parseStringOption(parentModel, element);
} else if (tagName == "numericListOption") {
parseNumericListOption(parentModel, element);
} else if (tagName == "pinListOption") {
parsePinListOption(parentModel, element);
} else if (tagName == "aliasOption") {
parseAliasOption(parentModel, element);
} else if (tagName == "constant") {
parseConstant(parentModel, element);
} else if (tagName == "section") {
BaseModel model = new ParametersModel(parentModel, name, toolTip);
parseChildModels(model, element);
} else if (tagName == "list") {
BaseModel model = new ListModel(parentModel, name);
parseSectionsOrOther(model, element);
} else if (tagName == "signals") {
parseSignalsOption(parentModel, element);
} else {
parseControlItem(element);
}
}
Aggregations