@Override
            protected IStatus run(final DBRProgressMonitor monitor)
            {
                final DataSourceJob curJob = this;
                UIUtils.asyncExec(() -> scriptListener.beginScriptProcessing(curJob, objects));
                monitor.beginTask(jobName, objects.size());
                try (DBCSession session = getExecutionContext().openSession(monitor, DBCExecutionPurpose.UTIL, jobName)) {
                    if (isRunInSeparateTransaction()) {
                        commitChanges(session);
                    }
                    for (int i = 0; i < objects.size(); i++) {
                        if (monitor.isCanceled()) {
                            break;
                        }
                        final int objectNumber = i;
                        final T object = objects.get(i);
                        monitor.subTask("Process " + DBUtils.getObjectFullName(object, DBPEvaluationContext.UI));
                        objectProcessingError = null;
                        UIUtils.asyncExec(() -> scriptListener.beginObjectProcessing(object, objectNumber));
                        try {
                            final List<String> lines = objectsSQL.get(object);
                            for (String line : lines) {
                                try (final DBCStatement statement = DBUtils.makeStatement(session, line, false)) {
                                    if (statement.executeStatement()) {
                                        try (DBCResultSet resultSet = statement.openResultSet()) {
                                            // Run in sync because we need result set
                                            UIUtils.syncExec(() -> {
                                                try {
                                                    scriptListener.processObjectResults(object, statement, resultSet);
                                                } catch (DBCException e) {
                                                    objectProcessingError = e;
                                                }
                                            });
                                        }
                                        if (objectProcessingError != null) {
                                            break;
                                        }
                                    } else {
                                        UIUtils.syncExec(() -> {
                                            try {
                                                scriptListener.processObjectResults(object, statement, null);
                                            } catch (DBCException e) {
                                                objectProcessingError = e;
                                            }
                                        });
                                    }
                                }
                            }
                        } catch (Exception e) {
                            objectProcessingError = e;
                        } finally {
                            UIUtils.asyncExec(() -> scriptListener.endObjectProcessing(object, objectProcessingError));
                        }
                        monitor.worked(1);
                    }
                    if (isRunInSeparateTransaction()) {
                        commitChanges(session);
                    }

                } finally {
                    monitor.done();
                    UIUtils.asyncExec(scriptListener::endScriptProcessing);
                }
                return Status.OK_STATUS;
            }
Super class for handling dialogs related to

@author Serge Rider
plugins/org.jkiss.dbeaver.ui.editors.sql/src/org/jkiss/dbeaver/ui/editors/sql/dialogs/GenerateMultiSQLDialog.java