Search in sources :

Example 1 with StringContentProposalProvider

use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by serge-rider.

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;
}
Also used : SQLScriptBindingType(org.jkiss.dbeaver.ui.editors.sql.SQLScriptBindingType) SmartTextContentAdapter(org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 2 with StringContentProposalProvider

use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by serge-rider.

the class SQLExternalFormatterConfigurationPage method createFormatSettings.

@Override
protected Composite createFormatSettings(Composite parent) {
    Group settingsGroup = UIUtils.createControlGroup(parent, "Settings", 4, GridData.FILL_HORIZONTAL, 0);
    externalCmdText = UIUtils.createLabelText(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_command_line, "");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    externalCmdText.setLayoutData(gd);
    ContentAssistUtils.installContentProposal(externalCmdText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(SQLFormatterExternal.VAR_FILE)));
    UIUtils.setContentProposalToolTip(externalCmdText, SQLEditorMessages.pref_page_sql_format_label_external_set_content_tool_tip, SQLFormatterExternal.VAR_FILE);
    externalUseFile = UIUtils.createCheckbox(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_use_temp_file, SQLEditorMessages.pref_page_sql_format_label_external_use_temp_file_tip + " " + GeneralUtils.variablePattern(SQLFormatterExternal.VAR_FILE), false, 2);
    externalTimeout = UIUtils.createLabelSpinner(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_exec_timeout, SQLEditorMessages.pref_page_sql_format_label_external_exec_timeout_tip, 100, 100, 10000);
    return parent;
}
Also used : SmartTextContentAdapter(org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider) GridData(org.eclipse.swt.layout.GridData)

Example 3 with StringContentProposalProvider

use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by serge-rider.

the class CustomComboBoxCellEditor method createControl.

@Override
protected Control createControl(Composite parent) {
    CCombo comboBox = (CCombo) super.createControl(parent);
    // comboBox.setEditable((getStyle() & SWT.READ_ONLY) == 0);
    comboBox.setVisibleItemCount(15);
    comboBox.setFont(parent.getFont());
    comboBox.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
    if ((getStyle() & SWT.READ_ONLY) == 0) {
        // Install proposal provider for editable combos
        // In fact it was a bad idea to use proposals in inline combo editors (#2409)
        proposalProvider = new StringContentProposalProvider(comboBox.getItems());
        ContentAssistUtils.installContentProposal(comboBox, new CComboContentAdapter(), proposalProvider);
    }
    return comboBox;
}
Also used : CCombo(org.eclipse.swt.custom.CCombo) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider)

Example 4 with StringContentProposalProvider

use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider 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, MySQLUIMessages.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(MySQLUIMessages.tools_db_export_wizard_page_settings_combo_item_online_backup);
    methodCombo.add(MySQLUIMessages.tools_db_export_wizard_page_settings_combo_item_lock_tables);
    methodCombo.add(MySQLUIMessages.tools_db_export_wizard_page_settings_combo_item_normal);
    methodCombo.select(wizard.getSettings().getMethod().ordinal());
    methodCombo.addSelectionListener(changeListener);
    Group settingsGroup = UIUtils.createControlGroup(composite, MySQLUIMessages.tools_db_export_wizard_page_settings_group_settings, 3, GridData.FILL_HORIZONTAL, 0);
    noCreateStatementsCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_no_create, wizard.getSettings().isNoCreateStatements());
    noCreateStatementsCheck.addSelectionListener(changeListener);
    addDropStatementsCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_add_drop, wizard.getSettings().isAddDropStatements());
    addDropStatementsCheck.addSelectionListener(changeListener);
    disableKeysCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_disable_keys, wizard.getSettings().isDisableKeys());
    disableKeysCheck.addSelectionListener(changeListener);
    extendedInsertsCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_ext_inserts, wizard.getSettings().isExtendedInserts());
    extendedInsertsCheck.addSelectionListener(changeListener);
    dumpEventsCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_dump_events, wizard.getSettings().isDumpEvents());
    dumpEventsCheck.addSelectionListener(changeListener);
    commentsCheck = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_addnl_comments, wizard.getSettings().isComments());
    commentsCheck.addSelectionListener(changeListener);
    removeDefiner = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_remove_definer, wizard.getSettings().isRemoveDefiner());
    removeDefiner.addSelectionListener(changeListener);
    binaryInHex = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_binary_hex, wizard.getSettings().isBinariesInHex());
    binaryInHex.addSelectionListener(changeListener);
    noData = UIUtils.createCheckbox(settingsGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_checkbox_no_data, wizard.getSettings().isNoData());
    noData.addSelectionListener(changeListener);
    Group outputGroup = UIUtils.createControlGroup(composite, MySQLUIMessages.tools_db_export_wizard_page_settings_group_output, 2, GridData.FILL_HORIZONTAL, 0);
    outputFolderText = DialogUtils.createOutputFolderChooser(outputGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_label_out_text, e -> updateState());
    outputFileText = UIUtils.createLabelText(outputGroup, MySQLUIMessages.tools_db_export_wizard_page_settings_label_file_name_pattern_text, wizard.getSettings().getOutputFilePattern());
    UIUtils.setContentProposalToolTip(outputFileText, MySQLUIMessages.tools_db_export_wizard_page_settings_label_file_name_pattern_tip, NativeToolUtils.VARIABLE_HOST, NativeToolUtils.VARIABLE_DATABASE, NativeToolUtils.VARIABLE_TABLE, NativeToolUtils.VARIABLE_DATE, NativeToolUtils.VARIABLE_TIMESTAMP, NativeToolUtils.VARIABLE_CONN_TYPE);
    ContentAssistUtils.installContentProposal(outputFileText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_HOST), GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_DATABASE), GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_TABLE), GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_DATE), GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_TIMESTAMP), GeneralUtils.variablePattern(NativeToolUtils.VARIABLE_CONN_TYPE)));
    createExtraArgsInput(outputGroup);
    if (wizard.getSettings().getOutputFolder() != null) {
        outputFolderText.setText(wizard.getSettings().getOutputFolder().getAbsolutePath());
    }
    outputFileText.addModifyListener(e -> wizard.getSettings().setOutputFilePattern(outputFileText.getText()));
    Composite extraGroup = UIUtils.createComposite(composite, 2);
    createSecurityGroup(extraGroup);
    wizard.createTaskSaveGroup(extraGroup);
    setControl(composite);
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GeneralUtils(org.jkiss.dbeaver.utils.GeneralUtils) CommonUtils(org.jkiss.utils.CommonUtils) org.eclipse.swt.widgets(org.eclipse.swt.widgets) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider) MySQLExportSettings(org.jkiss.dbeaver.ext.mysql.tasks.MySQLExportSettings) MySQLUIMessages(org.jkiss.dbeaver.ext.mysql.ui.internal.MySQLUIMessages) NativeToolUtils(org.jkiss.dbeaver.tasks.nativetool.NativeToolUtils) SmartTextContentAdapter(org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter) File(java.io.File) ContentAssistUtils(org.jkiss.dbeaver.ui.contentassist.ContentAssistUtils) UIUtils(org.jkiss.dbeaver.ui.UIUtils) SWT(org.eclipse.swt.SWT) DialogUtils(org.jkiss.dbeaver.ui.dialogs.DialogUtils) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) SelectionListener(org.eclipse.swt.events.SelectionListener) SmartTextContentAdapter(org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) GridData(org.eclipse.swt.layout.GridData) SelectionListener(org.eclipse.swt.events.SelectionListener)

Example 5 with StringContentProposalProvider

use of org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider in project dbeaver by dbeaver.

the class SQLExternalFormatterConfigurationPage method createFormatSettings.

@Override
protected Composite createFormatSettings(Composite parent) {
    Group settingsGroup = UIUtils.createControlGroup(parent, "Settings", 4, GridData.FILL_HORIZONTAL, 0);
    externalCmdText = UIUtils.createLabelText(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_command_line, "");
    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 3;
    externalCmdText.setLayoutData(gd);
    ContentAssistUtils.installContentProposal(externalCmdText, new SmartTextContentAdapter(), new StringContentProposalProvider(GeneralUtils.variablePattern(SQLFormatterExternal.VAR_FILE)));
    UIUtils.setContentProposalToolTip(externalCmdText, SQLEditorMessages.pref_page_sql_format_label_external_set_content_tool_tip, SQLFormatterExternal.VAR_FILE);
    externalUseFile = UIUtils.createCheckbox(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_use_temp_file, SQLEditorMessages.pref_page_sql_format_label_external_use_temp_file_tip + " " + GeneralUtils.variablePattern(SQLFormatterExternal.VAR_FILE), false, 2);
    externalTimeout = UIUtils.createLabelSpinner(settingsGroup, SQLEditorMessages.pref_page_sql_format_label_external_exec_timeout, SQLEditorMessages.pref_page_sql_format_label_external_exec_timeout_tip, 100, 100, 10000);
    return parent;
}
Also used : SmartTextContentAdapter(org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter) StringContentProposalProvider(org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider) GridData(org.eclipse.swt.layout.GridData)

Aggregations

StringContentProposalProvider (org.jkiss.dbeaver.ui.contentassist.StringContentProposalProvider)20 GridData (org.eclipse.swt.layout.GridData)14 SmartTextContentAdapter (org.jkiss.dbeaver.ui.contentassist.SmartTextContentAdapter)14 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)10 SelectionEvent (org.eclipse.swt.events.SelectionEvent)10 SWT (org.eclipse.swt.SWT)8 UIUtils (org.jkiss.dbeaver.ui.UIUtils)8 ContentAssistUtils (org.jkiss.dbeaver.ui.contentassist.ContentAssistUtils)8 GeneralUtils (org.jkiss.dbeaver.utils.GeneralUtils)8 CommonUtils (org.jkiss.utils.CommonUtils)8 org.eclipse.swt.widgets (org.eclipse.swt.widgets)6 DialogUtils (org.jkiss.dbeaver.ui.dialogs.DialogUtils)6 File (java.io.File)4 ArrayList (java.util.ArrayList)4 ComboContentAdapter (org.eclipse.jface.fieldassist.ComboContentAdapter)4 SelectionListener (org.eclipse.swt.events.SelectionListener)4 Composite (org.eclipse.swt.widgets.Composite)4 DBDAttributeBinding (org.jkiss.dbeaver.model.data.DBDAttributeBinding)4 NativeToolUtils (org.jkiss.dbeaver.tasks.nativetool.NativeToolUtils)4 Comparator (java.util.Comparator)2