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);
}
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;
}
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();
}
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);
}
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));
}
Aggregations