diff --git a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java index 02a035f04..6ec137fdf 100644 --- a/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java +++ b/src/net/java/sip/communicator/impl/gui/UIServiceImpl.java @@ -40,6 +40,7 @@ * bundles to this particular swing ui implementation. * * @author Yana Stamcheva + * @author Lubomir Marinov */ public class UIServiceImpl implements UIService, @@ -52,14 +53,12 @@ public class UIServiceImpl private AccountRegWizardContainerImpl wizardContainer; - private Map> registeredPlugins - = new Hashtable>(); - private Vector pluginComponentListeners = new Vector(); private static final List supportedContainers = new ArrayList(); + static { supportedContainers.add(Container.CONTAINER_MAIN_TOOL_BAR); @@ -100,6 +99,15 @@ public void loadApplicationGui() this.mainFrame = new MainFrame(); + /* + * The mainFrame isn't fully ready without the MetaContactListService so + * make sure it's set before allowing anything, such as LoginManager, to + * use the mainFrame. Otherwise, LoginManager, for example, will call + * back from its event listener(s) into the mainFrame and cause a + * NullPointerException. + */ + mainFrame.setContactList(GuiActivator.getMetaContactListService()); + this.mainFrame.initBounds(); GuiActivator.getUIService().registerExportedWindow(mainFrame); @@ -112,8 +120,6 @@ public void loadApplicationGui() this.configurationFrame = new ConfigurationFrame(mainFrame); - mainFrame.setContactList(GuiActivator.getMetaContactListService()); - if (ConfigurationManager.isTransparentWindowEnabled()) { try @@ -151,7 +157,7 @@ public Iterator getSupportedContainers() * Creates the corresponding PluginComponentEvent and notifies all * ContainerPluginListeners that a plugin component is added or * removed from the container. - * + * * @param pluginComponent the plugin component that is added to the * container. * @param containerID the containerID that corresponds to the container @@ -159,24 +165,22 @@ public Iterator getSupportedContainers() * @param eventID one of the PLUGIN_COMPONENT_XXX static fields indicating * the nature of the event. */ - private void firePluginEvent( PluginComponent pluginComponent, - int eventID) + private void firePluginEvent(PluginComponent pluginComponent, int eventID) { - PluginComponentEvent evt - = new PluginComponentEvent( pluginComponent, - eventID); + PluginComponentEvent evt = + new PluginComponentEvent(pluginComponent, eventID); logger.debug("Will dispatch the following plugin component event: " + evt); synchronized (pluginComponentListeners) { - Iterator listeners = this.pluginComponentListeners.iterator(); + Iterator listeners = + this.pluginComponentListeners.iterator(); while (listeners.hasNext()) { - PluginComponentListener l = (PluginComponentListener) listeners - .next(); + PluginComponentListener l = listeners.next(); switch (evt.getEventID()) { @@ -426,15 +430,6 @@ public void unregisterExportedWindow(ExportedWindow window) } } - /** - * Sets the contact list service to this UI Service implementation. - * @param contactList the MetaContactList service - */ - public void setContactList(MetaContactListService contactList) - { - this.mainFrame.setContactList(contactList); - } - public void addPluginComponentListener(PluginComponentListener l) { synchronized (pluginComponentListeners) @@ -680,18 +675,6 @@ public void run() { } } - /** - * The RunApplication implements the Runnable interface and is used to - * shows the main application window in a separate thread. - */ - private class RunApplicationGui implements Runnable - { - public void run() - { - mainFrame.setVisible(true); - } - } - /** * Sets the look&feel and the theme. */ @@ -862,64 +845,6 @@ else if (containerConstraints.equals(Container.RIGHT)) return layoutConstraint; } - private class DefaultPluginComponent implements PluginComponent - { - private Component component; - - private Container container; - - public DefaultPluginComponent( Component component, - Container container) - { - this.component = component; - this.container = container; - } - - public Object getComponent() - { - return component; - } - - public String getConstraints() - { - return Container.END; - } - - public Container getContainer() - { - return container; - } - - public String getName() - { - return component.getName(); - } - - public void setCurrentContact(MetaContact metaContact) - { - if (component instanceof ContactAwareComponent) - ((ContactAwareComponent) component) - .setCurrentContact(metaContact); - } - - public void setCurrentContactGroup(MetaContactGroup metaGroup) - { - if (component instanceof ContactAwareComponent) - ((ContactAwareComponent) component) - .setCurrentContactGroup(metaGroup); - } - - public int getPositionIndex() - { - return -1; - } - - public boolean isNativeComponent() - { - return false; - } - } - public void propertyChange(PropertyChangeEvent evt) { if (evt.getPropertyName().equals(