提交 1a0ba85f 编写于 作者: S serge-rider

#3278 Notifications preferences

上级 93b18b87
......@@ -3762,7 +3762,7 @@
<extension point="org.eclipse.mylyn.commons.notifications.ui.notifications">
<category id="org.jkiss.dbeaver.notifications.database.category" label="Database"/>
<sink id="org.jkiss.dbeaver.notifications.sink.Popup" class="org.jkiss.dbeaver.ui.notifications.DatabaseNotificationSink" label="Desktop Popup"/>
<sink id="org.jkiss.dbeaver.notifications.sink.Popup" class="org.jkiss.dbeaver.ui.notifications.DatabaseNotificationSink" label="Notify Popup"/>
<event categoryId="org.jkiss.dbeaver.notifications.database.category" id="org.jkiss.dbeaver.notifications.event.commit" label="Commit">
<defaultHandler sinkId="org.jkiss.dbeaver.notifications.sink.Popup"/>
......
......@@ -26,6 +26,9 @@ public final class DBeaverPreferences
public static final String AGENT_LONG_OPERATION_NOTIFY = "agent.long.operation.notify"; //$NON-NLS-1$
public static final String AGENT_LONG_OPERATION_TIMEOUT = "agent.long.operation.timeout"; //$NON-NLS-1$
public static final String NOTIFICATIONS_ENABLED = "notifications.enabled"; //$NON-NLS-1$
public static final String NOTIFICATIONS_CLOSE_DELAY_TIMEOUT = "notifications.closeDelay"; //$NON-NLS-1$
public static final String PLATFORM_LANGUAGE = "platform.language"; //$NON-NLS-1$
public static final String NAVIGATOR_EXPAND_ON_CONNECT = "navigator.expand.on.connect"; //$NON-NLS-1$
......
......@@ -1130,6 +1130,10 @@ public class CoreMessages extends NLS {
public static String pref_page_ui_general_label_enable_long_operations;
public static String pref_page_ui_general_label_enable_long_operations_tip;
public static String pref_page_ui_general_label_long_operation_timeout;
public static String pref_page_ui_general_group_notifications;
public static String pref_page_ui_general_label_enable_notifications;
public static String pref_page_ui_general_label_enable_notifications_tip;
public static String pref_page_ui_general_label_notifications_close_delay;
public static String pref_page_ui_general_group_resources;
public static String pref_page_ui_general_label_default_resource_encoding;
public static String pref_page_ui_general_label_set_default_resource_encoding_tip;
......
......@@ -1083,6 +1083,11 @@ pref_page_ui_general_group_task_bar = Task Bar
pref_page_ui_general_label_enable_long_operations = Enable long-time operations notification
pref_page_ui_general_label_enable_long_operations_tip = Shows special notification in system taskbar after long-time operation (e.g. SQL query) finish.
pref_page_ui_general_label_long_operation_timeout = Long-time operation timeout
pref_page_ui_general_group_notifications = Notifications
pref_page_ui_general_label_enable_notifications = Enable notification popup
pref_page_ui_general_label_enable_notifications_tip = Enabled/disable notification popup (appears in the right bottom corner of workbench)
pref_page_ui_general_label_notifications_close_delay = Delay before popup auto-hide (ms)
pref_page_ui_general_group_resources = Resources
pref_page_ui_general_label_default_resource_encoding = Default resource encoding
pref_page_ui_general_label_set_default_resource_encoding_tip = Default encoding for scripts and text files. Change requires restart
......
......@@ -63,6 +63,10 @@ public class DBeaverPreferencesInitializer extends AbstractPreferenceInitializer
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY, isWindows);
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT, 30);
// Notifications
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NOTIFICATIONS_ENABLED, true);
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT, 5000L);
// Navigator
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_EXPAND_ON_CONNECT, false);
PrefUtils.setDefaultPreferenceValue(store, DBeaverPreferences.NAVIGATOR_SORT_ALPHABETICALLY, false);
......
......@@ -52,6 +52,7 @@ import java.util.List;
public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbenchPreferencePage, IWorkbenchPropertyPage
{
public static final String PAGE_ID = "org.jkiss.dbeaver.preferences.main.common"; //$NON-NLS-1$
private static final String NOTIFICATIONS_PAGE_ID = "org.eclipse.mylyn.commons.notifications.preferencePages.Notifications";
private Button automaticUpdateCheck;
private Combo workspaceLanguage;
......@@ -59,7 +60,8 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
private Button longOperationsCheck;
private Spinner longOperationsTimeout;
//private Combo defaultResourceEncoding;
private Button notificationsEnabled;
private Spinner notificationsCloseDelay;
public PrefPageDatabaseGeneral()
{
......@@ -105,6 +107,23 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
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);
// Link to notifications config
new PreferenceLinkArea(notificationsGroup, SWT.NONE,
NOTIFICATIONS_PAGE_ID,
"<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings,
(IWorkbenchPreferenceContainer) getContainer(), null); //$NON-NLS-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);
......@@ -120,28 +139,16 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
}
}
/*
{
// 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);
}
*/
{
// Link to secure storage config
new PreferenceLinkArea(composite, SWT.NONE,
PrefPageEntityEditor.PAGE_ID,
"<a>''{0}''</a> "+CoreMessages.pref_page_ui_general_label_settings,
"<a>''{0}''</a> " + CoreMessages.pref_page_ui_general_label_settings,
(IWorkbenchPreferenceContainer) getContainer(), null); //$NON-NLS-1$
new PreferenceLinkArea(composite, SWT.NONE,
PrefPageSQLEditor.PAGE_ID,
"<a>''{0}''</a>"+CoreMessages.pref_page_ui_general_label_settings,
"<a>''{0}''</a>" + CoreMessages.pref_page_ui_general_label_settings,
(IWorkbenchPreferenceContainer) getContainer(), null); //$NON-NLS-1$
}
......@@ -157,6 +164,10 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
automaticUpdateCheck.setSelection(store.getBoolean(DBeaverPreferences.UI_AUTO_UPDATE_CHECK));
notificationsEnabled.setSelection(store.getBoolean(DBeaverPreferences.NOTIFICATIONS_ENABLED));
notificationsCloseDelay.setSelection(store.getInt(DBeaverPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT));
longOperationsCheck.setSelection(store.getBoolean(DBeaverPreferences.AGENT_LONG_OPERATION_NOTIFY));
longOperationsTimeout.setSelection(store.getInt(DBeaverPreferences.AGENT_LONG_OPERATION_TIMEOUT));
}
......@@ -167,12 +178,13 @@ public class PrefPageDatabaseGeneral extends AbstractPrefPage implements IWorkbe
DBPPreferenceStore store = DBeaverCore.getGlobalPreferenceStore();
store.setValue(DBeaverPreferences.UI_AUTO_UPDATE_CHECK, automaticUpdateCheck.getSelection());
//store.setValue(DBeaverPreferences.AGENT_ENABLED, agentEnabledCheck.getSelection());
store.setValue(DBeaverPreferences.NOTIFICATIONS_ENABLED, notificationsEnabled.getSelection());
store.setValue(DBeaverPreferences.NOTIFICATIONS_CLOSE_DELAY_TIMEOUT, notificationsCloseDelay.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);
if (workspaceLanguage.getSelectionIndex() >= 0) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册