Package org.openstreetmap.josm.io
Class MessageNotifier
- java.lang.Object
-
- org.openstreetmap.josm.io.MessageNotifier
-
public final class MessageNotifier extends java.lang.Object
Notifies user periodically of new received (unread) messages- Since:
- 6349
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
MessageNotifier.NotifierCallback
Called when new new messages are detected.private static class
MessageNotifier.Worker
-
Field Summary
Fields Modifier and Type Field Description private static MessageNotifier.NotifierCallback
callback
private static java.util.concurrent.ScheduledExecutorService
EXECUTOR
static IntegerProperty
PROP_INTERVAL
Property defining the update interval in minutesstatic BooleanProperty
PROP_NOTIFIER_ENABLED
Property defining if this task is enabled or notprivate static java.util.concurrent.ScheduledFuture<?>
task
private static java.lang.Runnable
WORKER
-
Constructor Summary
Constructors Modifier Constructor Description private
MessageNotifier()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
isRunning()
Determines if the message notifier is currently runningstatic boolean
isUserEnoughIdentified()
Determines if user set enough information in JOSM preferences to make the request to OSM API without prompting him for a password.static void
setNotifierCallback(MessageNotifier.NotifierCallback notifierCallback)
Sets theMessageNotifier.NotifierCallback
responsible of notifying the user when new messages are received.static void
start()
Starts the message notifier task if not already started and if user is fully identifiedstatic void
stop()
Stops the message notifier task if started
-
-
-
Field Detail
-
callback
private static volatile MessageNotifier.NotifierCallback callback
-
PROP_NOTIFIER_ENABLED
public static final BooleanProperty PROP_NOTIFIER_ENABLED
Property defining if this task is enabled or not
-
PROP_INTERVAL
public static final IntegerProperty PROP_INTERVAL
Property defining the update interval in minutes
-
EXECUTOR
private static final java.util.concurrent.ScheduledExecutorService EXECUTOR
-
WORKER
private static final java.lang.Runnable WORKER
-
task
private static volatile java.util.concurrent.ScheduledFuture<?> task
-
-
Constructor Detail
-
MessageNotifier
private MessageNotifier()
-
-
Method Detail
-
setNotifierCallback
public static void setNotifierCallback(MessageNotifier.NotifierCallback notifierCallback)
Sets theMessageNotifier.NotifierCallback
responsible of notifying the user when new messages are received.- Parameters:
notifierCallback
- the newNotifierCallback
-
start
public static void start()
Starts the message notifier task if not already started and if user is fully identified
-
stop
public static void stop()
Stops the message notifier task if started
-
isRunning
public static boolean isRunning()
Determines if the message notifier is currently running- Returns:
true
if the notifier is running,false
otherwise
-
isUserEnoughIdentified
public static boolean isUserEnoughIdentified()
Determines if user set enough information in JOSM preferences to make the request to OSM API without prompting him for a password.- Returns:
true
if user chose an OAuth token or supplied both its username and password,false otherwise
-
-