@Override
    protected String[] getContextTypeIds(IDocument document, int offset) {
        DBPDriver driver = null;
        if (sqlEditor instanceof SQLEditor) {
            DBPDataSourceContainer dsContainer = ((SQLEditor) sqlEditor).getDataSourceContainer();
            if (dsContainer != null) {
                driver = dsContainer.getDriver();
            }
        }
        if (driver == null) {
            DBPDataSource dataSource = sqlEditor.getDataSource();
            if (dataSource != null) {
                driver = dataSource.getContainer().getDriver();
            }
        }
        if (driver == null) {
            return new String[]{SQLContextTypeBase.ID_SQL};
        } else {
            return new String[]{
                SQLContextTypeBase.ID_SQL,
                SQLContextTypeProvider.getTypeId(driver.getProviderId()),
                SQLContextTypeDriver.getTypeId(driver)};
        }
    }
Get the active contexts for the given position in the document.

@param document the document
@param offset   the offset
@return an array of valid context id
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/templates/SQLTemplatesPage.java