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;
}
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;
}
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);
}
}
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);
}
}
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;
}
Aggregations