private void processQueryResult(DBRProgressMonitor monitor, SQLQueryResult result, DBCStatistics statistics) {
            if (!scriptMode) {
                runPostExecuteActions(result);
            }
            SQLQuery query = result.getStatement();
            Throwable error = result.getError();
            ISelectionProvider selectionProvider = getSelectionProvider();
            if (selectionProvider == null) {
                // Disposed?
                return;
            }
            if (error != null) {
                setStatus(GeneralUtils.getFirstMessage(error), DBPMessageType.ERROR);
                SQLQuery originalQuery = curResultsContainer.query instanceof SQLQuery sqlQuery ? sqlQuery : null; // SQLQueryResult stores modified query
                if (!visualizeQueryErrors(monitor, query, error, originalQuery)) {
                    int errorQueryOffset = query.getOffset();
                    int errorQueryLength = query.getLength();
                    if (errorQueryOffset >= 0 && errorQueryLength > 0) {
                        if (!addProblem(GeneralUtils.getFirstMessage(error), new Position(errorQueryOffset, errorQueryLength))) {
                            if (scriptMode) {
                                selectionProvider.setSelection(new TextSelection(errorQueryOffset, errorQueryLength));
                            } else {
                                selectionProvider.setSelection(originalSelection);
                            }
                        }
                        setLastQueryErrorPosition(errorQueryOffset);
                    }
                }
            } else if (!scriptMode && getActivePreferenceStore().getBoolean(SQLPreferenceConstants.RESET_CURSOR_ON_EXECUTE)) {
                selectionProvider.setSelection(originalSelection);
            }
            notifyOnQueryResultListeners(curResultsContainer, result);
            // Get results window (it is possible that it was closed till that moment
            {
                for (QueryResultsContainer cr : queryProcessor.resultContainers) {
                    cr.viewer.updateFiltersText(false);
                }
                if (!result.hasError() && !queryProcessor.resultContainers.isEmpty()) {
                    if (activeResultsTab != null && !activeResultsTab.isDisposed()) {
                        setResultTabSelection(activeResultsTab);
                    } else {
                        setResultTabSelection(queryProcessor.resultContainers.get(0).getResultsTab());
                    }
                }
                // Set tab names by query results names
                if (scriptMode || !queryProcessor.getResultContainers().isEmpty()) {

                    int queryIndex = queryProcessors.indexOf(queryProcessor);
                    int resultsIndex = 0;
                    for (QueryResultsContainer results : queryProcessor.resultContainers) {
                        if (results.query != query) {
                            // This happens when query results is statistics tab
                            // in that case we need to update tab selection and
                            // select new statistics tab
                            // see #16605
                            // But we need to avoid the result tab with the select statement
                            // because the statistics window can not be in focus in this case

                            results.handleExecuteResult(result);

                            if (getActivePreferenceStore().getBoolean(SQLPreferenceConstants.SET_SELECTION_TO_STATISTICS_TAB) &&
                                query.getType() != SQLQueryType.SELECT
                            ) {
                                setResultTabSelection(results.getResultsTab());
                            }
                            continue;
                        }
                        if (resultsIndex < result.getExecuteResults().size()) {
                            SQLQueryResult.ExecuteResult executeResult = result.getExecuteResults(resultsIndex, true);
                            String resultSetName = results.tabName;
                            if (CommonUtils.isEmpty(resultSetName)) {
                                resultSetName = getResultsTabName(results.resultSetNumber, queryIndex, executeResult.getResultSetName());
                                results.updateResultsName(resultSetName, null);
                                setResultTabSelection(results.getResultsTab());
                            }
                            ResultSetViewer resultSetViewer = results.getResultSetController();
                            if (resultSetViewer != null) {
                                resultSetViewer.getModel().setStatistics(statistics);
                            }
                            results.handleExecuteResult(result);
                        }
                        resultsIndex++;
                    }
                } else {
                    dumpQueryServerOutput(result);
                }
            }
            // Close tab on error
            if (closeTabOnError && error != null) {
                CTabItem tabItem = queryProcessor.getFirstResults().getResultsTab();
                if (tabItem != null && tabItem.getShowClose()) {
                    tabItem.dispose();
                }
            }
            // Beep
            if (dataSourceContainer != null && !scriptMode && getActivePreferenceStore().getBoolean(SQLPreferenceConstants.BEEP_ON_QUERY_END)) {
                Display.getCurrent().beep();
            }
            // Notify agent
            UIServiceSystemAgent serviceSystemAgent = DBWorkbench.getService(UIServiceSystemAgent.class);
            if (serviceSystemAgent != null && result.getQueryTime() > serviceSystemAgent.getLongOperationTimeout() * 1000) {
                serviceSystemAgent.notifyAgent(
                        "Query completed [" + getEditorInput().getName() + "]" + GeneralUtils.getDefaultLineSeparator() +
                                CommonUtils.truncateString(query.getText(), 200), !result.hasError() ? IStatus.INFO : IStatus.ERROR);
            }
        }
Build and update icon and title
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/SQLEditor.java