@Override
    protected boolean isValidTemplate(IDocument document, Template template, int offset, int length)
    {
        String[] contextIds = getContextTypeIds(document, offset);
        for (String contextId : contextIds) {
            if (contextId.equals(template.getContextTypeId())) {
                DocumentTemplateContext context = getContext(document, template, offset, length);
                return context.canEvaluate(template) || isTemplateAllowed(context, template);
            }
        }
        return false;
    }
Create a new AbstractTemplatesPage for the JavaEditor

@param sqlEditor the java editor
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/templates/SQLTemplatesPage.java