use of org.jkiss.dbeaver.registry.language.PlatformLanguageDescriptor in project dbeaver by dbeaver.
the class PrefPageDatabaseUserInterface method performOk.
@Override
public boolean performOk() {
DBPPreferenceStore store = DBWorkbench.getPlatform().getPreferenceStore();
if (isStandalone) {
store.setValue(DBeaverPreferences.UI_AUTO_UPDATE_CHECK, automaticUpdateCheck.getSelection());
}
store.setValue(ModelPreferences.NOTIFICATIONS_ENABLED, notificationsEnabled.getSelection());
store.setValue(ModelPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT, notificationsCloseDelay.getSelection());
store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY, longOperationsCheck.getSelection());
store.setValue(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT, longOperationsTimeout.getSelection());
PrefUtils.savePreferenceStore(store);
if (workspaceLanguage.getSelectionIndex() >= 0) {
PlatformLanguageDescriptor language = PlatformLanguageRegistry.getInstance().getLanguages().get(workspaceLanguage.getSelectionIndex());
try {
DBPPlatformLanguage curLanguage = DBWorkbench.getPlatform().getLanguage();
if (curLanguage != language) {
((DBPPlatformLanguageManager) DBWorkbench.getPlatform()).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?")) {
UIUtils.asyncExec(() -> PlatformUI.getWorkbench().restart());
}
}
} catch (DBException e) {
DBWorkbench.getPlatformUI().showError("Change language", "Can't switch language to " + language, e);
}
}
return true;
}
Aggregations