diff --git a/src/net/java/sip/communicator/impl/gui/GuiActivator.java b/src/net/java/sip/communicator/impl/gui/GuiActivator.java index d239bdef8..c07b63cdf 100644 --- a/src/net/java/sip/communicator/impl/gui/GuiActivator.java +++ b/src/net/java/sip/communicator/impl/gui/GuiActivator.java @@ -32,8 +32,7 @@ */ public class GuiActivator implements BundleActivator { - private static Logger logger - = Logger.getLogger(GuiActivator.class.getName()); + private static final Logger logger = Logger.getLogger(GuiActivator.class); private static UIServiceImpl uiService = null; diff --git a/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java b/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java index 041398ccd..3d2a02732 100644 --- a/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java +++ b/src/net/java/sip/communicator/impl/gui/utils/NotificationManager.java @@ -6,8 +6,6 @@ */ package net.java.sip.communicator.impl.gui.utils; -import java.util.*; - import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.notification.*; @@ -24,9 +22,7 @@ public class NotificationManager public static final String BUSY_CALL = "BusyCall"; public static final String PROACTIVE_NOTIFICATION = "ProactiveNotification"; - - private static Hashtable soundHandlers = new Hashtable(); - + public static void registerGuiNotifications() { NotificationService notificationService @@ -64,8 +60,6 @@ public static void registerGuiNotifications() NotificationService.ACTION_SOUND, inCallSoundHandler); - soundHandlers.put(INCOMING_CALL, inCallSoundHandler); - // Register outgoing call notifications. SoundNotificationHandler outCallSoundHandler = (SoundNotificationHandler) notificationService @@ -75,8 +69,6 @@ public static void registerGuiNotifications() OUTGOING_CALL, NotificationService.ACTION_SOUND, outCallSoundHandler); - - soundHandlers.put(OUTGOING_CALL, outCallSoundHandler); // Register busy call notifications. SoundNotificationHandler busyCallSoundHandler @@ -87,8 +79,6 @@ public static void registerGuiNotifications() BUSY_CALL, NotificationService.ACTION_SOUND, busyCallSoundHandler); - - soundHandlers.put(OUTGOING_CALL, outCallSoundHandler); // Register proactive notifications. notificationService.registerDefaultNotificationForEvent( diff --git a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java index d93e387a3..9e89f1f3e 100644 --- a/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java +++ b/src/net/java/sip/communicator/impl/notification/NotificationServiceImpl.java @@ -289,24 +289,20 @@ public Iterator getRegisteredEvents() */ public Map getEventNotifications(String eventType) { - Hashtable actions = new Hashtable(); + EventNotification notification = notificationsTable.get(eventType); - EventNotification notification - = (EventNotification) notificationsTable.get(eventType); - if(notification == null) return null; - Iterator srcActions = notification.getActions().values().iterator(); - - while(srcActions.hasNext()) + Hashtable actions = new Hashtable(); + + for (Object value : notification.getActions().values()) { - Action action = (Action) srcActions.next(); + Action action = (Action) value; + NotificationActionHandler handler = action.getActionHandler(); - if(action.getActionHandler() != null) - actions.put(action.getActionType(), action.getActionHandler()); - else - actions.put(action.getActionType(), ""); + actions.put(action.getActionType(), (handler == null) ? "" + : handler); } return actions; @@ -914,7 +910,7 @@ public void registerDefaultNotificationForEvent( actionType, handler); } - // now store this default events if we want to retore them + // now store this default events if we want to restore them EventNotification notification = null; if(defaultNotificationsTable.containsKey(eventType)) diff --git a/src/net/java/sip/communicator/impl/systray/SystrayActivator.java b/src/net/java/sip/communicator/impl/systray/SystrayActivator.java index b606b16eb..f9e77dbd0 100644 --- a/src/net/java/sip/communicator/impl/systray/SystrayActivator.java +++ b/src/net/java/sip/communicator/impl/systray/SystrayActivator.java @@ -31,8 +31,8 @@ public class SystrayActivator private static ConfigurationService configService; - private static Logger logger = Logger.getLogger( - SystrayActivator.class.getName()); + private static final Logger logger = + Logger.getLogger(SystrayActivator.class); /** * Called when this bundle is started. diff --git a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java index eb4163fe7..b59a2270b 100644 --- a/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java +++ b/src/net/java/sip/communicator/impl/systray/jdic/SystrayServiceJdicImpl.java @@ -30,9 +30,10 @@ * * @author Nicolas Chamouard * @author Yana Stamcheva + * @author Lubomir Marinov */ public class SystrayServiceJdicImpl - implements SystrayService + implements SystrayService { /** * The systray. @@ -52,12 +53,14 @@ public class SystrayServiceJdicImpl /** * The list of all added popup message listeners. */ - private Vector popupMessageListeners = new Vector(); + private final List popupMessageListeners = + new Vector(); /** * List of all messages waiting to be shown. */ - private ArrayList messageQueue = new ArrayList(); + private final List messageQueue = + new ArrayList(); private Timer popupTimer = new Timer(); @@ -324,16 +327,12 @@ public void saveStatusInformation( { String prefix = "net.java.sip.communicator.impl.gui.accounts"; - List accounts = configService + List accounts = configService .getPropertyNamesByPrefix(prefix, true); boolean savedAccount = false; - Iterator accountsIter = accounts.iterator(); - - while(accountsIter.hasNext()) { - String accountRootPropName - = (String) accountsIter.next(); + for (String accountRootPropName : accounts) { String accountUID = configService.getString(accountRootPropName); @@ -439,17 +438,16 @@ private void firePopupMessageEvent(Object sourceObject) logger.trace("Will dispatch the following systray msg event: " + evt); - Iterator listeners = null; + List listeners; synchronized (popupMessageListeners) { - listeners = new ArrayList(popupMessageListeners).iterator(); + listeners = + new ArrayList( + popupMessageListeners); } - while (listeners.hasNext()) + for (SystrayPopupMessageListener listener : listeners) { - SystrayPopupMessageListener listener - = (SystrayPopupMessageListener) listeners.next(); - listener.popupMessageClicked(evt); } } @@ -576,7 +574,7 @@ public void run() int messageNumber = messageQueue.size(); - SystrayMessage msg = (SystrayMessage) messageQueue.get(0); + SystrayMessage msg = messageQueue.get(0); if(messageNumber > maxMessageNumber) {