actionType,
handler,
handler.isEnabled(),
true);
EventNotification notification = null;
if(notificationsTable.containsKey(eventType))
notification = notificationsTable.get(eventType);
else
{
notification = new EventNotification(eventType);
notificationsTable.put(eventType, notification);
}
notification.addAction(actionType, handler);
// We fire the appropriate event depending on whether this is an
// already existing actionType or a new one.
fireNotificationActionTypeEvent(
isNew ? NotificationActionTypeEvent.ACTION_ADDED
: NotificationActionTypeEvent.ACTION_CHANGED, eventType,
actionType, handler);
}
// now store this default events if we want to restore them
EventNotification notification = null;
if(defaultNotificationsTable.containsKey(eventType))
notification = defaultNotificationsTable.get(eventType);
else
{
notification = new EventNotification(eventType);
defaultNotificationsTable.put(eventType, notification);
}
NotificationActionHandler handler = null;
if (actionType.equals(NotificationService.ACTION_SOUND))
{
handler = new SoundNotificationHandlerImpl(actionDescriptor, -1);
}
else if (actionType.equals(NotificationService.ACTION_LOG_MESSAGE))
{
handler = new LogMessageNotificationHandlerImpl(
LogMessageNotificationHandler.INFO_LOG_TYPE);
}
else if (actionType.equals(NotificationService.ACTION_POPUP_MESSAGE))
{
handler = new PopupMessageNotificationHandlerImpl(defaultMessage);
}
else if (actionType.equals(NotificationService.ACTION_COMMAND))
{
handler = new CommandNotificationHandlerImpl(actionDescriptor);
}
notification.addAction(actionType, handler);
}