aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/impl/osdependent
diff options
context:
space:
mode:
authorDamian Minkov <damencho@jitsi.org>2013-02-25 09:47:07 +0000
committerDamian Minkov <damencho@jitsi.org>2013-02-25 09:47:07 +0000
commit29cf3a8243e8b172c1b23d7b5321fdb33fd8f35c (patch)
tree5bd056883a4ff2a1fa5ee9a02e75e28d7ecfb95f /src/net/java/sip/communicator/impl/osdependent
parent6476071892dcf446442957d5075f874bd093fdea (diff)
downloadjitsi-29cf3a8243e8b172c1b23d7b5321fdb33fd8f35c.zip
jitsi-29cf3a8243e8b172c1b23d7b5321fdb33fd8f35c.tar.gz
jitsi-29cf3a8243e8b172c1b23d7b5321fdb33fd8f35c.tar.bz2
Dispatches calls to addPopupMessageListener before we have initialized the SystrayService (waiting for UIService).
Diffstat (limited to 'src/net/java/sip/communicator/impl/osdependent')
-rw-r--r--src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java
index d6f9446..35c02d2 100644
--- a/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java
+++ b/src/net/java/sip/communicator/impl/osdependent/jdic/SystrayServiceJdicImpl.java
@@ -10,6 +10,7 @@ import java.awt.*;
import java.awt.event.*;
import java.net.*;
import java.util.*;
+import java.util.List;
import javax.swing.*;
import javax.swing.event.*;
@@ -128,6 +129,12 @@ public class SystrayServiceJdicImpl
= new SystrayPopupMessageListenerImpl();
/**
+ * List of listeners from early received calls to addPopupMessageListener.
+ * Calls to addPopupMessageListener before the UIService is registered.
+ */
+ private List<SystrayPopupMessageListener> earlyAddedListeners = null;
+
+ /**
* Initializes a new <tt>SystrayServiceJdicImpl</tt> instance.
*/
public SystrayServiceJdicImpl()
@@ -432,6 +439,8 @@ public class SystrayServiceJdicImpl
/**
* Implements the <tt>SystrayService.addPopupMessageListener</tt> method.
+ * If <tt>activePopupHandler</tt> is still not available record the listener
+ * so we can add him later.
*
* @param listener the listener to add
*/
@@ -439,6 +448,14 @@ public class SystrayServiceJdicImpl
{
if (activePopupHandler != null)
activePopupHandler.addPopupMessageListener(listener);
+ else
+ {
+ if(earlyAddedListeners == null)
+ earlyAddedListeners =
+ new ArrayList<SystrayPopupMessageListener>();
+
+ earlyAddedListeners.add(listener);
+ }
}
/**
@@ -590,6 +607,17 @@ public class SystrayServiceJdicImpl
+ newHandler);
}
activePopupHandler = newHandler;
+ // if we have received calls to addPopupMessageListener before
+ // the UIService is registered we should add those listeners
+ if(earlyAddedListeners != null)
+ {
+ for(SystrayPopupMessageListener l : earlyAddedListeners)
+ activePopupHandler.addPopupMessageListener(l);
+
+ earlyAddedListeners.clear();
+ earlyAddedListeners = null;
+ }
+
return oldHandler;
}