use of com.qcadoo.plugin.api.ModuleException in project qcadoo by qcadoo.
the class ViewTabModule method enable.
@Override
public void enable() {
addedTabs = ArrayListMultimap.create();
InternalViewDefinition viewDefinition = viewDefinitionService.getWithoutSession(viewExtension.getPluginName(), viewExtension.getViewName());
if (viewDefinition == null) {
throw new ModuleException(pluginIdentifier, "view", String.format("Reference to view which not exists: %s[%s]", viewExtension.getPluginName(), viewExtension.getViewName()));
}
try {
for (Node tabNode : viewDefinitionParser.geElementChildren(viewExtension.getExtesionNode())) {
WindowComponentPattern window = viewDefinition.getRootWindow();
ComponentDefinition tabDefinition = viewDefinitionParser.getComponentDefinition(tabNode, window, viewDefinition);
tabDefinition.setExtensionPluginIdentifier(pluginIdentifier);
ComponentPattern tabPattern = new WindowTabComponentPattern(tabDefinition);
try {
tabPattern.parse(tabNode, viewDefinitionParser);
} catch (ViewDefinitionParserNodeException e) {
throw ViewDefinitionParserException.forFileAndNode(fileName, e);
}
window.addChild(tabPattern);
addedTabs.put(window, tabPattern);
tabPattern.initializeAll();
tabPattern.registerViews(viewDefinitionService);
}
} catch (Exception e) {
throw new ModuleException(pluginIdentifier, "view-tab", e);
}
}
Aggregations