use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by dbeaver.
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());
store.setValue(DBeaverPreferences.LOGS_DEBUG_ENABLED, logsDebugEnabled.getSelection());
store.setValue(DBeaverPreferences.LOGS_DEBUG_LOCATION, logsDebugLocation.getText());
PrefUtils.savePreferenceStore(store);
if (workspaceLanguage.getSelectionIndex() >= 0) {
PlatformLanguageDescriptor language = PlatformLanguageRegistry.getInstance().getLanguages().get(workspaceLanguage.getSelectionIndex());
try {
DBPPlatformLanguage curLanguage = DBeaverCore.getInstance().getLanguage();
if (curLanguage != language) {
DBeaverCore.getInstance().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?")) {
DBeaverUI.asyncExec(new Runnable() {
@Override
public void run() {
PlatformUI.getWorkbench().restart();
}
});
}
}
} catch (DBException e) {
DBeaverUI.getInstance().showError("Change language", "Can't switch language to " + language, e);
}
}
return true;
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by dbeaver.
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 dbeaver.
the class PrefPageEntityEditor method performDefaults.
@Override
protected void performDefaults() {
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
keepEditorsOnRestart.setSelection(store.getBoolean(DBeaverPreferences.UI_KEEP_DATABASE_EDITORS));
refreshEditorOnOpen.setSelection(store.getBoolean(DBeaverPreferences.NAVIGATOR_REFRESH_EDITORS_ON_OPEN));
editorFullName.setSelection(store.getBoolean(DBeaverPreferences.NAVIGATOR_EDITOR_FULL_NAME));
showPreviewOnSave.setSelection(store.getBoolean(DBeaverPreferences.NAVIGATOR_SHOW_SQL_PREVIEW));
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by dbeaver.
the class TabbedFolderPageProperties method detachPropertiesPanel.
private void detachPropertiesPanel() {
boolean attached = isAttached();
String title = attached ? "Detach properties to top panel" : "Move properties to tab";
if (UIUtils.confirmAction(part.getSite().getShell(), title, title + " will require to reopen editor.\nAre you sure?")) {
DBPPreferenceStore prefs = DBeaverCore.getGlobalPreferenceStore();
prefs.setValue(DBeaverPreferences.ENTITY_EDITOR_DETACH_INFO, attached);
IEditorPart editor;
if (part.getSite() instanceof MultiPageEditorSite) {
editor = ((MultiPageEditorSite) part.getSite()).getMultiPageEditor();
} else {
editor = (IEditorPart) part;
}
if (editor != null) {
DBNDatabaseNode node = null;
if (editor.getEditorInput() instanceof DatabaseEditorInput) {
node = ((DatabaseEditorInput) editor.getEditorInput()).getNavigatorNode();
}
DBeaverUI.getActiveWorkbenchWindow().getActivePage().closeEditor(editor, false);
if (node != null) {
NavigatorHandlerObjectOpen.openEntityEditor(node, null, DBeaverUI.getActiveWorkbenchWindow());
}
}
}
}
use of org.jkiss.dbeaver.model.preferences.DBPPreferenceStore in project dbeaver by dbeaver.
the class SQLCompletionAnalyzer method makeProposalsFromObject.
private SQLCompletionProposal makeProposalsFromObject(DBPNamedObject object, @Nullable DBPImage objectIcon) {
String objectName = DBUtils.getObjectFullName(object, DBPEvaluationContext.DML);
boolean isSingleObject = true;
String replaceString = null;
DBPDataSource dataSource = request.editor.getDataSource();
if (dataSource != null) {
DBPPreferenceStore prefs = request.editor.getActivePreferenceStore();
// replace with full qualified name
if (!prefs.getBoolean(SQLPreferenceConstants.PROPOSAL_SHORT_NAME) && object instanceof DBSObjectReference) {
if (request.wordDetector.getFullWord().indexOf(request.editor.getSyntaxManager().getStructSeparator()) == -1) {
DBSObjectReference structObject = (DBSObjectReference) object;
if (structObject.getContainer() != null) {
DBSObject selectedObject = DBUtils.getActiveInstanceObject(dataSource);
if (selectedObject != structObject.getContainer()) {
replaceString = DBUtils.getFullQualifiedName(dataSource, structObject.getContainer() instanceof DBPDataSource ? null : structObject.getContainer(), object);
isSingleObject = false;
}
}
}
}
if (replaceString == null) {
if (prefs.getBoolean(SQLPreferenceConstants.PROPOSAL_ALWAYS_FQ) && object instanceof DBPQualifiedObject) {
replaceString = ((DBPQualifiedObject) object).getFullyQualifiedName(DBPEvaluationContext.DML);
} else {
replaceString = DBUtils.getQuotedIdentifier(dataSource, object.getName());
}
}
} else {
replaceString = DBUtils.getObjectShortName(object);
}
return createCompletionProposal(request, replaceString, objectName, DBPKeywordType.OTHER, objectIcon, isSingleObject, object);
}
Aggregations