Search in sources :

Example 36 with DBPPreferenceStore

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

the class PrefPageSQLCodeEditing method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    try {
        csFoldingEnabled.setSelection(store.getBoolean(SQLPreferenceConstants.FOLDING_ENABLED));
        csMarkOccurrencesUnderCursor.setSelection(store.getBoolean(SQLPreferenceConstants.MARK_OCCURRENCES_UNDER_CURSOR));
        csMarkOccurrencesForSelection.setSelection(store.getBoolean(SQLPreferenceConstants.MARK_OCCURRENCES_FOR_SELECTION));
        acSingleQuotesCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_SINGLE_QUOTES));
        acDoubleQuotesCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_DOUBLE_QUOTES));
        acBracketsCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SQLEDITOR_CLOSE_BRACKETS));
        afKeywordCase.setSelection(store.getBoolean(SQLPreferenceConstants.SQL_FORMAT_KEYWORD_CASE_AUTO));
        afExtractFromSource.setSelection(store.getBoolean(SQLPreferenceConstants.SQL_FORMAT_EXTRACT_FROM_SOURCE));
    } catch (Exception e) {
        log.warn(e);
    }
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 37 with DBPPreferenceStore

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

the class PrefPageSQLCodeEditing method performOk.

@Override
public boolean performOk() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    try {
        store.setValue(SQLPreferenceConstants.FOLDING_ENABLED, csFoldingEnabled.getSelection());
        store.setValue(SQLPreferenceConstants.MARK_OCCURRENCES_UNDER_CURSOR, csMarkOccurrencesUnderCursor.getSelection());
        store.setValue(SQLPreferenceConstants.MARK_OCCURRENCES_FOR_SELECTION, csMarkOccurrencesForSelection.getSelection());
        store.setValue(SQLPreferenceConstants.SQLEDITOR_CLOSE_SINGLE_QUOTES, acSingleQuotesCheck.getSelection());
        store.setValue(SQLPreferenceConstants.SQLEDITOR_CLOSE_DOUBLE_QUOTES, acDoubleQuotesCheck.getSelection());
        store.setValue(SQLPreferenceConstants.SQLEDITOR_CLOSE_BRACKETS, acBracketsCheck.getSelection());
        store.setValue(SQLPreferenceConstants.SQL_FORMAT_KEYWORD_CASE_AUTO, afKeywordCase.getSelection());
        store.setValue(SQLPreferenceConstants.SQL_FORMAT_EXTRACT_FROM_SOURCE, afExtractFromSource.getSelection());
    } catch (Exception e) {
        log.warn(e);
    }
    PrefUtils.savePreferenceStore(store);
    PrefUtils.savePreferenceStore(store);
    return super.performOk();
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 38 with DBPPreferenceStore

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

the class PrefPageSQLDialects method performOk.

@Override
public boolean performOk() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    // store.setValue(SQLPreferenceConstants.SCRIPT_BIND_EMBEDDED_READ, bindEmbeddedReadCheck.getSelection());
    PrefUtils.savePreferenceStore(store);
    return super.performOk();
}
Also used : DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 39 with DBPPreferenceStore

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

the class PrefPageSQLResources method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
    bindEmbeddedReadCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SCRIPT_BIND_EMBEDDED_READ));
    bindEmbeddedWriteCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SCRIPT_BIND_EMBEDDED_WRITE));
    try {
        SQLScriptBindingType bindingType = SQLScriptBindingType.valueOf(store.getString(SQLPreferenceConstants.SCRIPT_BIND_COMMENT_TYPE));
        for (Control ch : commentTypeComposite.getChildren()) {
            if (ch instanceof Button && ch.getData() == bindingType) {
                ((Button) ch).setSelection(true);
            }
        }
    } catch (IllegalArgumentException e) {
        log.error(e);
    }
    enableCommentType();
    deleteEmptyCombo.setText(SQLPreferenceConstants.EmptyScriptCloseBehavior.getByName(store.getString(SQLPreferenceConstants.SCRIPT_DELETE_EMPTY)).getTitle());
    autoFoldersCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SCRIPT_AUTO_FOLDERS));
    connectionFoldersCheck.setSelection(store.getBoolean(SQLPreferenceConstants.SCRIPT_CREATE_CONNECTION_FOLDERS));
    scriptTitlePattern.setText(store.getString(SQLPreferenceConstants.SCRIPT_TITLE_PATTERN));
    super.performDefaults();
}
Also used : SQLScriptBindingType(org.jkiss.dbeaver.ui.editors.sql.SQLScriptBindingType) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 40 with DBPPreferenceStore

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

the class SQLEditorHandlerSyncConnectionAuto method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    final DBPPreferenceStore prefs = DBWorkbench.getPlatform().getPreferenceStore();
    prefs.setValue(NavigatorPreferences.NAVIGATOR_SYNC_EDITOR_DATASOURCE, !prefs.getBoolean(NavigatorPreferences.NAVIGATOR_SYNC_EDITOR_DATASOURCE));
    try {
        prefs.save();
    } catch (IOException e) {
        throw new ExecutionException("Error saving configuration", e);
    }
    return null;
}
Also used : IOException(java.io.IOException) ExecutionException(org.eclipse.core.commands.ExecutionException) 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