private boolean isTemplateAllowed(DocumentTemplateContext context, Template template)
    {
        int offset = context.getCompletionOffset();
        try {
            return template != null && offset > 0 && !isTemplateNamePart(context.getDocument().getChar(offset - 1));
        } catch (BadLocationException e) {
            log.debug(e);
        }
        return false;
    }
Check whether the template is allowed even though the context can't evaluate it. This is
needed because the Dropping of a template is more lenient than ctl-space invoked code assist.

@param context  the template context
@param template the template
@return true if the template is allowed
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/templates/SQLTemplatesPage.java