use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class PostgreBackupWizardPageSettings method createControl.
@Override
public void createControl(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1);
SelectionListener changeListener = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
updateState();
}
};
Group formatGroup = UIUtils.createControlGroup(composite, PostgreMessages.wizard_backup_page_setting_group_setting, 2, GridData.FILL_HORIZONTAL, 0);
formatCombo = UIUtils.createLabelCombo(formatGroup, PostgreMessages.wizard_backup_page_setting_label_format, SWT.DROP_DOWN | SWT.READ_ONLY);
formatCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
for (PostgreBackupWizard.ExportFormat format : PostgreBackupWizard.ExportFormat.values()) {
formatCombo.add(format.getTitle());
}
formatCombo.select(wizard.format.ordinal());
formatCombo.addSelectionListener(changeListener);
compressCombo = UIUtils.createLabelCombo(formatGroup, PostgreMessages.wizard_backup_page_setting_label_compression, SWT.DROP_DOWN | SWT.READ_ONLY);
compressCombo.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
compressCombo.add("");
for (int i = 0; i <= 9; i++) {
compressCombo.add(String.valueOf(i));
}
compressCombo.select(0);
compressCombo.addSelectionListener(changeListener);
UIUtils.createControlLabel(formatGroup, PostgreMessages.wizard_backup_page_setting_label_encoding);
encodingCombo = UIUtils.createEncodingCombo(formatGroup, null);
encodingCombo.addSelectionListener(changeListener);
useInsertsCheck = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_backup_page_setting_checkbox_use_insert, null, false, 2);
useInsertsCheck.addSelectionListener(changeListener);
noPrivilegesCheck = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_backup_page_setting_checkbox_no_privileges, null, false, 2);
noPrivilegesCheck.addSelectionListener(changeListener);
noOwnerCheck = UIUtils.createCheckbox(formatGroup, PostgreMessages.wizard_backup_page_setting_checkbox_no_owner, null, false, 2);
noOwnerCheck.addSelectionListener(changeListener);
Group outputGroup = UIUtils.createControlGroup(composite, PostgreMessages.wizard_backup_page_setting_group_output, 2, GridData.FILL_HORIZONTAL, 0);
outputFolderText = DialogUtils.createOutputFolderChooser(outputGroup, PostgreMessages.wizard_backup_page_setting_label_output_folder, e -> updateState());
outputFileText = UIUtils.createLabelText(outputGroup, PostgreMessages.wizard_backup_page_setting_label_file_name_pattern, wizard.getOutputFilePattern());
UIUtils.setContentProposalToolTip(outputFileText, PostgreMessages.wizard_backup_page_setting_label_file_name_pattern_output, AbstractImportExportWizard.VARIABLE_HOST, AbstractImportExportWizard.VARIABLE_DATABASE, AbstractImportExportWizard.VARIABLE_TABLE, AbstractImportExportWizard.VARIABLE_DATE, AbstractImportExportWizard.VARIABLE_TIMESTAMP);
UIUtils.installContentProposal(outputFileText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(AbstractImportExportWizard.VARIABLE_HOST), GeneralUtils.variablePattern(AbstractImportExportWizard.VARIABLE_DATABASE), GeneralUtils.variablePattern(AbstractImportExportWizard.VARIABLE_TABLE), GeneralUtils.variablePattern(AbstractImportExportWizard.VARIABLE_DATE), GeneralUtils.variablePattern(AbstractImportExportWizard.VARIABLE_TIMESTAMP) }));
outputFileText.addModifyListener(e -> wizard.setOutputFilePattern(outputFileText.getText()));
if (wizard.getOutputFolder() != null) {
outputFolderText.setText(wizard.getOutputFolder().getAbsolutePath());
}
createExtraArgsInput(outputGroup);
createSecurityGroup(composite);
setControl(composite);
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class StreamConsumerPageOutput method createControl.
@Override
public void createControl(Composite parent) {
initializeDialogUnits(parent);
Composite composite = new Composite(parent, SWT.NULL);
GridLayout gl = new GridLayout();
gl.marginHeight = 0;
gl.marginWidth = 0;
composite.setLayout(gl);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
final StreamConsumerSettings settings = getWizard().getPageSettings(this, StreamConsumerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, CoreMessages.data_transfer_wizard_output_group_general, 5, GridData.FILL_HORIZONTAL, 0);
clipboardCheck = UIUtils.createLabelCheckbox(generalSettings, "Copy to clipboard", false);
clipboardCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false, 4, 1));
clipboardCheck.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputClipboard(clipboardCheck.getSelection());
toggleClipboardOutput();
updatePageCompletion();
}
});
directoryText = DialogUtils.createOutputFolderChooser(generalSettings, null, e -> {
settings.setOutputFolder(directoryText.getText());
updatePageCompletion();
});
((GridData) directoryText.getParent().getLayoutData()).horizontalSpan = 4;
UIUtils.createControlLabel(generalSettings, CoreMessages.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, "Output file name pattern", StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_PROJECT);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(e -> {
settings.setOutputFilePattern(fileNameText.getText());
updatePageCompletion();
});
UIUtils.installContentProposal(fileNameText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT) }));
{
UIUtils.createControlLabel(generalSettings, CoreMessages.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();
});
encodingBOMLabel = UIUtils.createControlLabel(generalSettings, CoreMessages.data_transfer_wizard_output_label_insert_bom);
encodingBOMLabel.setToolTipText(CoreMessages.data_transfer_wizard_output_label_insert_bom_tooltip);
encodingBOMCheckbox = new Button(generalSettings, SWT.CHECK);
encodingBOMCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 1, 1));
encodingBOMCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setOutputEncodingBOM(encodingBOMCheckbox.getSelection());
}
});
new Label(generalSettings, SWT.NONE);
}
compressCheckbox = UIUtils.createLabelCheckbox(generalSettings, CoreMessages.data_transfer_wizard_output_checkbox_compress, false);
compressCheckbox.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, true, false, 4, 1));
compressCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setCompressResults(compressCheckbox.getSelection());
}
});
}
{
Group resultsSettings = UIUtils.createControlGroup(composite, "Results", 2, GridData.FILL_HORIZONTAL, 0);
showFolderCheckbox = UIUtils.createCheckbox(resultsSettings, CoreMessages.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, "Execute process on finish", true);
execProcessCheckbox.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
settings.setExecuteProcessOnFinish(execProcessCheckbox.getSelection());
toggleExecProcessControls();
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, "Process command line", StreamTransferConsumer.VARIABLE_FILE, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, StreamTransferConsumer.VARIABLE_DATE, StreamTransferConsumer.VARIABLE_PROJECT);
UIUtils.installContentProposal(execProcessText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_DATE), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_PROJECT), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_FILE) }));
}
setControl(composite);
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class AbstractToolWizardPage method createExtraArgsInput.
protected void createExtraArgsInput(Composite outputGroup) {
extraCommandArgsText = UIUtils.createLabelText(outputGroup, "Extra command args", wizard.getExtraCommandArgs());
extraCommandArgsText.setToolTipText("Set extra command args for tool executable.");
UIUtils.installContentProposal(extraCommandArgsText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] {}));
extraCommandArgsText.addModifyListener(e -> wizard.setExtraCommandArgs(extraCommandArgsText.getText()));
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class PrefPageDatabaseGeneral method createContents.
@Override
protected Control createContents(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
{
Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, null, false, 2);
// automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
}
{
Group groupLanguage = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_language, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
workspaceLanguage = UIUtils.createLabelCombo(groupLanguage, CoreMessages.pref_page_ui_general_combo_language, CoreMessages.pref_page_ui_general_combo_language_tip, SWT.READ_ONLY | SWT.DROP_DOWN);
workspaceLanguage.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
List<PlatformLanguageDescriptor> languages = PlatformLanguageRegistry.getInstance().getLanguages();
DBPPlatformLanguage pLanguage = DBeaverCore.getInstance().getLanguage();
for (int i = 0; i < languages.size(); i++) {
PlatformLanguageDescriptor lang = languages.get(i);
workspaceLanguage.add(lang.getLabel());
if (CommonUtils.equalObjects(pLanguage, lang)) {
workspaceLanguage.select(i);
}
}
if (workspaceLanguage.getSelectionIndex() < 0) {
workspaceLanguage.select(0);
}
Label tipLabel = UIUtils.createLabel(groupLanguage, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
// Agent settings
{
Group agentGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_task_bar, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
longOperationsCheck = UIUtils.createCheckbox(agentGroup, CoreMessages.pref_page_ui_general_label_enable_long_operations, CoreMessages.pref_page_ui_general_label_enable_long_operations_tip, false, 2);
longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, CoreMessages.pref_page_ui_general_label_long_operation_timeout, 0, 0, Integer.MAX_VALUE);
if (RuntimeUtils.isPlatformMacOS()) {
ControlEnableState.disable(agentGroup);
}
}
/*
{
// Resources
Group groupResources = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_resources, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
UIUtils.createControlLabel(groupResources, CoreMessages.pref_page_ui_general_label_default_resource_encoding);
defaultResourceEncoding = UIUtils.createEncodingCombo(groupResources, GeneralUtils.DEFAULT_ENCODING);
defaultResourceEncoding.setToolTipText(CoreMessages.pref_page_ui_general_label_set_default_resource_encoding_tip);
}
*/
{
// Logs
Group groupLogs = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_debug_logs, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
logsDebugEnabled = UIUtils.createCheckbox(groupLogs, CoreMessages.pref_page_ui_general_label_enable_debug_logs, CoreMessages.pref_page_ui_general_label_enable_debug_logs_tip, false, 2);
UIUtils.createControlLabel(groupLogs, CoreMessages.pref_page_ui_general_label_log_file_location);
logsDebugLocation = new TextWithOpenFile(groupLogs, CoreMessages.pref_page_ui_general_label_open_file_text, new String[] { "*.log", "*.txt" });
UIUtils.installContentProposal(logsDebugLocation.getTextControl(), new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(SystemVariablesResolver.VAR_WORKSPACE), GeneralUtils.variablePattern(SystemVariablesResolver.VAR_HOME) }));
logsDebugLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label tipLabel = UIUtils.createLabel(groupLogs, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
{
// Link to secure storage config
new PreferenceLinkArea(composite, SWT.NONE, PrefPageEntityEditor.PAGE_ID, "<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
new PreferenceLinkArea(composite, SWT.NONE, PrefPageSQLEditor.PAGE_ID, "<a>''{0}''</a>" + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
}
performDefaults();
return composite;
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project yamcs-studio by yamcs.
the class AutoCompleteWidget method enableContentProposal.
private void enableContentProposal() {
if (control instanceof Combo) {
Combo combo = (Combo) control;
provider = new AutoCompleteProposalProvider(type);
adapter = new ContentProposalAdapter(combo, new ComboContentAdapter(), provider, getActivationKeystroke(), getAutoactivationChars());
} else if (control instanceof Text) {
Text text = (Text) control;
provider = new AutoCompleteProposalProvider(type);
adapter = new ContentProposalAdapter(text, new TextContentAdapter(), provider, getActivationKeystroke(), getAutoactivationChars());
}
}
Aggregations