Search in sources :

Example 1 with TaskConfigurationWizardDialog

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

the class TaskHandlerEdit method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final ISelection selection = HandlerUtil.getCurrentSelection(event);
    if (selection instanceof IStructuredSelection) {
        Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element instanceof DBTTask) {
            DBTTask task = (DBTTask) element;
            DBTTaskType taskTypeDescriptor = task.getType();
            if (!TaskUIRegistry.getInstance().supportsConfigurator(taskTypeDescriptor)) {
                DBWorkbench.getPlatformUI().showError("No configurator", "Task '" + taskTypeDescriptor.getName() + "' has no configurator");
                return null;
            }
            try {
                TaskConfigurationWizard wizard = TaskUIRegistry.getInstance().createConfigurator(taskTypeDescriptor).createTaskConfigWizard(task);
                if (wizard != null) {
                    TaskConfigurationWizardDialog dialog = new TaskConfigurationWizardDialog(HandlerUtil.getActiveWorkbenchWindow(event), wizard);
                    dialog.setEditMode(true);
                    dialog.open();
                }
            } catch (Throwable e) {
                DBWorkbench.getPlatformUI().showError("Task configuration", "Error opening task '" + task.getName() + "' configuration editor", e);
            }
        }
    }
    return null;
}
Also used : DBTTask(org.jkiss.dbeaver.model.task.DBTTask) ISelection(org.eclipse.jface.viewers.ISelection) TaskConfigurationWizardDialog(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) TaskConfigurationWizard(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard) DBTTaskType(org.jkiss.dbeaver.model.task.DBTTaskType)

Example 2 with TaskConfigurationWizardDialog

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

the class TaskHandlerCreate method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    DBPProject project = NavigatorUtils.getSelectedProject();
    /*
        CreateTaskConfigurationDialog dialog = new CreateTaskConfigurationDialog(
            HandlerUtil.getActiveShell(event),
            project
        );
*/
    TaskConfigurationWizardDialog dialog = new TaskConfigurationWizardDialog(HandlerUtil.getActiveWorkbenchWindow(event));
    if (dialog.open() == IDialogConstants.OK_ID) {
        DBTTaskManager taskManager = project.getTaskManager();
        try {
        /*
                DBTTaskConfigurator configurator = dialog.getSelectedCategory().createConfigurator();
                DBTTask task = taskManager.createTask(
                    dialog.getSelectedTaskType(),
                    dialog.getTaskName(),
                    dialog.getTaskDescription(),
                    dialog.getInitialProperties());
                if (!configurator.createTaskConfigWizard(task)) {
                    taskManager.deleteTaskConfiguration(task);
                }
*/
        } catch (Exception e) {
            DBWorkbench.getPlatformUI().showError("Create task failed", "Error while creating new task", e);
        }
    }
    return null;
}
Also used : DBTTaskManager(org.jkiss.dbeaver.model.task.DBTTaskManager) TaskConfigurationWizardDialog(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog) DBPProject(org.jkiss.dbeaver.model.app.DBPProject) ExecutionException(org.eclipse.core.commands.ExecutionException)

Example 3 with TaskConfigurationWizardDialog

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

the class DataTransferWizard method openWizard.

public static void openWizard(@NotNull IWorkbenchWindow workbenchWindow, @Nullable Collection<IDataTransferProducer> producers, @Nullable Collection<IDataTransferConsumer> consumers, @Nullable IStructuredSelection selection) {
    try {
        DataTransferSettings settings = DataTransferSettings.loadSettings(new DBRRunnableWithResult<DataTransferSettings>() {

            @Override
            public void run(DBRProgressMonitor monitor) {
                result = new DataTransferSettings(monitor, producers, consumers, new DialogSettingsMap(getWizardDialogSettings()), new DataTransferState(), true, CommonUtils.isEmpty(consumers), false);
            }
        });
        DataTransferWizard wizard = new DataTransferWizard(null, settings, true);
        TaskConfigurationWizardDialog dialog = new TaskConfigurationWizardDialog(workbenchWindow, wizard, selection);
        dialog.open();
    } catch (DBException e) {
        DBWorkbench.getPlatformUI().showError("Data transfer error", "Can not open data transfer wizard", e);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) TaskConfigurationWizardDialog(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog) DBRProgressMonitor(org.jkiss.dbeaver.model.runtime.DBRProgressMonitor) DialogSettingsMap(org.jkiss.dbeaver.ui.DialogSettingsMap)

Example 4 with TaskConfigurationWizardDialog

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

the class DataTransferWizard method openWizard.

public static void openWizard(@NotNull IWorkbenchWindow workbenchWindow, @Nullable Collection<IDataTransferProducer> producers, @Nullable Collection<IDataTransferConsumer> consumers, @Nullable IStructuredSelection selection) {
    try {
        DataTransferSettings settings = DataTransferSettings.loadSettings(new DBRRunnableWithResult<DataTransferSettings>() {

            @Override
            public void run(DBRProgressMonitor monitor) {
                result = new DataTransferSettings(monitor, producers, consumers, new DialogSettingsMap(getWizardDialogSettings()), new DataTransferState(), true, CommonUtils.isEmpty(consumers), false);
            }
        });
        DataTransferWizard wizard = new DataTransferWizard(null, settings, true);
        TaskConfigurationWizardDialog dialog = new TaskConfigurationWizardDialog(workbenchWindow, wizard, selection);
        dialog.open();
    } catch (DBException e) {
        DBWorkbench.getPlatformUI().showError("Data transfer error", "Can not open data transfer wizard", e);
    }
}
Also used : DBException(org.jkiss.dbeaver.DBException) TaskConfigurationWizardDialog(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog) DBRProgressMonitor(org.jkiss.dbeaver.model.runtime.DBRProgressMonitor) DialogSettingsMap(org.jkiss.dbeaver.ui.DialogSettingsMap)

Example 5 with TaskConfigurationWizardDialog

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

the class TaskHandlerCreate method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    DBPProject project = NavigatorUtils.getSelectedProject();
    /*
        CreateTaskConfigurationDialog dialog = new CreateTaskConfigurationDialog(
            HandlerUtil.getActiveShell(event),
            project
        );
*/
    TaskConfigurationWizardDialog dialog = new TaskConfigurationWizardDialog(HandlerUtil.getActiveWorkbenchWindow(event));
    if (dialog.open() == IDialogConstants.OK_ID) {
        DBTTaskManager taskManager = project.getTaskManager();
        try {
        /*
                DBTTaskConfigurator configurator = dialog.getSelectedCategory().createConfigurator();
                DBTTask task = taskManager.createTask(
                    dialog.getSelectedTaskType(),
                    dialog.getTaskName(),
                    dialog.getTaskDescription(),
                    dialog.getInitialProperties());
                if (!configurator.createTaskConfigWizard(task)) {
                    taskManager.deleteTaskConfiguration(task);
                }
*/
        } catch (Exception e) {
            DBWorkbench.getPlatformUI().showError("Create task failed", "Error while creating new task", e);
        }
    }
    return null;
}
Also used : DBTTaskManager(org.jkiss.dbeaver.model.task.DBTTaskManager) TaskConfigurationWizardDialog(org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog) DBPProject(org.jkiss.dbeaver.model.app.DBPProject) ExecutionException(org.eclipse.core.commands.ExecutionException)

Aggregations

TaskConfigurationWizardDialog (org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog)6 ExecutionException (org.eclipse.core.commands.ExecutionException)2 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 DBException (org.jkiss.dbeaver.DBException)2 DBPProject (org.jkiss.dbeaver.model.app.DBPProject)2 DBRProgressMonitor (org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)2 DBTTask (org.jkiss.dbeaver.model.task.DBTTask)2 DBTTaskManager (org.jkiss.dbeaver.model.task.DBTTaskManager)2 DBTTaskType (org.jkiss.dbeaver.model.task.DBTTaskType)2 TaskConfigurationWizard (org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard)2 DialogSettingsMap (org.jkiss.dbeaver.ui.DialogSettingsMap)2