@Override
    protected void updatePatternViewer(Template template)
    {
        if (template == null) {
            getPatternViewer().getDocument().set(""); //$NON-NLS-1$
            return;
        }
        //String contextId = template.getContextTypeId();

        IDocument doc = getPatternViewer().getDocument();

        String start = ""; //$NON-NLS-1$

        doc.set(start + template.getPattern());
        int startLen = start.length();
        getPatternViewer().setDocument(doc, startLen, doc.getLength() - startLen);
    }
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