use of org.jkiss.dbeaver.model.data.DBDCellValue in project dbeaver by dbeaver.
the class DatabaseProducerPageExtractSettings method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = UIUtils.createComposite(parent, 1);
final DatabaseProducerSettings settings = getWizard().getPageSettings(this, DatabaseProducerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, DTMessages.data_transfer_wizard_output_group_progress, 4, GridData.FILL_HORIZONTAL, 0);
Label threadsNumLabel = UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_max_threads);
threadsNumText = new Text(generalSettings, SWT.BORDER);
threadsNumText.setToolTipText(DTUIMessages.database_producer_page_extract_settings_threads_num_text_tooltip);
threadsNumText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
threadsNumText.addModifyListener(e -> {
try {
getWizard().getSettings().setMaxJobCount(Integer.parseInt(threadsNumText.getText()));
} catch (NumberFormatException e1) {
// do nothing
}
});
if (getWizard().getSettings().getDataPipes().size() < 2) {
threadsNumLabel.setEnabled(false);
threadsNumText.setEnabled(false);
}
threadsNumText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
{
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_extract_type);
rowsExtractType = new Combo(generalSettings, SWT.DROP_DOWN | SWT.READ_ONLY);
rowsExtractType.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
rowsExtractType.setItems(DTMessages.data_transfer_wizard_output_combo_extract_type_item_single_query, DTMessages.data_transfer_wizard_output_combo_extract_type_item_by_segments);
rowsExtractType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
switch(rowsExtractType.getSelectionIndex()) {
case EXTRACT_TYPE_SEGMENTS:
settings.setExtractType(DatabaseProducerSettings.ExtractType.SEGMENTS);
break;
case EXTRACT_TYPE_SINGLE_QUERY:
settings.setExtractType(DatabaseProducerSettings.ExtractType.SINGLE_QUERY);
break;
}
updatePageCompletion();
}
});
segmentSizeLabel = UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_segment_size);
segmentSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 1, 1));
segmentSizeText = new Text(generalSettings, SWT.BORDER);
segmentSizeText.addModifyListener(e -> {
try {
settings.setSegmentSize(Integer.parseInt(segmentSizeText.getText()));
} catch (NumberFormatException e1) {
// just skip it
}
});
segmentSizeText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 1, 1));
}
newConnectionCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_new_connection, DTUIMessages.database_producer_page_extract_settings_new_connection_checkbox_tooltip, true, 4);
newConnectionCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenNewConnections(newConnectionCheckbox.getSelection());
}
});
rowCountCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_select_row_count, DTUIMessages.database_producer_page_extract_settings_row_count_checkbox_tooltip, true, 4);
rowCountCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setQueryRowCount(rowCountCheckbox.getSelection());
}
});
fetchSizeText = UIUtils.createLabelText(generalSettings, DTUIMessages.database_producer_page_extract_settings_text_fetch_size_label, "", SWT.BORDER);
fetchSizeText.setToolTipText(DTUIMessages.database_producer_page_extract_settings_text_fetch_size_tooltip);
fetchSizeText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
fetchSizeText.addModifyListener(e -> {
settings.setFetchSize(Integer.parseInt(fetchSizeText.getText()));
});
IStructuredSelection curSelection = getWizard().getCurrentSelection();
boolean hasSelection = curSelection != null && !curSelection.isEmpty() && curSelection.getFirstElement() instanceof DBDCellValue;
if (hasSelection) {
selectedColumnsOnlyCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_selected_columns_only, null, false, 4);
selectedColumnsOnlyCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSelectedColumnsOnly(selectedColumnsOnlyCheckbox.getSelection());
}
});
selectedRowsOnlyCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_selected_rows_only, null, false, 4);
selectedRowsOnlyCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSelectedRowsOnly(selectedRowsOnlyCheckbox.getSelection());
}
});
SelectionAdapter listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean selection = selectedColumnsOnlyCheckbox.getSelection() || selectedRowsOnlyCheckbox.getSelection();
newConnectionCheckbox.setEnabled(!selection);
}
};
selectedColumnsOnlyCheckbox.addSelectionListener(listener);
selectedRowsOnlyCheckbox.addSelectionListener(listener);
}
}
setControl(composite);
}
use of org.jkiss.dbeaver.model.data.DBDCellValue in project dbeaver by serge-rider.
the class DatabaseProducerPageExtractSettings method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = UIUtils.createComposite(parent, 1);
final DatabaseProducerSettings settings = getWizard().getPageSettings(this, DatabaseProducerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, DTMessages.data_transfer_wizard_output_group_progress, 4, GridData.FILL_HORIZONTAL, 0);
Label threadsNumLabel = UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_max_threads);
threadsNumText = new Text(generalSettings, SWT.BORDER);
threadsNumText.setToolTipText(DTUIMessages.database_producer_page_extract_settings_threads_num_text_tooltip);
threadsNumText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
threadsNumText.addModifyListener(e -> {
try {
getWizard().getSettings().setMaxJobCount(Integer.parseInt(threadsNumText.getText()));
} catch (NumberFormatException e1) {
// do nothing
}
});
if (getWizard().getSettings().getDataPipes().size() < 2) {
threadsNumLabel.setEnabled(false);
threadsNumText.setEnabled(false);
}
threadsNumText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
{
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_extract_type);
rowsExtractType = new Combo(generalSettings, SWT.DROP_DOWN | SWT.READ_ONLY);
rowsExtractType.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 3, 1));
rowsExtractType.setItems(DTMessages.data_transfer_wizard_output_combo_extract_type_item_single_query, DTMessages.data_transfer_wizard_output_combo_extract_type_item_by_segments);
rowsExtractType.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
switch(rowsExtractType.getSelectionIndex()) {
case EXTRACT_TYPE_SEGMENTS:
settings.setExtractType(DatabaseProducerSettings.ExtractType.SEGMENTS);
break;
case EXTRACT_TYPE_SINGLE_QUERY:
settings.setExtractType(DatabaseProducerSettings.ExtractType.SINGLE_QUERY);
break;
}
updatePageCompletion();
}
});
segmentSizeLabel = UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_segment_size);
segmentSizeLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 1, 1));
segmentSizeText = new Text(generalSettings, SWT.BORDER);
segmentSizeText.addModifyListener(e -> {
try {
settings.setSegmentSize(Integer.parseInt(segmentSizeText.getText()));
} catch (NumberFormatException e1) {
// just skip it
}
});
segmentSizeText.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 1, 1));
}
newConnectionCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_new_connection, DTUIMessages.database_producer_page_extract_settings_new_connection_checkbox_tooltip, true, 4);
newConnectionCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenNewConnections(newConnectionCheckbox.getSelection());
}
});
rowCountCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_select_row_count, DTUIMessages.database_producer_page_extract_settings_row_count_checkbox_tooltip, true, 4);
rowCountCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setQueryRowCount(rowCountCheckbox.getSelection());
}
});
fetchSizeText = UIUtils.createLabelText(generalSettings, DTUIMessages.database_producer_page_extract_settings_text_fetch_size_label, "", SWT.BORDER);
fetchSizeText.setToolTipText(DTUIMessages.database_producer_page_extract_settings_text_fetch_size_tooltip);
fetchSizeText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
fetchSizeText.addModifyListener(e -> {
settings.setFetchSize(Integer.parseInt(fetchSizeText.getText()));
});
IStructuredSelection curSelection = getWizard().getCurrentSelection();
boolean hasSelection = curSelection != null && !curSelection.isEmpty() && curSelection.getFirstElement() instanceof DBDCellValue;
if (hasSelection) {
selectedColumnsOnlyCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_selected_columns_only, null, false, 4);
selectedColumnsOnlyCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSelectedColumnsOnly(selectedColumnsOnlyCheckbox.getSelection());
}
});
selectedRowsOnlyCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_selected_rows_only, null, false, 4);
selectedRowsOnlyCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSelectedRowsOnly(selectedRowsOnlyCheckbox.getSelection());
}
});
SelectionAdapter listener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
boolean selection = selectedColumnsOnlyCheckbox.getSelection() || selectedRowsOnlyCheckbox.getSelection();
newConnectionCheckbox.setEnabled(!selection);
}
};
selectedColumnsOnlyCheckbox.addSelectionListener(listener);
selectedRowsOnlyCheckbox.addSelectionListener(listener);
}
}
setControl(composite);
}
Aggregations