use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class SQLExternalFormatter method format.
@Override
public String format(String source, SQLFormatterConfiguration configuration) {
final DBPPreferenceStore store = configuration.getSyntaxManager().getPreferenceStore();
final String command = store.getString(ModelPreferences.SQL_FORMAT_EXTERNAL_CMD);
int timeout = store.getInt(ModelPreferences.SQL_FORMAT_EXTERNAL_TIMEOUT);
boolean useFile = store.getBoolean(ModelPreferences.SQL_FORMAT_EXTERNAL_FILE);
try {
final FormatJob formatJob = new FormatJob(configuration, command, source, useFile);
formatJob.schedule();
for (int i = 0; i < 10; i++) {
Thread.sleep(timeout / 10);
if (formatJob.finished) {
return formatJob.result;
}
}
log.warn("Formatter process hangs. Terminating.");
formatJob.stop();
} catch (Exception ex) {
log.warn("Error executing external formatter [" + command + "]", ex);
}
return source;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class CursorViewDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
final IValueController valueController = getValueController();
value = (DBDCursor) valueController.getValue();
Composite dialogGroup = (Composite) super.createDialogArea(parent);
if (value != null) {
DBPPreferenceStore globalPreferenceStore = DBeaverCore.getGlobalPreferenceStore();
if (!globalPreferenceStore.getBoolean(DBeaverPreferences.KEEP_STATEMENT_OPEN)) {
if (ConfirmationDialog.showConfirmDialog(getShell(), DBeaverPreferences.CONFIRM_KEEP_STATEMENT_OPEN, ConfirmationDialog.QUESTION) == IDialogConstants.YES_ID) {
globalPreferenceStore.setValue(DBeaverPreferences.KEEP_STATEMENT_OPEN, true);
if (valueController.getValueSite().getPart() instanceof IResultSetContainer) {
IResultSetController rsv = ((IResultSetContainer) valueController.getValueSite().getPart()).getResultSetController();
if (rsv != null) {
rsv.refresh();
}
}
}
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
close();
}
});
}
}
resultSetViewer = new ResultSetViewer(dialogGroup, valueController.getValueSite(), this);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.heightHint = 300;
gd.grabExcessVerticalSpace = true;
resultSetViewer.getControl().setLayoutData(gd);
resultSetViewer.refresh();
return dialogGroup;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class PrefPageEntityEditor method performOk.
@Override
public boolean performOk() {
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
store.setValue(DBeaverPreferences.UI_KEEP_DATABASE_EDITORS, keepEditorsOnRestart.getSelection());
store.setValue(DBeaverPreferences.NAVIGATOR_REFRESH_EDITORS_ON_OPEN, refreshEditorOnOpen.getSelection());
store.setValue(DBeaverPreferences.NAVIGATOR_EDITOR_FULL_NAME, editorFullName.getSelection());
store.setValue(DBeaverPreferences.NAVIGATOR_SHOW_SQL_PREVIEW, showPreviewOnSave.getSelection());
PrefUtils.savePreferenceStore(store);
return true;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class PrefPageDatabaseGeneral method performOk.
@Override
public boolean performOk() {
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
store.setValue(DBeaverPreferences.UI_AUTO_UPDATE_CHECK, automaticUpdateCheck.getSelection());
//store.setValue(DBeaverPreferences.AGENT_ENABLED, agentEnabledCheck.getSelection());
store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY, longOperationsCheck.getSelection());
store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT, longOperationsTimeout.getSelection());
store.setValue(DBeaverPreferences.DEFAULT_RESOURCE_ENCODING, defaultResourceEncoding.getText());
PrefUtils.savePreferenceStore(store);
return true;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by serge-rider.
the class PrefPageDatabaseGeneral method performDefaults.
@Override
protected void performDefaults() {
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
automaticUpdateCheck.setSelection(store.getBoolean(DBeaverPreferences.UI_AUTO_UPDATE_CHECK));
longOperationsCheck.setSelection(store.getBoolean(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY));
longOperationsTimeout.setSelection(store.getInt(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT));
defaultResourceEncoding.setText(store.getString(DBeaverPreferences.DEFAULT_RESOURCE_ENCODING));
}
Aggregations