private void accomplishEditorInputInitialization(@NotNull IEditorInput editorInput) {
        DBPDataSourceContainer oldDataSource = SQLEditor.this.getDataSourceContainer();
        DBPDataSourceContainer newDataSource = EditorUtils.getInputDataSource(SQLEditor.this.getEditorInput());

        if (oldDataSource != newDataSource) {
            SQLEditor.this.dataSourceContainer = null;
            SQLEditor.this.updateDataSourceContainer();
        } else {
            SQLEditor.this.reloadSyntaxRules();
        }

        DBPDataSourceContainer dataSource = EditorUtils.getInputDataSource(editorInput);
        SQLEditorFeatures.SQL_EDITOR_OPEN.use(
            Map.of("driver", dataSource == null ? "" : dataSource.getDriver().getPreconfiguredId())
        );

        // toolbar refresh triggered on active part change or current datasource change, but:
        // - initialization accomplishment should occur after part's UI initialization which may include part activation,
        //      meaning that active part change sometimes happens before this code;
        // - when editorInput's datasource is already specified and updateDataSourceContainer() just actualizes editor's internal state,
        //      datasource change event also won't come.
        // So we need to update toolbar state explicitly after the whole editor is finally initialized for sure.
        DataSourceToolbarUtils.refreshSelectorToolbar(getSite().getWorkbenchWindow());
    }
Obtain the add-in instance by its concrete type
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java