}
private void initMouseMappings(Element elt) {
MouseMappings map = file.getOptions().getMouseMappings();
for (Element sub_elt : XmlIterator.forChildElements(elt, "tool")) {
Tool tool;
try {
tool = toTool(sub_elt);
} catch (XmlReaderException e) {
addErrors(e, "mapping");
continue;
}
String mods_str = sub_elt.getAttribute("map");
if (mods_str == null || mods_str.equals("")) {
loader.showError(getFromLocale("mappingMissingError"));
continue;
}
int mods;
try {
mods = InputEventUtil.fromString(mods_str);
} catch (NumberFormatException e) {
loader.showError(getFromLocale("mappingBadError", mods_str));
continue;
}
tool = tool.cloneTool();
try {
initAttributeSet(sub_elt, tool.getAttributeSet(), tool);
} catch (XmlReaderException e) {
addErrors(e, "mapping." + tool.getName());
}
map.setToolFor(mods, tool);
}
}