Search in sources :

Example 1 with TaskWizardExecutor

use of org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor in project dbeaver by dbeaver.

the class AbstractNativeToolWizard method performFinish.

@Override
public boolean performFinish() {
    // Save settings
    settings.saveSettings(getRunnableContext(), getPreferenceStore());
    if (!validateClientFiles()) {
        return false;
    }
    if (getCurrentTask() != null) {
        return super.performFinish();
    }
    showLogPage();
    try {
        // Execute directly - without task serialize/deserialize
        // We need it because some data producers cannot be serialized properly (e.g. ResultSetDatacontainer - see #7342)
        DBTTask temporaryTask = getProject().getTaskManager().createTemporaryTask(getTaskType(), getTaskType().getName());
        saveConfigurationToTask(temporaryTask);
        TaskWizardExecutor executor = new TaskWizardExecutor(getRunnableContext(), temporaryTask, log, logPage.getLogWriter());
        executor.executeTask();
        return false;
    } catch (Exception e) {
        DBWorkbench.getPlatformUI().showError(e.getMessage(), "Error running task", e);
        return false;
    }
}
Also used : DBTTask(org.jkiss.dbeaver.model.task.DBTTask) TaskWizardExecutor(org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor) InvocationTargetException(java.lang.reflect.InvocationTargetException) DBException(org.jkiss.dbeaver.DBException)

Example 2 with TaskWizardExecutor

use of org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor in project dbeaver by serge-rider.

the class SQLToolTaskWizard method performFinish.

@Override
public boolean performFinish() {
    if (isRunTaskOnFinish()) {
        // Only if task is not temporary
        saveConfigurationToTask(getCurrentTask());
        return super.performFinish();
    }
    try {
        // Execute task in wizard
        DBTTask task = getCurrentTask();
        saveConfigurationToTask(task);
        pageStatus.clearLog();
        getContainer().showPage(pageStatus);
        TaskWizardExecutor executor = new SQLTaskExecutor(task);
        executor.executeTask();
        if (taskHandler.needsRefreshOnFinish()) {
            refreshOnFinish();
        }
        return false;
    } catch (Exception e) {
        DBWorkbench.getPlatformUI().showError(e.getMessage(), TasksSQLUIMessages.sql_tool_task_wizard_message_error_running_task, e);
        return false;
    }
}
Also used : DBTTask(org.jkiss.dbeaver.model.task.DBTTask) TaskWizardExecutor(org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor) DBCException(org.jkiss.dbeaver.model.exec.DBCException) InvocationTargetException(java.lang.reflect.InvocationTargetException) DBException(org.jkiss.dbeaver.DBException)

Example 3 with TaskWizardExecutor

use of org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor in project dbeaver by serge-rider.

the class AbstractNativeToolWizard method performFinish.

@Override
public boolean performFinish() {
    // Save settings
    settings.saveSettings(getRunnableContext(), getPreferenceStore());
    if (!validateClientFiles()) {
        return false;
    }
    if (getCurrentTask() != null) {
        return super.performFinish();
    }
    showLogPage();
    try {
        // Execute directly - without task serialize/deserialize
        // We need it because some data producers cannot be serialized properly (e.g. ResultSetDatacontainer - see #7342)
        DBTTask temporaryTask = getProject().getTaskManager().createTemporaryTask(getTaskType(), getTaskType().getName());
        saveConfigurationToTask(temporaryTask);
        TaskWizardExecutor executor = new TaskWizardExecutor(getRunnableContext(), temporaryTask, log, logPage.getLogWriter());
        executor.executeTask();
        return false;
    } catch (Exception e) {
        DBWorkbench.getPlatformUI().showError(e.getMessage(), "Error running task", e);
        return false;
    }
}
Also used : DBTTask(org.jkiss.dbeaver.model.task.DBTTask) TaskWizardExecutor(org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor) InvocationTargetException(java.lang.reflect.InvocationTargetException) DBException(org.jkiss.dbeaver.DBException)

Example 4 with TaskWizardExecutor

use of org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor in project dbeaver by dbeaver.

the class SQLToolTaskWizard method performFinish.

@Override
public boolean performFinish() {
    if (isRunTaskOnFinish()) {
        // Only if task is not temporary
        saveConfigurationToTask(getCurrentTask());
        return super.performFinish();
    }
    try {
        // Execute task in wizard
        DBTTask task = getCurrentTask();
        saveConfigurationToTask(task);
        pageStatus.clearLog();
        getContainer().showPage(pageStatus);
        TaskWizardExecutor executor = new SQLTaskExecutor(task);
        executor.executeTask();
        if (taskHandler.needsRefreshOnFinish()) {
            refreshOnFinish();
        }
        return false;
    } catch (Exception e) {
        DBWorkbench.getPlatformUI().showError(e.getMessage(), TasksSQLUIMessages.sql_tool_task_wizard_message_error_running_task, e);
        return false;
    }
}
Also used : DBTTask(org.jkiss.dbeaver.model.task.DBTTask) TaskWizardExecutor(org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor) DBCException(org.jkiss.dbeaver.model.exec.DBCException) InvocationTargetException(java.lang.reflect.InvocationTargetException) DBException(org.jkiss.dbeaver.DBException)

Aggregations

InvocationTargetException (java.lang.reflect.InvocationTargetException)4 DBException (org.jkiss.dbeaver.DBException)4 DBTTask (org.jkiss.dbeaver.model.task.DBTTask)4 TaskWizardExecutor (org.jkiss.dbeaver.tasks.ui.wizard.TaskWizardExecutor)4 DBCException (org.jkiss.dbeaver.model.exec.DBCException)2