use of org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard in project dbeaver by serge-rider.
the class NativeToolConfigPanel method createControl.
@Override
public void createControl(Composite parent, TaskConfigurationWizard wizard, Runnable propertyChangeListener) {
ieWizard = (AbstractNativeToolWizard) wizard;
{
Group databasesGroup = UIUtils.createControlGroup(parent, TaskNativeUIMessages.tools_wizard_database_group_title, 1, GridData.FILL_BOTH, 0);
selectorPanel = new DatabaseObjectsSelectorPanel(databasesGroup, false, this.runnableContext) {
@Override
protected boolean isDatabaseFolderVisible(DBNDatabaseFolder folder) {
return folder.getChildrenClass() == objectClass;
}
@Override
protected boolean isDatabaseObjectVisible(DBSObject obj) {
return objectClass.isInstance(obj);
}
@Override
protected void onSelectionChange(Object element) {
selectedObject = element instanceof DBSWrapper && objectClass.isInstance(((DBSWrapper) element).getObject()) ? objectClass.cast(((DBSWrapper) element).getObject()) : null;
AbstractNativeToolSettings settings = ieWizard.getSettings();
List<DBSObject> databaseObjects = settings.getDatabaseObjects();
databaseObjects.clear();
if (selectedObject != null) {
databaseObjects.add(selectedObject);
}
if (settings instanceof AbstractImportExportSettings) {
((AbstractImportExportSettings) settings).fillExportObjectsFromInput();
}
updateHomeSelector();
propertyChangeListener.run();
}
@Override
protected boolean isFolderVisible(DBNLocalFolder folder) {
for (DBNDataSource ds : folder.getNestedDataSources()) {
if (isDataSourceVisible(ds)) {
return true;
}
}
return false;
}
@Override
protected boolean isDataSourceVisible(DBNDataSource dataSource) {
try {
return providerClass.isInstance(dataSource.getDataSourceContainer().getDriver().getDataSourceProvider());
} catch (Exception e) {
log.debug(e);
return false;
}
}
};
}
{
Composite clientGroup = UIUtils.createControlGroup((Composite) parent, TaskNativeUIMessages.tools_wizard_client_group_title, 1, GridData.FILL_HORIZONTAL, 0);
homesSelector = new ClientHomesSelector(clientGroup, TaskNativeUIMessages.tools_wizard_client_group_client);
homesSelector.addSelectionChangedListener(event -> propertyChangeListener.run());
homesSelector.getPanel().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
}
use of org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard 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.TaskConfigurationWizard in project dbeaver by dbeaver.
the class NativeToolConfigPanel method createControl.
@Override
public void createControl(Composite parent, TaskConfigurationWizard wizard, Runnable propertyChangeListener) {
ieWizard = (AbstractNativeToolWizard) wizard;
{
Group databasesGroup = UIUtils.createControlGroup(parent, TaskNativeUIMessages.tools_wizard_database_group_title, 1, GridData.FILL_BOTH, 0);
selectorPanel = new DatabaseObjectsSelectorPanel(databasesGroup, false, this.runnableContext) {
@Override
protected boolean isDatabaseFolderVisible(DBNDatabaseFolder folder) {
return folder.getChildrenClass() == objectClass;
}
@Override
protected boolean isDatabaseObjectVisible(DBSObject obj) {
return objectClass.isInstance(obj);
}
@Override
protected void onSelectionChange(Object element) {
selectedObject = element instanceof DBSWrapper && objectClass.isInstance(((DBSWrapper) element).getObject()) ? objectClass.cast(((DBSWrapper) element).getObject()) : null;
AbstractNativeToolSettings settings = ieWizard.getSettings();
List<DBSObject> databaseObjects = settings.getDatabaseObjects();
databaseObjects.clear();
if (selectedObject != null) {
databaseObjects.add(selectedObject);
}
if (settings instanceof AbstractImportExportSettings) {
((AbstractImportExportSettings) settings).fillExportObjectsFromInput();
}
updateHomeSelector();
propertyChangeListener.run();
}
@Override
protected boolean isFolderVisible(DBNLocalFolder folder) {
for (DBNDataSource ds : folder.getNestedDataSources()) {
if (isDataSourceVisible(ds)) {
return true;
}
}
return false;
}
@Override
protected boolean isDataSourceVisible(DBNDataSource dataSource) {
try {
return providerClass.isInstance(dataSource.getDataSourceContainer().getDriver().getDataSourceProvider());
} catch (Exception e) {
log.debug(e);
return false;
}
}
};
}
{
Composite clientGroup = UIUtils.createControlGroup((Composite) parent, TaskNativeUIMessages.tools_wizard_client_group_title, 1, GridData.FILL_HORIZONTAL, 0);
homesSelector = new ClientHomesSelector(clientGroup, TaskNativeUIMessages.tools_wizard_client_group_client);
homesSelector.addSelectionChangedListener(event -> propertyChangeListener.run());
homesSelector.getPanel().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
}
use of org.jkiss.dbeaver.tasks.ui.wizard.TaskConfigurationWizard 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