use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DataTransferPageSettings method createSettingsPages.
private void createSettingsPages(Composite composite) {
DataTransferSettings dtSettings = getWizard().getSettings();
{
DataTransferPipe dataPipe = dtSettings.getDataPipes().get(0);
StringBuilder title = new StringBuilder();
title.append(DTMessages.data_transfer_wizard_settings_title).append(" (").append(dtSettings.getProducer().getName()).append(" to ").append(dtSettings.getConsumer().getName());
if (dtSettings.getProcessor() != null) {
title.append(", ").append(dtSettings.getProcessor().getName());
}
title.append(")");
setTitle(title.toString());
producerSettingsPage = getSettingsPage(dataPipe.getProducer());
consumerSettingsPage = getSettingsPage(dataPipe.getConsumer());
}
Composite settingsComposite = composite;
if (producerSettingsPage != null && consumerSettingsPage != null) {
SashForm sash = new SashForm(composite, SWT.HORIZONTAL);
sash.setLayoutData(new GridData(GridData.FILL_BOTH));
settingsComposite = sash;
}
if (producerSettingsPage != null) {
producerSettingsPage.setWizard(getWizard());
Composite producerGroup = UIUtils.createPlaceholder(settingsComposite, 1);
UIUtils.createInfoLabel(producerGroup, producerSettingsPage.getTitle());
Composite settingPanel = new Composite(producerGroup, SWT.NONE);
settingPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
settingPanel.setLayout(new FillLayout());
producerSettingsPage.createControl(settingPanel);
if (producerSettingsPage instanceof ActiveWizardPage) {
((ActiveWizardPage) producerSettingsPage).activatePage();
}
}
if (consumerSettingsPage != null) {
consumerSettingsPage.setWizard(getWizard());
Composite consumerGroup = UIUtils.createPlaceholder(settingsComposite, 1);
UIUtils.createInfoLabel(consumerGroup, consumerSettingsPage.getTitle());
Composite settingPanel = new Composite(consumerGroup, SWT.NONE);
settingPanel.setLayoutData(new GridData(GridData.FILL_BOTH));
settingPanel.setLayout(new FillLayout());
consumerSettingsPage.createControl(settingPanel);
if (consumerSettingsPage instanceof ActiveWizardPage) {
((ActiveWizardPage) consumerSettingsPage).activatePage();
}
}
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DTTaskHandlerTransfer method executeTask.
@Override
public void executeTask(@NotNull DBRRunnableContext runnableContext, @NotNull DBTTask task, @NotNull Locale locale, @NotNull Log log, @NotNull PrintStream logStream, @NotNull DBTTaskExecutionListener listener) throws DBException {
DataTransferSettings[] settings = new DataTransferSettings[1];
try {
runnableContext.run(true, true, monitor -> {
settings[0] = new DataTransferSettings(monitor, task, log, Collections.emptyMap(), new DataTransferState());
});
} catch (InvocationTargetException e) {
throw new DBException("Error loading task settings", e.getTargetException());
} catch (InterruptedException e) {
return;
}
executeWithSettings(runnableContext, task, locale, log, listener, settings[0]);
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DatabaseConsumerPageMapping method showPreview.
private void showPreview(DatabaseMappingContainer mappingContainer) {
DataTransferPipe pipe = getPipe(mappingContainer);
DataTransferSettings dtSettings = getWizard().getSettings();
PreviewMappingDialog previewDialog = new PreviewMappingDialog(getShell(), pipe, mappingContainer, dtSettings);
previewDialog.open();
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DatabaseProducerPageInputObjects method activatePage.
@Override
public void activatePage() {
// final DatabaseProducerSettings settings = getWizard().getPageSettings(this, DatabaseProducerSettings.class);
DataTransferSettings settings = getWizard().getSettings();
mappingTable.removeAll();
for (DataTransferPipe pipe : settings.getDataPipes()) {
TableItem item = new TableItem(mappingTable, SWT.NONE);
item.setData(pipe);
updateItemData(item, pipe);
}
updatePageCompletion();
}
use of org.jkiss.dbeaver.tools.transfer.DataTransferSettings in project dbeaver by dbeaver.
the class DatabaseProducerPageInputObjects method chooseEntity.
protected boolean chooseEntity(DataTransferPipe pipe) {
DataTransferSettings settings = getWizard().getSettings();
final DBNModel navigatorModel = DBWorkbench.getPlatform().getNavigatorModel();
final DBNNode rootNode = DBWorkbench.getPlatform().getWorkspace().getProjects().size() == 1 ? navigatorModel.getRoot().getProjectNode(DBWorkbench.getPlatform().getWorkspace().getActiveProject()) : navigatorModel.getRoot();
boolean chooseConsumer = settings.isConsumerOptional();
DBNNode node = DBWorkbench.getPlatformUI().selectObject(UIUtils.getActiveWorkbenchShell(), chooseConsumer ? NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_target, pipe.getProducer().getDatabaseObject().getName()) : NLS.bind(DTUIMessages.database_producer_page_input_objects_node_select_source, pipe.getConsumer().getObjectName()), rootNode, lastSelection, new Class[] { DBSObjectContainer.class, DBSDataContainer.class }, new Class[] { chooseConsumer ? DBSDataManipulator.class : DBSDataContainer.class }, null);
if (node instanceof DBNDatabaseNode) {
lastSelection = (DBNDatabaseNode) node;
DBSObject object = ((DBNDatabaseNode) node).getObject();
if (chooseConsumer) {
if (object instanceof DBSDataManipulator) {
pipe.setConsumer(new DatabaseTransferConsumer((DBSDataManipulator) object));
}
} else {
if (object instanceof DBSDataContainer) {
pipe.setProducer(new DatabaseTransferProducer((DBSDataContainer) object));
}
}
return true;
}
return false;
}
Aggregations