Search in sources :

Example 1 with QMObjectType

use of org.jkiss.dbeaver.model.qm.QMObjectType in project dbeaver by serge-rider.

the class PrefPageQueryManager method performDefaults.

@Override
protected void performDefaults() {
    DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
    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 2 with QMObjectType

use of org.jkiss.dbeaver.model.qm.QMObjectType in project dbeaver by serge-rider.

the class PrefPageQueryManager method performOk.

@Override
public boolean performOk() {
    List<QMObjectType> objectTypes = new ArrayList<>();
    List<String> queryTypes = new ArrayList<>();
    if (checkObjectTypeSessions.getSelection())
        objectTypes.add(QMObjectType.session);
    if (checkObjectTypeTxn.getSelection())
        objectTypes.add(QMObjectType.txn);
    if (checkObjectTypeQueries.getSelection())
        objectTypes.add(QMObjectType.query);
    if (checkQueryTypeUser.getSelection())
        queryTypes.add(DBCExecutionPurpose.USER.name());
    if (checkQueryTypeUserFiltered.getSelection())
        queryTypes.add(DBCExecutionPurpose.USER_FILTERED.name());
    if (checkQueryTypeScript.getSelection())
        queryTypes.add(DBCExecutionPurpose.USER_SCRIPT.name());
    if (checkQueryTypeUtil.getSelection())
        queryTypes.add(DBCExecutionPurpose.UTIL.name());
    if (checkQueryTypeMeta.getSelection())
        queryTypes.add(DBCExecutionPurpose.META.name());
    if (checkQueryTypeDDL.getSelection())
        queryTypes.add(DBCExecutionPurpose.META_DDL.name());
    Integer historyDays = UIUtils.getTextInteger(textHistoryDays);
    Integer entriesPerPage = UIUtils.getTextInteger(textEntriesPerPage);
    DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
    store.setValue(QMConstants.PROP_OBJECT_TYPES, QMObjectType.toString(objectTypes));
    store.setValue(QMConstants.PROP_QUERY_TYPES, CommonUtils.makeString(queryTypes, ','));
    if (historyDays != null) {
        store.setValue(QMConstants.PROP_HISTORY_DAYS, historyDays);
    }
    if (entriesPerPage != null) {
        store.setValue(QMConstants.PROP_ENTRIES_PER_PAGE, entriesPerPage);
    }
    store.setValue(QMConstants.PROP_STORE_LOG_FILE, checkStoreLog.getSelection());
    store.setValue(QMConstants.PROP_LOG_DIRECTORY, textOutputFolder.getText());
    PrefUtils.savePreferenceStore(store);
    return super.performOk();
}
Also used : QMObjectType(org.jkiss.dbeaver.model.qm.QMObjectType) ArrayList(java.util.ArrayList) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Example 3 with QMObjectType

use of org.jkiss.dbeaver.model.qm.QMObjectType in project dbeaver by serge-rider.

the class DefaultEventFilter method reloadPreferences.

public void reloadPreferences() {
    DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
    Collection<QMObjectType> objectTypes = QMObjectType.fromString(store.getString(QMConstants.PROP_OBJECT_TYPES));
    this.showSessions = objectTypes.contains(QMObjectType.session);
    this.showTransactions = objectTypes.contains(QMObjectType.txn);
    this.showQueries = objectTypes.contains(QMObjectType.query);
    this.showPurposes.clear();
    for (String queryType : CommonUtils.splitString(store.getString(QMConstants.PROP_QUERY_TYPES), ',')) {
        try {
            this.showPurposes.add(DBCExecutionPurpose.valueOf(queryType));
        } catch (IllegalArgumentException e) {
        // ignore
        }
    }
}
Also used : QMObjectType(org.jkiss.dbeaver.model.qm.QMObjectType) DBPPreferenceStore(org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)

Aggregations

DBPPreferenceStore (org.jkiss.dbeaver.model.preferences.DBPPreferenceStore)3 QMObjectType (org.jkiss.dbeaver.model.qm.QMObjectType)3 ArrayList (java.util.ArrayList)1