use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by dbeaver.
the class PrefPageSQLResources method createContents.
@Override
protected Control createContents(Composite parent) {
Composite composite = UIUtils.createComposite(parent, 1);
// Connection association
{
Composite connGroup = UIUtils.createControlGroup(composite, SQLEditorMessages.pref_page_sql_editor_group_connection_association, 2, GridData.FILL_HORIZONTAL, 0);
Label tipLabel = new Label(connGroup, SWT.WRAP);
tipLabel.setText(SQLEditorMessages.pref_page_sql_editor_checkbox_bind_connection_hint);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 2;
tipLabel.setLayoutData(gd);
bindEmbeddedReadCheck = UIUtils.createCheckbox(connGroup, SQLEditorMessages.pref_page_sql_editor_checkbox_bind_embedded_read, SQLEditorMessages.pref_page_sql_editor_checkbox_bind_embedded_read_tip, false, 2);
bindEmbeddedWriteCheck = UIUtils.createCheckbox(connGroup, SQLEditorMessages.pref_page_sql_editor_checkbox_bind_embedded_write, SQLEditorMessages.pref_page_sql_editor_checkbox_bind_embedded_write_tip, false, 2);
bindEmbeddedWriteCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
enableCommentType();
}
});
commentTypeComposite = UIUtils.createComposite(connGroup, 1);
for (SQLScriptBindingType bt : SQLScriptBindingType.values()) {
if (bt != SQLScriptBindingType.EXTERNAL) {
UIUtils.createRadioButton(commentTypeComposite, bt.getDescription(), bt, SelectionListener.widgetSelectedAdapter(selectionEvent -> {
curScriptBindingType = (SQLScriptBindingType) selectionEvent.widget.getData();
}));
}
}
}
// Resources
{
Composite scriptsGroup = UIUtils.createControlGroup(composite, SQLEditorMessages.pref_page_sql_editor_group_resources, 2, GridData.FILL_HORIZONTAL, 0);
deleteEmptyCombo = UIUtils.createLabelCombo(scriptsGroup, SQLEditorMessages.pref_page_sql_editor_checkbox_delete_empty_scripts, SWT.DROP_DOWN | SWT.READ_ONLY);
for (SQLPreferenceConstants.EmptyScriptCloseBehavior escb : SQLPreferenceConstants.EmptyScriptCloseBehavior.values()) {
deleteEmptyCombo.add(escb.getTitle());
}
deleteEmptyCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
deleteEmptyCombo.select(0);
autoFoldersCheck = UIUtils.createCheckbox(scriptsGroup, SQLEditorMessages.pref_page_sql_editor_checkbox_put_new_scripts, null, false, 2);
connectionFoldersCheck = UIUtils.createCheckbox(scriptsGroup, SQLEditorMessages.pref_page_sql_editor_checkbox_create_script_folders, null, false, 2);
scriptTitlePattern = UIUtils.createLabelText(scriptsGroup, SQLEditorMessages.pref_page_sql_editor_title_pattern, "");
ContentAssistUtils.installContentProposal(scriptTitlePattern, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(SQLEditor.VAR_CONNECTION_NAME), GeneralUtils.variablePattern(SQLEditor.VAR_DRIVER_NAME), GeneralUtils.variablePattern(SQLEditor.VAR_FILE_NAME), GeneralUtils.variablePattern(SQLEditor.VAR_FILE_EXT), GeneralUtils.variablePattern(SQLEditor.VAR_ACTIVE_DATABASE), GeneralUtils.variablePattern(SQLEditor.VAR_ACTIVE_SCHEMA)));
UIUtils.setContentProposalToolTip(scriptTitlePattern, "Output file name patterns", SQLEditor.VAR_CONNECTION_NAME, SQLEditor.VAR_DRIVER_NAME, SQLEditor.VAR_FILE_NAME, SQLEditor.VAR_FILE_EXT, SQLEditor.VAR_ACTIVE_DATABASE, SQLEditor.VAR_ACTIVE_SCHEMA);
}
performDefaults();
return composite;
}
use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by dbeaver.
the class StreamConsumerPageOutput method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = UIUtils.createComposite(parent, 1);
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, DTMessages.data_transfer_wizard_output_group_general, 5, GridData.FILL_HORIZONTAL, 0);
clipboardCheck = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_copy_to_clipboard, null, false, 5);
clipboardCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputClipboard(clipboardCheck.getSelection());
updateControlsEnablement();
updatePageCompletion();
}
});
// Output path/pattern
directoryText = DialogUtils.createOutputFolderChooser(generalSettings, null, e -> {
settings.setOutputFolder(directoryText.getText());
updatePageCompletion();
});
((GridData) directoryText.getParent().getLayoutData()).horizontalSpan = 4;
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_file_name_pattern);
fileNameText = new Text(generalSettings, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
UIUtils.setContentProposalToolTip(fileNameText, DTUIMessages.stream_consumer_page_output_tooltip_output_file_name_pattern, StreamTransferConsumer.VARIABLE_DATASOURCE, StreamTransferConsumer.VARIABLE_CATALOG, StreamTransferConsumer.VARIABLE_SCHEMA, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_INDEX, StreamTransferConsumer.VARIABLE_PROJECT, StreamTransferConsumer.VARIABLE_CONN_TYPE);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(e -> {
settings.setOutputFilePattern(fileNameText.getText());
updatePageCompletion();
});
ContentAssistUtils.installContentProposal(fileNameText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATASOURCE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CATALOG), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_SCHEMA), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_INDEX), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CONN_TYPE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT)));
{
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_encoding);
encodingCombo = UIUtils.createEncodingCombo(generalSettings, settings.getOutputEncoding());
// encodingCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 1, 1));
encodingCombo.addModifyListener(e -> {
int index = encodingCombo.getSelectionIndex();
if (index >= 0) {
settings.setOutputEncoding(encodingCombo.getItem(index));
}
updatePageCompletion();
});
timestampPattern = UIUtils.createLabelText(generalSettings, DTMessages.data_transfer_wizard_output_label_timestamp_pattern, GeneralUtils.DEFAULT_TIMESTAMP_PATTERN, SWT.BORDER);
timestampPattern.addModifyListener(e -> {
settings.setOutputTimestampPattern(timestampPattern.getText());
});
encodingBOMCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_insert_bom, DTMessages.data_transfer_wizard_output_label_insert_bom_tooltip, false, 1);
encodingBOMCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputEncodingBOM(encodingBOMCheckbox.getSelection());
}
});
}
singleFileCheck = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_use_single_file, DTMessages.data_transfer_wizard_output_label_use_single_file_tip, false, 5);
singleFileCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setUseSingleFile(singleFileCheck.getSelection());
updatePageCompletion();
}
});
compressCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_compress, null, false, 1);
compressCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setCompressResults(compressCheckbox.getSelection());
updateControlsEnablement();
}
});
{
Composite outFilesSettings = UIUtils.createComposite(generalSettings, 3);
outFilesSettings.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 5, 1));
splitFilesCheckbox = UIUtils.createCheckbox(outFilesSettings, DTMessages.data_transfer_wizard_output_checkbox_split_files, DTMessages.data_transfer_wizard_output_checkbox_split_files_tip, false, 1);
splitFilesCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSplitOutFiles(splitFilesCheckbox.getSelection());
updateControlsEnablement();
}
});
maximumFileSizeLabel = UIUtils.createControlLabel(outFilesSettings, DTUIMessages.stream_consumer_page_output_label_maximum_file_size);
maximumFileSizeText = new Text(outFilesSettings, SWT.BORDER);
maximumFileSizeText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
maximumFileSizeText.addModifyListener(e -> settings.setMaxOutFileSize(CommonUtils.toLong(maximumFileSizeText.getText())));
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = UIUtils.getFontHeight(maximumFileSizeText) * 10;
maximumFileSizeText.setLayoutData(gd);
}
}
{
Group resultsSettings = UIUtils.createControlGroup(composite, DTUIMessages.stream_consumer_page_output_label_results, 2, GridData.FILL_HORIZONTAL, 0);
showFolderCheckbox = UIUtils.createCheckbox(resultsSettings, DTMessages.data_transfer_wizard_output_checkbox_open_folder, true);
showFolderCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenFolderOnFinish(showFolderCheckbox.getSelection());
}
});
showFolderCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
execProcessCheckbox = UIUtils.createCheckbox(resultsSettings, DTUIMessages.stream_consumer_page_output_checkbox_execute_process, true);
execProcessCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setExecuteProcessOnFinish(execProcessCheckbox.getSelection());
updateControlsEnablement();
updatePageCompletion();
}
});
execProcessText = new Text(resultsSettings, SWT.BORDER);
execProcessText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
execProcessText.addModifyListener(e -> {
settings.setFinishProcessCommand(execProcessText.getText());
updatePageCompletion();
});
UIUtils.setContentProposalToolTip(execProcessText, DTUIMessages.stream_consumer_page_output_tooltip_process_command_line, StreamTransferConsumer.VARIABLE_FILE, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_PROJECT, StreamTransferConsumer.VARIABLE_CONN_TYPE);
ContentAssistUtils.installContentProposal(execProcessText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CONN_TYPE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_FILE)));
showFinalMessageCheckbox = UIUtils.createCheckbox(resultsSettings, DTUIMessages.stream_consumer_page_output_label_show_finish_message, null, getWizard().getSettings().isShowFinalMessage(), 4);
showFinalMessageCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getWizard().getSettings().setShowFinalMessage(showFinalMessageCheckbox.getSelection());
}
});
}
setControl(composite);
}
use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by dbeaver.
the class AbstractNativeToolWizardPage method createExtraArgsInput.
protected void createExtraArgsInput(Composite outputGroup) {
extraCommandArgsText = UIUtils.createLabelText(outputGroup, "Extra command args", wizard.getSettings().getExtraCommandArgs());
extraCommandArgsText.setToolTipText("Set extra command args for tool executable.");
ContentAssistUtils.installContentProposal(extraCommandArgsText, new SmartTextContentAdapter(), new StringContentProposalProvider(new String[] {}));
extraCommandArgsText.addModifyListener(e -> wizard.getSettings().setExtraCommandArgs(extraCommandArgsText.getText()));
}
use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by dbeaver.
the class TabbedFolderPageForm method createEditorControl.
/**
* Supported editors:
* Combo (lists)
* Text (strings, numbers, dates)
* Button (booleans)
*/
public Control createEditorControl(Composite parent, Object object, DBPPropertyDescriptor property, Object value, boolean readOnly) {
// List
if (!readOnly && property instanceof IPropertyValueListProvider) {
final IPropertyValueListProvider listProvider = (IPropertyValueListProvider) property;
Object[] items = listProvider.getPossibleValues(object);
if (items == null && property instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) property).hasListValueProvider()) {
// It is a list provider but it seems to be lazy and not yet initialized
items = new Object[0];
}
if (items != null) {
final String[] strings = new String[items.length];
for (int i = 0, itemsLength = items.length; i < itemsLength; i++) {
strings[i] = objectValueToString(items[i]);
}
Combo combo = UIUtils.createLabelCombo(parent, property.getDisplayName(), SWT.BORDER | SWT.DROP_DOWN | (listProvider.allowCustomValue() ? SWT.NONE : SWT.READ_ONLY) | (readOnly ? SWT.READ_ONLY : SWT.NONE));
combo.setItems(strings);
combo.setText(objectValueToString(value));
combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
if ((combo.getStyle() & SWT.READ_ONLY) == 0) {
StringContentProposalProvider proposalProvider = new StringContentProposalProvider(strings);
ContentAssistUtils.installContentProposal(combo, new ComboContentAdapter(), proposalProvider);
}
return combo;
}
}
Class<?> propType = property.getDataType();
if (isTextPropertyType(propType)) {
if (property instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) property).isMultiLine()) {
Label label = UIUtils.createControlLabel(parent, property.getDisplayName());
label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
Text editor = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP | (readOnly ? SWT.READ_ONLY : SWT.NONE));
editor.setText(objectValueToString(value));
GridData gd = new GridData(GridData.FILL_BOTH);
// Make multline editor at least two lines height
gd.heightHint = (UIUtils.getTextHeight(editor) + editor.getBorderWidth()) * 2;
editor.setLayoutData(gd);
return editor;
} else {
Text text = UIUtils.createLabelText(parent, property.getDisplayName(), objectValueToString(value), SWT.BORDER | (readOnly ? SWT.READ_ONLY : SWT.NONE) | (property instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) property).isPassword() ? SWT.PASSWORD : SWT.NONE));
text.setLayoutData(new GridData((BeanUtils.isNumericType(propType) ? GridData.HORIZONTAL_ALIGN_BEGINNING : GridData.FILL_HORIZONTAL) | GridData.VERTICAL_ALIGN_BEGINNING));
return text;
}
} else if (BeanUtils.isBooleanType(propType)) {
if (curButtonsContainer == null) {
UIUtils.createEmptyLabel(parent, 1, 1);
curButtonsContainer = new Composite(parent, SWT.NONE);
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
curButtonsContainer.setLayout(layout);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
curButtonsContainer.setLayoutData(gd);
}
Button editor = UIUtils.createCheckbox(curButtonsContainer, property.getDisplayName(), "", CommonUtils.toBoolean(value), 1);
if (readOnly) {
editor.setEnabled(false);
}
return editor;
} else if (!readOnly && propType.isEnum()) {
final Object[] enumConstants = propType.getEnumConstants();
final String[] strings = new String[enumConstants.length];
for (int i = 0, itemsLength = enumConstants.length; i < itemsLength; i++) {
strings[i] = ((Enum) enumConstants[i]).name();
}
Combo combo = UIUtils.createLabelCombo(parent, property.getDisplayName(), SWT.BORDER | SWT.DROP_DOWN | SWT.READ_ONLY | (readOnly ? SWT.READ_ONLY : SWT.NONE));
combo.setItems(strings);
combo.setText(objectValueToString(value));
combo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING | GridData.VERTICAL_ALIGN_BEGINNING));
return combo;
} else if (DBSObject.class.isAssignableFrom(propType) || (property instanceof ObjectPropertyDescriptor && ((ObjectPropertyDescriptor) property).isLinkPossible())) {
UIUtils.createControlLabel(parent, property.getDisplayName());
Composite linkPH = new Composite(parent, SWT.NONE);
{
linkPH.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
}
GridLayout layout = new GridLayout(1, false);
layout.marginHeight = 1;
linkPH.setLayout(layout);
Link link = new Link(linkPH, SWT.NONE);
link.setText(getLinktitle(value));
link.setData(value);
link.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
DBSObject object = (DBSObject) link.getData();
if (object != null) {
NavigatorHandlerObjectOpen.openEntityEditor(object);
}
}
});
link.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
return link;
} else {
return UIUtils.createLabelText(parent, property.getDisplayName(), objectValueToString(value), SWT.BORDER | SWT.READ_ONLY);
}
}
use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by serge-rider.
the class StreamConsumerPageOutput method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = UIUtils.createComposite(parent, 1);
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, DTMessages.data_transfer_wizard_output_group_general, 5, GridData.FILL_HORIZONTAL, 0);
clipboardCheck = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_copy_to_clipboard, null, false, 5);
clipboardCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputClipboard(clipboardCheck.getSelection());
updateControlsEnablement();
updatePageCompletion();
}
});
// Output path/pattern
directoryText = DialogUtils.createOutputFolderChooser(generalSettings, null, e -> {
settings.setOutputFolder(directoryText.getText());
updatePageCompletion();
});
((GridData) directoryText.getParent().getLayoutData()).horizontalSpan = 4;
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_file_name_pattern);
fileNameText = new Text(generalSettings, SWT.BORDER);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 4;
UIUtils.setContentProposalToolTip(fileNameText, DTUIMessages.stream_consumer_page_output_tooltip_output_file_name_pattern, StreamTransferConsumer.VARIABLE_DATASOURCE, StreamTransferConsumer.VARIABLE_CATALOG, StreamTransferConsumer.VARIABLE_SCHEMA, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_INDEX, StreamTransferConsumer.VARIABLE_PROJECT, StreamTransferConsumer.VARIABLE_CONN_TYPE);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(e -> {
settings.setOutputFilePattern(fileNameText.getText());
updatePageCompletion();
});
ContentAssistUtils.installContentProposal(fileNameText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATASOURCE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CATALOG), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_SCHEMA), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_INDEX), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CONN_TYPE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT)));
{
UIUtils.createControlLabel(generalSettings, DTMessages.data_transfer_wizard_output_label_encoding);
encodingCombo = UIUtils.createEncodingCombo(generalSettings, settings.getOutputEncoding());
// encodingCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 1, 1));
encodingCombo.addModifyListener(e -> {
int index = encodingCombo.getSelectionIndex();
if (index >= 0) {
settings.setOutputEncoding(encodingCombo.getItem(index));
}
updatePageCompletion();
});
timestampPattern = UIUtils.createLabelText(generalSettings, DTMessages.data_transfer_wizard_output_label_timestamp_pattern, GeneralUtils.DEFAULT_TIMESTAMP_PATTERN, SWT.BORDER);
timestampPattern.addModifyListener(e -> {
settings.setOutputTimestampPattern(timestampPattern.getText());
});
encodingBOMCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_insert_bom, DTMessages.data_transfer_wizard_output_label_insert_bom_tooltip, false, 1);
encodingBOMCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputEncodingBOM(encodingBOMCheckbox.getSelection());
}
});
}
singleFileCheck = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_label_use_single_file, DTMessages.data_transfer_wizard_output_label_use_single_file_tip, false, 5);
singleFileCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setUseSingleFile(singleFileCheck.getSelection());
updatePageCompletion();
}
});
compressCheckbox = UIUtils.createCheckbox(generalSettings, DTMessages.data_transfer_wizard_output_checkbox_compress, null, false, 1);
compressCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setCompressResults(compressCheckbox.getSelection());
updateControlsEnablement();
}
});
{
Composite outFilesSettings = UIUtils.createComposite(generalSettings, 3);
outFilesSettings.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 5, 1));
splitFilesCheckbox = UIUtils.createCheckbox(outFilesSettings, DTMessages.data_transfer_wizard_output_checkbox_split_files, DTMessages.data_transfer_wizard_output_checkbox_split_files_tip, false, 1);
splitFilesCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setSplitOutFiles(splitFilesCheckbox.getSelection());
updateControlsEnablement();
}
});
maximumFileSizeLabel = UIUtils.createControlLabel(outFilesSettings, DTUIMessages.stream_consumer_page_output_label_maximum_file_size);
maximumFileSizeText = new Text(outFilesSettings, SWT.BORDER);
maximumFileSizeText.addVerifyListener(UIUtils.getIntegerVerifyListener(Locale.ENGLISH));
maximumFileSizeText.addModifyListener(e -> settings.setMaxOutFileSize(CommonUtils.toLong(maximumFileSizeText.getText())));
gd = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
gd.widthHint = UIUtils.getFontHeight(maximumFileSizeText) * 10;
maximumFileSizeText.setLayoutData(gd);
}
}
{
Group resultsSettings = UIUtils.createControlGroup(composite, DTUIMessages.stream_consumer_page_output_label_results, 2, GridData.FILL_HORIZONTAL, 0);
showFolderCheckbox = UIUtils.createCheckbox(resultsSettings, DTMessages.data_transfer_wizard_output_checkbox_open_folder, true);
showFolderCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOpenFolderOnFinish(showFolderCheckbox.getSelection());
}
});
showFolderCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
execProcessCheckbox = UIUtils.createCheckbox(resultsSettings, DTUIMessages.stream_consumer_page_output_checkbox_execute_process, true);
execProcessCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setExecuteProcessOnFinish(execProcessCheckbox.getSelection());
updateControlsEnablement();
updatePageCompletion();
}
});
execProcessText = new Text(resultsSettings, SWT.BORDER);
execProcessText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
execProcessText.addModifyListener(e -> {
settings.setFinishProcessCommand(execProcessText.getText());
updatePageCompletion();
});
UIUtils.setContentProposalToolTip(execProcessText, DTUIMessages.stream_consumer_page_output_tooltip_process_command_line, StreamTransferConsumer.VARIABLE_FILE, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_PROJECT, StreamTransferConsumer.VARIABLE_CONN_TYPE);
ContentAssistUtils.installContentProposal(execProcessText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_CONN_TYPE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_FILE)));
showFinalMessageCheckbox = UIUtils.createCheckbox(resultsSettings, DTUIMessages.stream_consumer_page_output_label_show_finish_message, null, getWizard().getSettings().isShowFinalMessage(), 4);
showFinalMessageCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
getWizard().getSettings().setShowFinalMessage(showFinalMessageCheckbox.getSelection());
}
});
}
setControl(composite);
}
Aggregations