Search in sources :

Example 26 with DBPPreferenceStore

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

the class PrefPageQueryManager method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    Collection<QMObjectType> objectTypes = QMObjectType.fromString(store.getString(QMConstants.PROP_OBJECT_TYPES));
    Collection<String> queryTypes = CommonUtils.splitString(store.getString(QMConstants.PROP_QUERY_TYPES), ',');
    checkObjectTypeSessions.setSelection(objectTypes.contains(QMObjectType.session));
    checkObjectTypeTxn.setSelection(objectTypes.contains(QMObjectType.txn));
    checkObjectTypeQueries.setSelection(objectTypes.contains(QMObjectType.query));
    checkQueryTypeUser.setSelection(queryTypes.contains(DBCExecutionPurpose.USER.name()));
    checkQueryTypeUserFiltered.setSelection(queryTypes.contains(DBCExecutionPurpose.USER_FILTERED.name()));
    checkQueryTypeScript.setSelection(queryTypes.contains(DBCExecutionPurpose.USER_SCRIPT.name()));
    checkQueryTypeUtil.setSelection(queryTypes.contains(DBCExecutionPurpose.UTIL.name()));
    checkQueryTypeMeta.setSelection(queryTypes.contains(DBCExecutionPurpose.META.name()));
    checkQueryTypeDDL.setSelection(queryTypes.contains(DBCExecutionPurpose.META_DDL.name()));
    textHistoryDays.setText(store.getString(QMConstants.PROP_HISTORY_DAYS));
    textEntriesPerPage.setText(store.getString(QMConstants.PROP_ENTRIES_PER_PAGE));
    checkStoreLog.setSelection(store.getBoolean(QMConstants.PROP_STORE_LOG_FILE));
    textOutputFolder.setText(store.getString(QMConstants.PROP_LOG_DIRECTORY));
    UIUtils.enableWithChildren(textOutputFolder.getParent(), checkStoreLog.getSelection());
    super.performDefaults();
}
Also used : QMObjectType(org.jkiss.dbeaver.model.qm.QMObjectType) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 27 with DBPPreferenceStore

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

the class PrefPageDatabaseUserInterface method performOk.

@Override
public boolean performOk() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    if (isStandalone) {
        store.setValue(DBeaverPreferences.UI_AUTO_UPDATE_CHECK, automaticUpdateCheck.getSelection());
    }
    store.setValue(ModelPreferences.NOTIFICATIONS_ENABLED, notificationsEnabled.getSelection());
    store.setValue(ModelPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT, notificationsCloseDelay.getSelection());
    store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY, longOperationsCheck.getSelection());
    store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT, longOperationsTimeout.getSelection());
    PrefUtils.savePreferenceStore(store);
    if (workspaceLanguage.getSelectionIndex() >= 0) {
        PlatformLanguageDescriptor language = PlatformLanguageRegistry.getInstance().getLanguages().get(workspaceLanguage.getSelectionIndex());
        try {
            DBPPlatformLanguage curLanguage = DBWorkbench.getPlatform().getLanguage();
            if (curLanguage != language) {
                ((DBPPlatformLanguageManager) DBWorkbench.getPlatform()).setPlatformLanguage(language);
                if (UIUtils.confirmAction(getShell(), "Restart " + GeneralUtils.getProductName(), "You need to restart " + GeneralUtils.getProductName() + " to perform actual language change.\nDo you want to restart?")) {
                    UIUtils.asyncExec(() -> PlatformUI.getWorkbench().restart());
                }
            }
        } catch (DBException e) {
            DBWorkbench.getPlatformUI().showError("Change language", "Can't switch language to " + language, e);
        }
    }
    return true;
}
Also used : DBPPlatformLanguageManager(org.jkiss.dbeaver.model.app.DBPPlatformLanguageManager) DBException(org.jkiss.dbeaver.DBException) DBPPlatformLanguage(org.jkiss.dbeaver.model.app.DBPPlatformLanguage) PlatformLanguageDescriptor(org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 28 with DBPPreferenceStore

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

the class PrefPageDatabaseUserInterface method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    if (isStandalone) {
        automaticUpdateCheck.setSelection(store.getBoolean(DBeaverPreferences.UI_AUTO_UPDATE_CHECK));
    }
    notificationsEnabled.setSelection(store.getBoolean(ModelPreferences.NOTIFICATIONS_ENABLED));
    notificationsCloseDelay.setSelection(store.getInt(ModelPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT));
    longOperationsCheck.setSelection(store.getBoolean(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY));
    longOperationsTimeout.setSelection(store.getInt(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT));
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 29 with DBPPreferenceStore

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

the class GISViewerConfigurationDialog method okPressed.

@Override
protected void okPressed() {
    DBPPreferenceStore preferences = GISViewerActivator.getDefault().getPreferences();
    preferences.setValue(GeometryViewerConstants.PREF_DEFAULT_SRID, defaultSridText.getText());
    preferences.setValue(GeometryViewerConstants.PREF_MAX_OBJECTS_RENDER, CommonUtils.toInt(maxObjectsText.getText()));
    super.okPressed();
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 30 with DBPPreferenceStore

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

the class PrefPageDatabaseEditors method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    syncEditorDataSourceWithNavigator.setSelection(store.getBoolean(NavigatorPreferences.NAVIGATOR_SYNC_EDITOR_DATASOURCE));
    showGeneralToolbarEverywhere.setSelection(store.getBoolean(DBeaverPreferences.TOOLBARS_SHOW_GENERAL_ALWAYS));
    showEditToolbar.setSelection(store.getBoolean(DBeaverPreferences.TOOLBARS_SHOW_EDIT));
    // toolbarDatabaseSelectorWidth.setSelection(store.getInt(DBeaverPreferences.TOOLBARS_DATABASE_SELECTOR_WIDTH));
    // toolbarSchemaSelectorWidth.setSelection(store.getInt(DBeaverPreferences.TOOLBARS_SCHEMA_SELECTOR_WIDTH));
    keepEditorsOnRestart.setSelection(store.getBoolean(DBeaverPreferences.UI_KEEP_DATABASE_EDITORS));
    refreshEditorOnOpen.setSelection(store.getBoolean(NavigatorPreferences.NAVIGATOR_REFRESH_EDITORS_ON_OPEN));
    editorFullName.setSelection(store.getBoolean(DBeaverPreferences.NAVIGATOR_EDITOR_FULL_NAME));
    showTableGrid.setSelection(store.getBoolean(NavigatorPreferences.NAVIGATOR_EDITOR_SHOW_TABLE_GRID));
    showPreviewOnSave.setSelection(store.getBoolean(NavigatorPreferences.NAVIGATOR_SHOW_SQL_PREVIEW));
}
Also used : 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