Search in sources :

Example 56 with DBPPreferenceStore

use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.

the class PostgreConnectionPageAdvanced method loadSettings.

@Override
public void loadSettings() {
    // Load values from new connection info
    DBPPreferenceStore globalPrefs = DBWorkbench.getPlatform().getPreferenceStore();
    DBPConnectionConfiguration connectionInfo = site.getActiveDataSource().getConnectionConfiguration();
    setTitle(site.getActiveDataSource().getDriver().getName());
    showNonDefault.setSelection(CommonUtils.getBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB), globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB)));
    showTemplates.setSelection(CommonUtils.getBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_SHOW_TEMPLATES_DB), globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_TEMPLATES_DB)));
    showTemplates.setEnabled(showNonDefault.getSelection());
    showUnavailable.setSelection(CommonUtils.getBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_SHOW_UNAVAILABLE_DB), globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_UNAVAILABLE_DB)));
    showUnavailable.setEnabled(showNonDefault.getSelection());
    ddPlainBehaviorCombo.select(CommonUtils.getBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_DD_PLAIN_STRING), globalPrefs.getBoolean(PostgreConstants.PROP_DD_PLAIN_STRING)) ? 0 : 1);
    ddTagBehaviorCombo.select(CommonUtils.getBoolean(connectionInfo.getProviderProperty(PostgreConstants.PROP_DD_TAG_STRING), globalPrefs.getBoolean(PostgreConstants.PROP_DD_TAG_STRING)) ? 0 : 1);
}
Also used : DBPConnectionConfiguration(org.jkiss.dbeaver.model.connection.DBPConnectionConfiguration) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 57 with DBPPreferenceStore

use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.

the class PrefPagePostgreSQL method createContents.

@Override
protected Control createContents(Composite parent) {
    Composite cfgGroup = new Composite(parent, SWT.NONE);
    GridLayout gl = new GridLayout(1, false);
    gl.marginHeight = 10;
    gl.marginWidth = 10;
    cfgGroup.setLayout(gl);
    cfgGroup.setLayoutData(new GridData(GridData.FILL_BOTH));
    DBPPreferenceStore globalPrefs = DBWorkbench.getPlatform().getPreferenceStore();
    {
        Group secureGroup = new Group(cfgGroup, SWT.NONE);
        secureGroup.setText(PostgreMessages.dialog_setting_connection_settings);
        secureGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        secureGroup.setLayout(new GridLayout(2, false));
        showNonDefault = UIUtils.createCheckbox(secureGroup, PostgreMessages.dialog_setting_connection_nondefaultDatabase, PostgreMessages.dialog_setting_connection_nondefaultDatabase_tip, globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB), 2);
        showNonDefault.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(SelectionEvent e) {
                showTemplates.setEnabled(showNonDefault.getSelection());
                showUnavailable.setEnabled(showNonDefault.getSelection());
            }
        });
        showTemplates = UIUtils.createCheckbox(secureGroup, PostgreMessages.dialog_setting_connection_show_templates, PostgreMessages.dialog_setting_connection_show_templates_tip, globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_TEMPLATES_DB), 2);
        showUnavailable = UIUtils.createCheckbox(secureGroup, PostgreMessages.dialog_setting_connection_show_not_available_for_conn, PostgreMessages.dialog_setting_connection_show_not_available_for_conn_tip, globalPrefs.getBoolean(PostgreConstants.PROP_SHOW_UNAVAILABLE_DB), 2);
    }
    {
        Group secureGroup = new Group(cfgGroup, SWT.NONE);
        secureGroup.setText(PostgreMessages.dialog_setting_group_sql);
        secureGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
        secureGroup.setLayout(new GridLayout(2, false));
        ddPlainBehaviorCombo = UIUtils.createLabelCombo(secureGroup, PostgreMessages.dialog_setting_sql_dd_plain_label, PostgreMessages.dialog_setting_sql_dd_plain_tip, SWT.DROP_DOWN | SWT.READ_ONLY);
        ddPlainBehaviorCombo.add(PostgreMessages.dialog_setting_sql_dd_string);
        ddPlainBehaviorCombo.add(PostgreMessages.dialog_setting_sql_dd_code_block);
        ddTagBehaviorCombo = UIUtils.createLabelCombo(secureGroup, PostgreMessages.dialog_setting_sql_dd_tag_label, PostgreMessages.dialog_setting_sql_dd_tag_tip, SWT.DROP_DOWN | SWT.READ_ONLY);
        ddTagBehaviorCombo.add(PostgreMessages.dialog_setting_sql_dd_string);
        ddTagBehaviorCombo.add(PostgreMessages.dialog_setting_sql_dd_code_block);
        ddPlainBehaviorCombo.select(globalPrefs.getBoolean(PostgreConstants.PROP_DD_PLAIN_STRING) ? 0 : 1);
        ddTagBehaviorCombo.select(globalPrefs.getBoolean(PostgreConstants.PROP_DD_TAG_STRING) ? 0 : 1);
    }
    return cfgGroup;
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) GridData(org.eclipse.swt.layout.GridData) SelectionEvent(org.eclipse.swt.events.SelectionEvent) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 58 with DBPPreferenceStore

use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.

the class PrefPagePostgreSQL method performOk.

@Override
public boolean performOk() {
    DBPPreferenceStore preferenceStore = DBWorkbench.getPlatform().getPreferenceStore();
    preferenceStore.setValue(PostgreConstants.PROP_SHOW_NON_DEFAULT_DB, String.valueOf(showNonDefault.getSelection()));
    preferenceStore.setValue(PostgreConstants.PROP_SHOW_TEMPLATES_DB, String.valueOf(showTemplates.getSelection()));
    preferenceStore.setValue(PostgreConstants.PROP_SHOW_UNAVAILABLE_DB, String.valueOf(showUnavailable.getSelection()));
    preferenceStore.setValue(PostgreConstants.PROP_DD_PLAIN_STRING, ddPlainBehaviorCombo.getSelectionIndex() == 0);
    preferenceStore.setValue(PostgreConstants.PROP_DD_TAG_STRING, ddTagBehaviorCombo.getSelectionIndex() == 0);
    return super.performOk();
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 59 with DBPPreferenceStore

use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.

the class UIDashboardPreferencesInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    // Init default preferences
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    PrefUtils.setDefaultPreferenceValue(store, DashboardConstants.PREF_OPEN_SEPARATE_CONNECTION, false);
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 60 with DBPPreferenceStore

use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.

the class SQLEditor method getEditorName.

private String getEditorName() {
    final IFile file = EditorUtils.getFileFromInput(getEditorInput());
    String scriptName;
    if (file != null) {
        scriptName = file.getFullPath().removeFileExtension().lastSegment();
    } else {
        File localFile = EditorUtils.getLocalFileFromInput(getEditorInput());
        if (localFile != null) {
            scriptName = localFile.getName();
        } else {
            scriptName = getEditorInput().getName();
        }
    }
    Map<String, Object> vars = getScriptVariables(file, scriptName);
    DBPPreferenceStore preferenceStore = getActivePreferenceStore();
    String pattern = preferenceStore.getString(SQLPreferenceConstants.SCRIPT_TITLE_PATTERN);
    return GeneralUtils.replaceVariables(pattern, new GeneralUtils.MapResolver(vars));
}
Also used : IFile(org.eclipse.core.resources.IFile) GeneralUtils(org.jkiss.dbeaver.utils.GeneralUtils) DBSObject(org.jkiss.dbeaver.model.struct.DBSObject) IFile(org.eclipse.core.resources.IFile) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Aggregations

DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)201 DBPPreferenceListener (org.jkiss.dbeaver.model.preferences.DBPPreferenceListener)11 IOException (java.io.IOException)10 ArrayList (java.util.ArrayList)10 DBDAttributeBinding (org.jkiss.dbeaver.model.data.DBDAttributeBinding)10 ExecutionException (org.eclipse.core.commands.ExecutionException)8 GridData (org.eclipse.swt.layout.GridData)8 NotNull (org.jkiss.code.NotNull)8 BundlePreferenceStore (org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore)8 Color (org.eclipse.swt.graphics.Color)6 FontData (org.eclipse.swt.graphics.FontData)6 DBException (org.jkiss.dbeaver.DBException)6 DBDDisplayFormat (org.jkiss.dbeaver.model.data.DBDDisplayFormat)6 QMObjectType (org.jkiss.dbeaver.model.qm.QMObjectType)6 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)4 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)4 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)4 SelectionEvent (org.eclipse.swt.events.SelectionEvent)4 AbstractJob (org.jkiss.dbeaver.model.runtime.AbstractJob)4 DBRProgressMonitor (org.jkiss.dbeaver.model.runtime.DBRProgressMonitor)4