Search in sources :

Example 41 with DBPPreferenceStore

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

the class SQLAutoIndentStrategy method clearCachedValues.

private void clearCachedValues() {
    autoCompletionMap.clear();
    DBPPreferenceStore preferenceStore = DBWorkbench.getPlatform().getPreferenceStore();
    boolean closeBeginEnd = preferenceStore.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_BEGIN_END);
    if (closeBeginEnd) {
        autoCompletionMap.put(SQLIndentSymbols.Tokenbegin, SQLIndentSymbols.end);
        autoCompletionMap.put(SQLIndentSymbols.TokenBEGIN, SQLIndentSymbols.END);
    }
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 42 with DBPPreferenceStore

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

the class SQLEditorHandlerSeparateConnectionOption method updateElement.

@Override
public void updateElement(UIElement element, Map parameters) {
    element.setText(SQLEditorMessages.pref_page_sql_editor_label_separate_connection_each_editor);
    element.setTooltip(SQLEditorMessages.pref_page_sql_editor_label_separate_connection_each_editor);
    IEditorPart activeEditor = UIUtils.getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    DBPDataSourceContainer dsContainer = activeEditor == null ? null : getDataSourceContainerFromPart(activeEditor);
    DBPPreferenceStore prefStore = dsContainer == null ? DBWorkbench.getPlatform().getPreferenceStore() : dsContainer.getPreferenceStore();
    element.setChecked(prefStore.getBoolean(SQLPreferenceConstants.EDITOR_SEPARATE_CONNECTION));
}
Also used : IEditorPart(org.eclipse.ui.IEditorPart) DBPDataSourceContainer(org.jkiss.dbeaver.model.DBPDataSourceContainer) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 43 with DBPPreferenceStore

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

the class ConfirmationDialog method open.

public static int open(int kind, int imageKind, Shell parent, String title, String message, String toggleMessage, boolean toggleState, String key) {
    DBPPreferenceStore prefStore = DBWorkbench.getPlatform().getPreferenceStore();
    if (toggleMessage != null) {
        if (ConfirmationDialog.ALWAYS.equals(prefStore.getString(key))) {
            if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
                return IDialogConstants.YES_ID;
            } else {
                return IDialogConstants.OK_ID;
            }
        } else if (ConfirmationDialog.NEVER.equals(prefStore.getString(key))) {
            if (kind == QUESTION || kind == QUESTION_WITH_CANCEL) {
                return IDialogConstants.NO_ID;
            } else {
                return IDialogConstants.CANCEL_ID;
            }
        }
    }
    ConfirmationDialog dialog = new ConfirmationDialog(parent == null ? UIUtils.getActiveWorkbenchShell() : parent, title, // accept the default window icon
    null, message, imageKind, getButtonLabels(kind), getDefaultIndex(kind, imageKind), toggleMessage, toggleState);
    dialog.setPrefStore(new PreferenceStoreDelegate(prefStore));
    dialog.setPrefKey(key);
    return dialog.open();
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore) PreferenceStoreDelegate(org.jkiss.dbeaver.ui.preferences.PreferenceStoreDelegate)

Example 44 with DBPPreferenceStore

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

the class ERDPreferencesInitializer method initializeDefaultPreferences.

@Override
public void initializeDefaultPreferences() {
    // Init default preferences
    DBPPreferenceStore store = new BundlePreferenceStore(ERDUIActivator.getDefault().getBundle());
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_DIAGRAM_SHOW_VIEWS, true);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_DIAGRAM_SHOW_PARTITIONS, false);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_DIAGRAM_CHANGE_BORDER_COLORS, true);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_DIAGRAM_CHANGE_HEADER_COLORS, true);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_PRINT_PAGE_MODE, ERDUIConstants.PRINT_MODE_DEFAULT);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_PRINT_MARGIN_TOP, ERDUIConstants.PRINT_MARGIN_DEFAULT);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_PRINT_MARGIN_BOTTOM, ERDUIConstants.PRINT_MARGIN_DEFAULT);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_PRINT_MARGIN_LEFT, ERDUIConstants.PRINT_MARGIN_DEFAULT);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_PRINT_MARGIN_RIGHT, ERDUIConstants.PRINT_MARGIN_DEFAULT);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_GRID_ENABLED, false);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_GRID_SNAP_ENABLED, true);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_GRID_WIDTH, 20);
    PrefUtils.setDefaultPreferenceValue(store, ERDUIConstants.PREF_GRID_HEIGHT, 20);
}
Also used : BundlePreferenceStore(org.jkiss.dbeaver.model.impl.preferences.BundlePreferenceStore) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 45 with DBPPreferenceStore

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

the class DiagramToggleGridAction method run.

@Override
public void run() {
    final DBPPreferenceStore store = ERDUIActivator.getDefault().getPreferences();
    final boolean gridEnabled = store.getBoolean(ERDUIConstants.PREF_GRID_ENABLED);
    store.setValue(ERDUIConstants.PREF_GRID_ENABLED, !gridEnabled);
    PrefUtils.savePreferenceStore(store);
}
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