public boolean processQueries(@NotNull final List<SQLScriptElement> queries, final boolean forceScript,
        boolean newTab, final boolean export, final boolean checkSession,
        @Nullable final SQLQueryListener queryListener, @Nullable final SQLScriptContext context
    ) {
        if (queries.isEmpty()) {
            // Nothing to process
            return false;
        }
        
        final DBPDataSourceContainer container = getDataSourceContainer();
        if (checkSession) {
            try {
                boolean finalNewTab = newTab;
                DBRProgressListener connectListener = status -> {
                    if (!status.isOK() || container == null || !container.isConnected()) {
                        DBWorkbench.getPlatformUI().showError(
                            SQLEditorMessages.editors_sql_error_cant_obtain_session,
                            null,
                            status);
                        return;
                    }
                    updateExecutionContext(() -> UIUtils.syncExec(() ->
                        processQueries(queries, forceScript, finalNewTab, export, false, queryListener, context)));
                };
                if (!checkSession(connectListener)) {
                    return false;
                }
            } catch (DBException ex) {
                ResultSetViewer viewer = getActiveResultSetViewer();
                if (viewer != null) {
                    viewer.setStatus(ex.getMessage(), DBPMessageType.ERROR);
                }
                DBWorkbench.getPlatformUI().showError(
                    SQLEditorMessages.editors_sql_error_cant_obtain_session,
                    ex.getMessage());
                return false;
            }
        }
        if (dataSourceContainer == null) {
            return false;
        }
        if (!dataSourceContainer.hasModifyPermission(DBPDataSourcePermission.PERMISSION_EXECUTE_SCRIPTS)) {
            DBWorkbench.getPlatformUI().showError(
                SQLEditorMessages.editors_sql_error_cant_execute_query_title,
                SQLEditorMessages.editors_sql_error_cant_execute_permissions_query_message
            );
            return false;
        }

        if (dataSourceContainer.isConnectionReadOnly() &&
            queries.stream().anyMatch(q -> (q instanceof SQLQuery sqlQuery && sqlQuery.isMutatingStatement()))
        ) {
            DBWorkbench.getPlatformUI().showError(
                SQLEditorMessages.editors_sql_error_cant_execute_query_title,
                SQLEditorMessages.editors_sql_error_cant_execute_readonly_query_message
            );
            return false;
        }

        SQLScriptContext scriptContext = context;
        if (scriptContext == null) {
            scriptContext = createScriptContext();
        }

        final boolean isSingleQuery = !forceScript && (queries.size() == 1);
        if (isSingleQuery && queries.get(0) instanceof SQLQuery query) {
            boolean isDropTable = query.isDropTableDangerous();
            if (query.isDeleteUpdateDangerous() || isDropTable) {
                String targetName = "multiple tables";
                if (query.getEntityMetadata(false) != null) {
                    targetName = query.getEntityMetadata(false).getEntityName();
                }
                if (ConfirmationDialog.confirmAction(
                    getSite().getShell(),
                    ConfirmationDialog.WARNING, isDropTable ? SQLPreferenceConstants.CONFIRM_DROP_SQL : SQLPreferenceConstants.CONFIRM_DANGER_SQL,
                    ConfirmationDialog.CONFIRM,
                    query.getType().name(),
                    targetName) != IDialogConstants.OK_ID
                ) {
                    return false;
                }
            }
        }


        if (!isHideQueryText() && resultsSash.getMaximizedControl() != null) {
            resultsSash.setMaximizedControl(null);
        }

        // Save editor
        if (getActivePreferenceStore().getBoolean(SQLPreferenceConstants.AUTO_SAVE_ON_EXECUTE) && isDirty()) {
            doSave(new NullProgressMonitor());
        }

        // Clear server console output
        if (getActivePreferenceStore().getBoolean(SQLPreferenceConstants.CLEAR_OUTPUT_BEFORE_EXECUTE)) {
            outputViewer.clearOutput();
        }

        boolean replaceCurrentTab = getActivePreferenceStore().getBoolean(SQLPreferenceConstants.RESULT_SET_REPLACE_CURRENT_TAB);

        if (!export && curQueryProcessor != null) {
            // We only need to prompt user to close extra (unpinned) tabs if:
            // 1. The user is not executing query in a new tab
            // 2. The user is executing script that may open several result sets
            //    and replace current tab on single query execution option is not set
            if (isResultSetAutoFocusEnabled && !newTab && (!isSingleQuery || (isSingleQuery && !replaceCurrentTab))) {
                int tabsClosed = closeExtraResultTabs(null, true, false);
                if (tabsClosed == IDialogConstants.CANCEL_ID) {
                    return false;
                } else if (tabsClosed == IDialogConstants.NO_ID) {
                    newTab = true;
                }
            }

            // Create new query processor if:
            // 1. New tab is explicitly requested
            // 1. Or all tabs are closed and no query processors are present
            // 2. Or current query processor has pinned tabs
            // 3. Or current query processor has running jobs
            // 4. Or current query processor is multi-tabbed and user wants single-tabbed or vice versa
            var noQueryProcessors = queryProcessors.isEmpty();
            var hasRunningJobs = !noQueryProcessors && curQueryProcessor.getRunningJobs() > 0;
            var hasPinnedTabs = !noQueryProcessors && curQueryProcessor.hasPinnedTabs();
            var needAnotherQueryProcessor = !noQueryProcessors && useTabPerQuery(isSingleQuery)
                && !(curQueryProcessor instanceof MultiTabsQueryProcessor);

            if (newTab || noQueryProcessors || hasRunningJobs || hasPinnedTabs || needAnotherQueryProcessor) {
                boolean foundSuitableTab = false;
                boolean anyNotPinnedTab = false;

                // Try to find suitable query processor among exiting ones if:
                // 1. New tab is not required
                // 2. The user is executing only single query
                if (!newTab && isSingleQuery) {
                    for (QueryProcessor processor : queryProcessors) {
                        if (!processor.hasPinnedTabs() && processor.getRunningJobs() == 0) {
                            foundSuitableTab = true;
                            curQueryProcessor = processor;
                            break;
                        }
                        anyNotPinnedTab = anyNotPinnedTab || !processor.hasPinnedTabs();
                    }
                }
                // Just create a new query processor
                if (!foundSuitableTab && (newTab || !anyNotPinnedTab)) {
                    // If we already have useless multi-tabbed processor, but we want single-tabbed, then get rid of the useless one  
                    if (needAnotherQueryProcessor
                        && curQueryProcessor.getResultContainers().size() == 1
                        && !curQueryProcessor.getFirstResults().viewer.hasData()
                    ) {
                        curQueryProcessor.getFirstResults().dispose();
                    }
                    createQueryProcessor(true, isSingleQuery, false);
                }
            }

            // Close all extra tabs of this query processor
            // if the user is executing only single query
            if (!newTab && isSingleQuery && curQueryProcessor.getResultContainers().size() > 1) {
                closeExtraResultTabs(curQueryProcessor, false, true);
            }

            CTabItem tabItem = curQueryProcessor.getFirstResults().getResultsTab();

            if (tabItem != null) {
                // Do not switch tab if Output tab is active
                CTabItem selectedTab = resultTabs.getSelection();
                if (selectedTab == null || selectedTab.getData() != outputViewer) {
                    setResultTabSelection(tabItem);
                }
            }
        }

        if (curQueryProcessor == null || (newTab && useTabPerQuery(isSingleQuery) == (curQueryProcessor instanceof SingleTabQueryProcessor))) {
            createQueryProcessor(true, isSingleQuery, true);
        }

        return curQueryProcessor.processQueries(
            scriptContext,
            queries,
            forceScript,
            false,
            export,
            !export && getActivePreferenceStore().getBoolean(SQLPreferenceConstants.RESULT_SET_CLOSE_ON_ERROR),
            queryListener);
    }
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