use of org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizardDialog in project dbeaver by dbeaver.
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;
}
Aggregations