use of net.hearthstats.osx.jna.NSUserNotificationCenter in project HearthStats.net-Uploader by HearthStats.
the class OsxNotificationQueue method add.
@Override
public void add(String header, String message, boolean allowFocus) {
debugLog.debug(" Showing OS X notification \"{}\", \"{}\"", header, message);
final NSAutoreleasePool pool = NSAutoreleasePool.new_();
try {
NSUserNotification nsUserNotification = NSUserNotification.CLASS.alloc();
nsUserNotification.setTitle(header);
nsUserNotification.setSubtitle(message);
NSUserNotificationCenter defaultNotificationCenter = NSUserNotificationCenter.CLASS.defaultUserNotificationCenter();
defaultNotificationCenter.setDelegate(defaultNotificationCenter);
defaultNotificationCenter.deliverNotification(nsUserNotification);
} finally {
pool.drain();
}
}
use of net.hearthstats.osx.jna.NSUserNotificationCenter in project HearthStats.net-Uploader by HearthStats.
the class OsxNotificationQueue method clearAllNotifications.
@Override
public void clearAllNotifications() {
debugLog.debug(" Clearing all notifications");
final NSAutoreleasePool pool = NSAutoreleasePool.new_();
try {
NSUserNotificationCenter defaultNotificationCenter = NSUserNotificationCenter.CLASS.defaultUserNotificationCenter();
defaultNotificationCenter.removeAllDeliveredNotifications();
} finally {
pool.drain();
}
}
Aggregations