}
public void validateImplementations(TreeMap<CamelCaseName, MenuElementDefinitionDMW> menuElements) throws ResultException {
initialize();
ResultException errors = null;
for(MenuElementDefinitionDMW def: menuElements.values()){
if (def instanceof MenuBar){
if (def.getUseImpl() == null)
def.setUseImpl(getDefaultMenuBar().getType());
else if (menubarTypes.get(def.getUseImpl()) == null){
if (errors == null)
errors = new ResultException();
errors.addError("Invalid implementation (useImpl) for MenuBar: " + def.getUseImpl());
errors.result.lastResult().fileName(def.getFile());
errors.result.lastResult().lineNumber(def.getLineNumber());
}
}
else if (def instanceof MenuItem){
if (def.getUseImpl() == null)
def.setUseImpl(getDefaultMenuItem().getType());
else if (menuItemTypes.get(def.getUseImpl()) == null){
if (errors == null)
errors = new ResultException();
errors.addError("Invalid implementation (useImpl) for MenuItem: " + def.getUseImpl());
errors.result.lastResult().fileName(def.getFile());
errors.result.lastResult().lineNumber(def.getLineNumber());
}
}
else if (def instanceof SubMenu){
if (def.getUseImpl() == null)
def.setUseImpl(getDefaultSubMenu().getType());
else if (submenuTypes.get(def.getUseImpl()) == null){
if (errors == null)
errors = new ResultException();
errors.addError("Invalid implementation (useImpl) for SubMenu: " + def.getUseImpl());
errors.result.lastResult().fileName(def.getFile());
errors.result.lastResult().lineNumber(def.getLineNumber());
}
}
else if (def instanceof Separator){
if (def.getUseImpl() == null)
def.setUseImpl(getDefaultSeparator().getType());
else if (separatorTypes.get(def.getUseImpl()) == null){
if (errors == null)
errors = new ResultException();
errors.addError("Invalid implementation (useImpl) for Separator: " + def.getUseImpl());
errors.result.lastResult().fileName(def.getFile());
errors.result.lastResult().lineNumber(def.getLineNumber());
}
}