提交 a3175679 编写于 作者: S Serge Rider

#6502 Tray notifications: error handle added


Former-commit-id: 06dce512
上级 bac27e25
......@@ -17,6 +17,7 @@
package org.jkiss.dbeaver.ui;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.equinox.http.servlet.internal.util.Throw;
import org.eclipse.swt.widgets.Shell;
import org.jkiss.dbeaver.Log;
import org.jkiss.dbeaver.utils.GeneralUtils;
......@@ -121,22 +122,26 @@ public class TrayIconHandler {
public void notify(String message, int status)
{
if (trayItem == null) {
try {
show();
} catch (Exception e) {
log.warn("Can't show tray item", e);
return;
try {
if (trayItem == null) {
try {
show();
} catch (Exception e) {
log.warn("Can't show tray item", e);
return;
}
}
TrayIcon.MessageType type;
switch (status) {
case IStatus.INFO: type = TrayIcon.MessageType.INFO; break;
case IStatus.ERROR: type = TrayIcon.MessageType.ERROR; break;
case IStatus.WARNING: type = TrayIcon.MessageType.WARNING; break;
default: type = TrayIcon.MessageType.NONE; break;
}
trayItem.displayMessage(GeneralUtils.getProductTitle(), message, type);
} catch (Throwable e) {
log.error("Error showing tray notification", e);
}
TrayIcon.MessageType type;
switch (status) {
case IStatus.INFO: type = TrayIcon.MessageType.INFO; break;
case IStatus.ERROR: type = TrayIcon.MessageType.ERROR; break;
case IStatus.WARNING: type = TrayIcon.MessageType.WARNING; break;
default: type = TrayIcon.MessageType.NONE; break;
}
trayItem.displayMessage(GeneralUtils.getProductTitle(), message, type);
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册