public static boolean isTemplateContextFitsEditorContext(@NotNull String templateContextTypeId, @NotNull SQLEditorBase editor) {
        boolean result = false;
        if (editor instanceof SQLEditor) {
            DBPDataSourceContainer dsContainer = ((SQLEditor) editor).getDataSourceContainer();
            if (dsContainer != null) {
                DBPDriver driver = dsContainer.getDriver();
                String driverContextTypeId = SQLContextTypeDriver.getTypeId(driver);
                String providerContextTypeId = SQLContextTypeProvider.getTypeId(driver.getProviderId());
                result = isTemplateContextFitsEditorContext(templateContextTypeId, driverContextTypeId, providerContextTypeId);
                if (!result) {
                    for (Pair<String, String> replInfo : driver.getDriverReplacementsInfo()) {
                        driverContextTypeId = SQLContextTypeDriver.getTypeId(replInfo.getFirst(), replInfo.getSecond());
                        result = isTemplateContextFitsEditorContext(templateContextTypeId, driverContextTypeId, providerContextTypeId);
                        if (result) {
                            break;
                        }
                    }
                    
                }
            }
        }
        return result;
    }
Checks whether template's context is suitable for the editor context
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditorUtils.java