private boolean validateTemplate(Template template) {
        String contextTypeId = template.getContextTypeId();
        if (!contextExists(contextTypeId))
            return false;

        if (getRegistry() != null) {
            try {
                getRegistry().getContextType(contextTypeId).validate(template.getPattern());
            } catch (TemplateException e) {
                log.error("Template '" + template.getName() + "' validation failed", e);
                return false;
            }
        }
        return true;
    }
Validates a template against the context type registered in the context
type registry. Returns always <code>true</code> if no registry is
present.

@param template the template to validate
@return <code>true</code> if validation is successful or no context
type registry is specified, <code>false</code> if validation
fails
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/templates/SQLTemplateStore.java