use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by serge-rider.
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, new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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_PROJECT);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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_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(new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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();
}
});
execProcessText = new Text(resultsSettings, SWT.BORDER);
execProcessText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
execProcessText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setFinishProcessCommand(execProcessText.getText());
updatePageCompletion();
}
});
UIUtils.setContentProposalToolTip(execProcessText, "Process command line", StreamTransferConsumer.VARIABLE_FILE, StreamTransferConsumer.VARIABLE_TABLE, StreamTransferConsumer.VARIABLE_TIMESTAMP, 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_PROJECT), GeneralUtils.variablePattern(StreamTransferConsumer.VARIABLE_FILE) }));
}
setControl(composite);
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project hale by halestudio.
the class TextSourceListParameterPage method configure.
/**
* @see eu.esdihumboldt.hale.ui.functions.core.SourceListParameterPage#configure(java.lang.Object)
*/
@Override
protected void configure(Text textField) {
// Add content assist for variables
final ControlDecoration infoDeco = new ControlDecoration(textField, SWT.TOP | SWT.LEFT);
infoDeco.setDescriptionText("Type Ctrl+Space for content assistance");
infoDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
infoDeco.setMarginWidth(2);
ContentProposalAdapter adapter = new ContentProposalAdapter(textField, new TextContentAdapter(), this, ProjectVariablesContentProposalProvider.CTRL_SPACE, /* new char[] { '{' } */
null);
adapter.setAutoActivationDelay(0);
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project hale by halestudio.
the class SequentialIDParameterPage method createContent.
/**
* @see HaleWizardPage#createContent(Composite)
*/
@Override
protected void createContent(Composite page) {
page.setLayout(GridLayoutFactory.swtDefaults().numColumns(2).spacing(10, 8).create());
Label label;
GridDataFactory labelLayout = GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER);
GridDataFactory controlLayout = GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false);
// select sequence type
if (getParametersToHandle().containsKey(PARAM_SEQUENCE)) {
label = new Label(page, SWT.NONE);
label.setText("Sequence");
labelLayout.applyTo(label);
sequence = new ComboViewer(page);
sequence.setContentProvider(EnumContentProvider.getInstance());
sequence.setLabelProvider(new LabelProvider() {
@Override
public String getText(Object element) {
if (element instanceof Sequence) {
switch((Sequence) element) {
case overall:
return "Over all sequential IDs";
case type:
return "Per target instance type";
}
}
return super.getText(element);
}
});
sequence.setInput(Sequence.class);
controlLayout.applyTo(sequence.getControl());
Sequence initialValue = Sequence.valueOf(getOptionalInitialValue(PARAM_SEQUENCE, new ParameterValue(Sequence.type.name())).as(String.class));
sequence.setSelection(new StructuredSelection(initialValue));
sequence.addSelectionChangedListener(new ISelectionChangedListener() {
@Override
public void selectionChanged(SelectionChangedEvent event) {
updateStatus();
}
});
}
// specify prefix
if (getParametersToHandle().containsKey(PARAM_PREFIX)) {
label = new Label(page, SWT.NONE);
label.setText("Prefix");
labelLayout.applyTo(label);
prefix = new Text(page, SWT.SINGLE | SWT.BORDER);
controlLayout.applyTo(prefix);
prefix.setText(getOptionalInitialValue(PARAM_PREFIX, new ParameterValue("")).as(String.class));
prefix.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateStatus();
}
});
ContentProposalAdapter adapter = new ContentProposalAdapter(prefix, new TextContentAdapter(), contentProposalProvider, ProjectVariablesContentProposalProvider.CTRL_SPACE, new char[] { '{' });
adapter.setAutoActivationDelay(0);
final ControlDecoration infoDeco = new ControlDecoration(prefix, SWT.TOP | SWT.LEFT);
infoDeco.setDescriptionText("Type Ctrl+Space for project variable content assistance");
infoDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
infoDeco.setMarginWidth(2);
}
// specify suffix
if (getParametersToHandle().containsKey(PARAM_SUFFIX)) {
label = new Label(page, SWT.NONE);
label.setText("Suffix");
labelLayout.applyTo(label);
suffix = new Text(page, SWT.SINGLE | SWT.BORDER);
controlLayout.applyTo(suffix);
suffix.setText(getOptionalInitialValue(PARAM_SUFFIX, new ParameterValue("")).as(String.class));
suffix.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
updateStatus();
}
});
ContentProposalAdapter adapter = new ContentProposalAdapter(suffix, new TextContentAdapter(), contentProposalProvider, ProjectVariablesContentProposalProvider.CTRL_SPACE, new char[] { '{' });
adapter.setAutoActivationDelay(0);
final ControlDecoration infoDeco = new ControlDecoration(suffix, SWT.TOP | SWT.LEFT);
infoDeco.setDescriptionText("Type Ctrl+Space for project variable content assistance");
infoDeco.setImage(FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage());
infoDeco.setShowOnlyOnFocus(true);
}
// show example
if (sequence != null && prefix != null && suffix != null) {
label = new Label(page, SWT.NONE);
label.setText("Example");
labelLayout.applyTo(label);
example = new Label(page, SWT.NONE);
example.setFont(JFaceResources.getTextFont());
controlLayout.applyTo(example);
// error decoration
exampleDecoration = new ControlDecoration(example, SWT.LEFT | SWT.TOP, page);
FieldDecoration fieldDecoration = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR);
exampleDecoration.setImage(fieldDecoration.getImage());
exampleDecoration.hide();
}
updateStatus();
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class StreamPOIConsumerPageOutput 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 StreamPOIConsumerSettings settings = getWizard().getPageSettings(this, StreamPOIConsumerSettings.class);
{
Group generalSettings = UIUtils.createControlGroup(composite, CoreMessages.data_transfer_wizard_output_group_general, 5, GridData.FILL_HORIZONTAL, 0);
directoryText = DialogUtils.createOutputFolderChooser(generalSettings, null, new ModifyListener() {
@Override
public void modifyText(ModifyEvent 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", StreamPOITransferConsumer.VARIABLE_TABLE, StreamPOITransferConsumer.VARIABLE_TIMESTAMP, StreamPOITransferConsumer.VARIABLE_PROJECT);
fileNameText.setLayoutData(gd);
fileNameText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setOutputFilePattern(fileNameText.getText());
updatePageCompletion();
}
});
UIUtils.installContentProposal(fileNameText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_PROJECT) }));
{
new Label(generalSettings, SWT.NONE);
}
}
{
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(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
settings.setFinishProcessCommand(execProcessText.getText());
updatePageCompletion();
}
});
UIUtils.setContentProposalToolTip(execProcessText, "Process command line", StreamPOITransferConsumer.VARIABLE_FILE, StreamPOITransferConsumer.VARIABLE_TABLE, StreamPOITransferConsumer.VARIABLE_TIMESTAMP, StreamPOITransferConsumer.VARIABLE_PROJECT);
UIUtils.installContentProposal(execProcessText, new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_TABLE), GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_PROJECT), GeneralUtils.variablePattern(StreamPOITransferConsumer.VARIABLE_FILE) }));
}
setControl(composite);
}
use of org.eclipse.jface.fieldassist.TextContentAdapter in project dbeaver by dbeaver.
the class MySQLExportWizardPageSettings 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 methodGroup = UIUtils.createControlGroup(composite, MySQLMessages.tools_db_export_wizard_page_settings_group_exe_method, 1, GridData.FILL_HORIZONTAL, 0);
methodCombo = new Combo(methodGroup, SWT.DROP_DOWN | SWT.READ_ONLY);
methodCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
methodCombo.add(MySQLMessages.tools_db_export_wizard_page_settings_combo_item_online_backup);
methodCombo.add(MySQLMessages.tools_db_export_wizard_page_settings_combo_item_lock_tables);
methodCombo.add(MySQLMessages.tools_db_export_wizard_page_settings_combo_item_normal);
methodCombo.select(wizard.method.ordinal());
methodCombo.addSelectionListener(changeListener);
Group settingsGroup = UIUtils.createControlGroup(composite, MySQLMessages.tools_db_export_wizard_page_settings_group_settings, 3, GridData.FILL_HORIZONTAL, 0);
noCreateStatementsCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_no_create, wizard.noCreateStatements);
noCreateStatementsCheck.addSelectionListener(changeListener);
addDropStatementsCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_add_drop, wizard.addDropStatements);
addDropStatementsCheck.addSelectionListener(changeListener);
disableKeysCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_disable_keys, wizard.disableKeys);
disableKeysCheck.addSelectionListener(changeListener);
extendedInsertsCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_ext_inserts, wizard.extendedInserts);
extendedInsertsCheck.addSelectionListener(changeListener);
dumpEventsCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_dump_events, wizard.dumpEvents);
dumpEventsCheck.addSelectionListener(changeListener);
commentsCheck = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_addnl_comments, wizard.comments);
commentsCheck.addSelectionListener(changeListener);
removeDefiner = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_remove_definer, wizard.removeDefiner);
removeDefiner.addSelectionListener(changeListener);
binaryInHex = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_binary_hex, wizard.binariesInHex);
binaryInHex.addSelectionListener(changeListener);
noData = UIUtils.createCheckbox(settingsGroup, MySQLMessages.tools_db_export_wizard_page_settings_checkbox_no_data, wizard.noData);
noData.addSelectionListener(changeListener);
Group outputGroup = UIUtils.createControlGroup(composite, MySQLMessages.tools_db_export_wizard_page_settings_group_output, 2, GridData.FILL_HORIZONTAL, 0);
outputFolderText = DialogUtils.createOutputFolderChooser(outputGroup, MySQLMessages.tools_db_export_wizard_page_settings_label_out_text, e -> updateState());
outputFileText = UIUtils.createLabelText(outputGroup, "File name pattern", wizard.getOutputFilePattern());
UIUtils.setContentProposalToolTip(outputFileText, "Output file name pattern", 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()));
createExtraArgsInput(outputGroup);
if (wizard.getOutputFolder() != null) {
outputFolderText.setText(wizard.getOutputFolder().getAbsolutePath());
}
createSecurityGroup(composite);
setControl(composite);
}
Aggregations