use of org.jkiss.dbeaver.model.app.DBPPlatformLanguage 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.app.DBPPlatformLanguage in project dbeaver by serge-rider.
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;
}
use of org.jkiss.dbeaver.model.app.DBPPlatformLanguage in project dbeaver by serge-rider.
the class PrefPageDatabaseUserInterface method createContents.
@Override
protected Control createContents(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
if (isStandalone) {
Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, null, false, 2);
// automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
}
if (isStandalone) {
Group groupLanguage = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_language, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
workspaceLanguage = UIUtils.createLabelCombo(groupLanguage, CoreMessages.pref_page_ui_general_combo_language, CoreMessages.pref_page_ui_general_combo_language_tip, SWT.READ_ONLY | SWT.DROP_DOWN);
workspaceLanguage.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
List<PlatformLanguageDescriptor> languages = PlatformLanguageRegistry.getInstance().getLanguages();
DBPPlatformLanguage pLanguage = DBWorkbench.getPlatform().getLanguage();
for (int i = 0; i < languages.size(); i++) {
PlatformLanguageDescriptor lang = languages.get(i);
workspaceLanguage.add(lang.getLabel());
if (CommonUtils.equalObjects(pLanguage, lang)) {
workspaceLanguage.select(i);
}
}
if (workspaceLanguage.getSelectionIndex() < 0) {
workspaceLanguage.select(0);
}
Label tipLabel = UIUtils.createLabel(groupLanguage, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
// Notifications settings
{
Group notificationsGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_notifications, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
notificationsEnabled = UIUtils.createCheckbox(notificationsGroup, CoreMessages.pref_page_ui_general_label_enable_notifications, CoreMessages.pref_page_ui_general_label_enable_notifications_tip, false, 2);
notificationsCloseDelay = UIUtils.createLabelSpinner(notificationsGroup, CoreMessages.pref_page_ui_general_label_notifications_close_delay, 0, 0, Integer.MAX_VALUE);
}
// Agent settings
{
Group agentGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_task_bar, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
longOperationsCheck = UIUtils.createCheckbox(agentGroup, CoreMessages.pref_page_ui_general_label_enable_long_operations, CoreMessages.pref_page_ui_general_label_enable_long_operations_tip, false, 2);
longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, CoreMessages.pref_page_ui_general_label_long_operation_timeout + UIMessages.label_sec, 0, 0, Integer.MAX_VALUE);
if (RuntimeUtils.isPlatformMacOS()) {
ControlEnableState.disable(agentGroup);
}
}
performDefaults();
return composite;
}
use of org.jkiss.dbeaver.model.app.DBPPlatformLanguage in project dbeaver by dbeaver.
the class PrefPageDatabaseGeneral method createContents.
@Override
protected Control createContents(Composite parent) {
Composite composite = UIUtils.createPlaceholder(parent, 1, 5);
{
Group groupObjects = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_general, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
automaticUpdateCheck = UIUtils.createCheckbox(groupObjects, CoreMessages.pref_page_ui_general_checkbox_automatic_updates, null, false, 2);
// automaticUpdateCheck.setLayoutData(new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false, 2, 1));
}
{
Group groupLanguage = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_language, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
workspaceLanguage = UIUtils.createLabelCombo(groupLanguage, CoreMessages.pref_page_ui_general_combo_language, CoreMessages.pref_page_ui_general_combo_language_tip, SWT.READ_ONLY | SWT.DROP_DOWN);
workspaceLanguage.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
List<PlatformLanguageDescriptor> languages = PlatformLanguageRegistry.getInstance().getLanguages();
DBPPlatformLanguage pLanguage = DBeaverCore.getInstance().getLanguage();
for (int i = 0; i < languages.size(); i++) {
PlatformLanguageDescriptor lang = languages.get(i);
workspaceLanguage.add(lang.getLabel());
if (CommonUtils.equalObjects(pLanguage, lang)) {
workspaceLanguage.select(i);
}
}
if (workspaceLanguage.getSelectionIndex() < 0) {
workspaceLanguage.select(0);
}
Label tipLabel = UIUtils.createLabel(groupLanguage, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
// Agent settings
{
Group agentGroup = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_task_bar, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
longOperationsCheck = UIUtils.createCheckbox(agentGroup, CoreMessages.pref_page_ui_general_label_enable_long_operations, CoreMessages.pref_page_ui_general_label_enable_long_operations_tip, false, 2);
longOperationsTimeout = UIUtils.createLabelSpinner(agentGroup, CoreMessages.pref_page_ui_general_label_long_operation_timeout, 0, 0, Integer.MAX_VALUE);
if (RuntimeUtils.isPlatformMacOS()) {
ControlEnableState.disable(agentGroup);
}
}
/*
{
// Resources
Group groupResources = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_resources, 2, GridData.VERTICAL_ALIGN_BEGINNING, 0);
UIUtils.createControlLabel(groupResources, CoreMessages.pref_page_ui_general_label_default_resource_encoding);
defaultResourceEncoding = UIUtils.createEncodingCombo(groupResources, GeneralUtils.DEFAULT_ENCODING);
defaultResourceEncoding.setToolTipText(CoreMessages.pref_page_ui_general_label_set_default_resource_encoding_tip);
}
*/
{
// Logs
Group groupLogs = UIUtils.createControlGroup(composite, CoreMessages.pref_page_ui_general_group_debug_logs, 2, GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING, 0);
logsDebugEnabled = UIUtils.createCheckbox(groupLogs, CoreMessages.pref_page_ui_general_label_enable_debug_logs, CoreMessages.pref_page_ui_general_label_enable_debug_logs_tip, false, 2);
UIUtils.createControlLabel(groupLogs, CoreMessages.pref_page_ui_general_label_log_file_location);
logsDebugLocation = new TextWithOpenFile(groupLogs, CoreMessages.pref_page_ui_general_label_open_file_text, new String[] { "*.log", "*.txt" });
UIUtils.installContentProposal(logsDebugLocation.getTextControl(), new TextContentAdapter(), new SimpleContentProposalProvider(new String[] { GeneralUtils.variablePattern(SystemVariablesResolver.VAR_WORKSPACE), GeneralUtils.variablePattern(SystemVariablesResolver.VAR_HOME) }));
logsDebugLocation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label tipLabel = UIUtils.createLabel(groupLogs, CoreMessages.pref_page_ui_general_label_options_take_effect_after_restart);
tipLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING, GridData.VERTICAL_ALIGN_BEGINNING, false, false, 2, 1));
}
{
// Link to secure storage config
new PreferenceLinkArea(composite, SWT.NONE, PrefPageEntityEditor.PAGE_ID, "<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
new PreferenceLinkArea(composite, SWT.NONE, PrefPageSQLEditor.PAGE_ID, "<a>''{0}''</a>" + CoreMessages.pref_page_ui_general_label_settings, (IWorkbenchPreferenceContainer) getContainer(), // $NON-NLS-1$
null);
}
performDefaults();
return composite;
}
Aggregations