提交 7ca3349c 编写于 作者: S serge-rider

#3278 Reconnect notification

上级 9814b8a3
......@@ -3776,6 +3776,12 @@
This event is triggered when transaction was rolled back.
</description>
</event>
<event categoryId="org.jkiss.dbeaver.notifications.database.category" id="org.jkiss.dbeaver.notifications.event.reconnect" label="Reconnect">
<defaultHandler sinkId="org.jkiss.dbeaver.notifications.sink.Popup"/>
<description>
This event is triggered when connection was automatically reconnected.
</description>
</event>
</extension>
<!-- FIXME: Disabled because it breaks dark theme. -->
......
......@@ -17,21 +17,20 @@
package org.jkiss.dbeaver.ui;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.jkiss.dbeaver.DBeaverPreferences;
import org.jkiss.dbeaver.core.DBeaverCore;
import org.jkiss.dbeaver.model.DBPDataSource;
import org.jkiss.dbeaver.model.DBPMessageType;
import org.jkiss.dbeaver.ui.notifications.NotificationPopupMessage;
import org.jkiss.dbeaver.ui.notifications.NotificationUtils;
/**
* DBeaverIcons
* Notifications utilities
*/
public class DBeaverNotifications
{
public static final String NT_COMMIT = "commit";
public static final String NT_ROLLBACK = "rollback";
public static final String NT_RECONNECT = "reconnect";
public static void showNotification(DBPDataSource dataSource, String id, String text) {
NotificationUtils.sendNotification(dataSource, id, text, null, null);
}
......
......@@ -56,7 +56,7 @@ public class DataSourceCommitHandler extends AbstractDataSourceHandler
DBeaverNotifications.showNotification(
context.getDataSource(),
"commit",
DBeaverNotifications.NT_COMMIT,
"Transaction has been committed\n\n" +
"Query count: " + txnInfo.getUpdateCount() + "\n" +
"Duration: " + RuntimeUtils.formatExecutionTime(System.currentTimeMillis() - txnInfo.getTransactionStartTime()) + "\n",
......
......@@ -57,7 +57,7 @@ public class DataSourceRollbackHandler extends AbstractDataSourceHandler
}
DBeaverNotifications.showNotification(
context.getDataSource(),
"rollback",
DBeaverNotifications.NT_ROLLBACK,
"Transaction has been rolled back\n\n" +
"Query count: " + txnInfo.getUpdateCount() + "\n" +
"Duration: " + RuntimeUtils.formatExecutionTime(System.currentTimeMillis() - txnInfo.getTransactionStartTime()) + "\n",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册