Fix plugin listeners.

cusax-fix
Yana Stamcheva 18 years ago
parent 4b884386ed
commit 5cfe944d37

@ -66,9 +66,9 @@ public void start(BundleContext bundleContext) throws Exception {
NotificationManager.registerGuiNotifications(); NotificationManager.registerGuiNotifications();
bundleContext.addServiceListener(new NotificationServiceListener()); bundleContext.addServiceListener(new NotificationServiceListener());
ConfigurationManager.loadGuiConfigurations(); ConfigurationManager.loadGuiConfigurations();
try { try {
// Create the ui service // Create the ui service
this.uiService = new UIServiceImpl(); this.uiService = new UIServiceImpl();
@ -87,6 +87,8 @@ public void start(BundleContext bundleContext) throws Exception {
finally { finally {
logger.logExit(); logger.logExit();
} }
bundleContext.addServiceListener(uiService);
} }
/** /**

@ -12,8 +12,6 @@
import javax.swing.*; import javax.swing.*;
import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.event.*; import net.java.sip.communicator.impl.gui.event.*;
import net.java.sip.communicator.impl.gui.lookandfeel.*; import net.java.sip.communicator.impl.gui.lookandfeel.*;
import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.*;
@ -27,10 +25,11 @@
import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/** /**
* An implementation of the <tt>UIService</tt> that gives access to other * An implementation of the <tt>UIService</tt> that gives access to other
* bundles to this particular swing ui implementation. * bundles to this particular swing ui implementation.
@ -360,7 +359,7 @@ private void firePluginEvent( PluginComponent pluginComponent,
= new PluginComponentEvent( pluginComponent, = new PluginComponentEvent( pluginComponent,
eventID); eventID);
logger.trace("Will dispatch the following plugin component event: " logger.debug("Will dispatch the following plugin component event: "
+ evt); + evt);
synchronized (pluginComponentListeners) synchronized (pluginComponentListeners)
@ -856,7 +855,7 @@ public void serviceChanged(ServiceEvent event)
if (event.getType() == ServiceEvent.REGISTERED) if (event.getType() == ServiceEvent.REGISTERED)
{ {
logger logger
.debug("Handling registration of a new Plugin Component."); .info("Handling registration of a new Plugin Component.");
if(!(pluginComponent.getComponent() instanceof Component)) if(!(pluginComponent.getComponent() instanceof Component))
{ {

@ -1298,26 +1298,25 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent c = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]); {
PluginComponent c = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);
Object constraints = null; Object constraints = null;
if (c.getConstraints() != null) if (c.getConstraints() != null)
constraints = UIServiceImpl constraints = UIServiceImpl
.getBorderLayoutConstraintsFromContainer(c.getConstraints()); .getBorderLayoutConstraintsFromContainer(c.getConstraints());
else else
constraints = BorderLayout.SOUTH; constraints = BorderLayout.SOUTH;
this.getContentPane().add( (Component) c.getComponent(), this.getContentPane().add( (Component) c.getComponent(),
constraints); constraints);
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);
} }

@ -76,7 +76,7 @@ public MainTabbedPane(MainFrame parent) {
this.addChangeListener(this); this.addChangeListener(this);
GuiActivator.getUIService().addPluginComponentListener(this); this.initPluginComponents();
} }
/** /**
@ -175,16 +175,16 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
this.addTab(component.getName(), .bundleContext.getService(serRefs[i]);;
(Component) component.getComponent());
this.addTab(component.getName(),
(Component) component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -138,15 +138,15 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.pluginPanel.add((Component)component.getComponent()); this.pluginPanel.add((Component)component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -13,23 +13,21 @@
import javax.swing.*; import javax.swing.*;
import org.osgi.framework.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.customcontrols.*; import net.java.sip.communicator.impl.gui.customcontrols.*;
import net.java.sip.communicator.impl.gui.customcontrols.events.*; import net.java.sip.communicator.impl.gui.customcontrols.events.*;
import net.java.sip.communicator.impl.gui.event.*; import net.java.sip.communicator.impl.gui.event.*;
import net.java.sip.communicator.impl.gui.main.*; import net.java.sip.communicator.impl.gui.main.*;
import net.java.sip.communicator.impl.gui.main.MainFrame.*;
import net.java.sip.communicator.impl.gui.main.chat.menus.*; import net.java.sip.communicator.impl.gui.main.chat.menus.*;
import net.java.sip.communicator.impl.gui.main.chat.toolBars.*; import net.java.sip.communicator.impl.gui.main.chat.toolBars.*;
import net.java.sip.communicator.impl.gui.utils.*; import net.java.sip.communicator.impl.gui.utils.*;
import net.java.sip.communicator.impl.gui.utils.Constants; import net.java.sip.communicator.impl.gui.utils.Constants;
import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.service.gui.Container; import net.java.sip.communicator.service.gui.Container;
import net.java.sip.communicator.service.gui.event.*;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/** /**
* The chat window is the place, where users can write and send messages, view * The chat window is the place, where users can write and send messages, view
* received messages. The ChatWindow supports two modes of use: "Group all * received messages. The ChatWindow supports two modes of use: "Group all
@ -676,18 +674,19 @@ private void initPluginComponents()
logger.error("Could not obtain plugin component reference.", exc); logger.error("Could not obtain plugin component reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent c = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);
Object borderLayoutConstraint = UIServiceImpl for (int i = 0; i < serRefs.length; i ++)
.getBorderLayoutConstraintsFromContainer(c.getConstraints()); {
PluginComponent c = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);
this.add((Component)c.getComponent(), borderLayoutConstraint); Object borderLayoutConstraint = UIServiceImpl
.getBorderLayoutConstraintsFromContainer(c.getConstraints());
this.add((Component)c.getComponent(), borderLayoutConstraint);
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -92,15 +92,15 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -400,18 +400,18 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -403,18 +403,18 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
this.revalidate(); this.revalidate();
this.repaint(); this.repaint();
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -384,17 +384,17 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
component.setCurrentContact(contactItem); component.setCurrentContact(contactItem);
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -166,19 +166,19 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
component.setCurrentContactGroup(group); component.setCurrentContactGroup(group);
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
this.repaint(); this.repaint();
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -212,31 +212,30 @@ else if(selectedValue instanceof MetaContactGroup)
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
Object selectedValue = mainFrame.getContactListPanel() Object selectedValue = mainFrame.getContactListPanel()
.getContactList().getSelectedValue(); .getContactList().getSelectedValue();
if(selectedValue instanceof MetaContact) if(selectedValue instanceof MetaContact)
{ {
component.setCurrentContact((MetaContact)selectedValue); component.setCurrentContact((MetaContact)selectedValue);
} }
else if(selectedValue instanceof MetaContactGroup) else if(selectedValue instanceof MetaContactGroup)
{ {
component component
.setCurrentContactGroup((MetaContactGroup)selectedValue); .setCurrentContactGroup((MetaContactGroup)selectedValue);
} }
this.add((Component)component.getComponent());
this.add((Component)component.getComponent());
this.repaint(); this.repaint();
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -91,15 +91,16 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent()); for (int i = 0; i < serRefs.length; i ++)
{
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -208,31 +208,30 @@ else if(selectedValue instanceof MetaContactGroup)
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
Object selectedValue = mainFrame.getContactListPanel() Object selectedValue = mainFrame.getContactListPanel()
.getContactList().getSelectedValue(); .getContactList().getSelectedValue();
if(selectedValue instanceof MetaContact) if(selectedValue instanceof MetaContact)
{ {
component.setCurrentContact((MetaContact)selectedValue); component.setCurrentContact((MetaContact)selectedValue);
} }
else if(selectedValue instanceof MetaContactGroup) else if(selectedValue instanceof MetaContactGroup)
{ {
component component
.setCurrentContactGroup((MetaContactGroup)selectedValue); .setCurrentContactGroup((MetaContactGroup)selectedValue);
} }
this.add((Component)component.getComponent());
this.add((Component)component.getComponent());
this.repaint(); this.repaint();
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -109,15 +109,15 @@ private void initPluginComponents()
logger.error("Could not obtain plugin reference.", exc); logger.error("Could not obtain plugin reference.", exc);
} }
if (serRefs == null) if (serRefs != null)
return;
for (int i = 0; i < serRefs.length; i ++)
{ {
PluginComponent component = (PluginComponent) GuiActivator for (int i = 0; i < serRefs.length; i ++)
.bundleContext.getService(serRefs[i]);; {
PluginComponent component = (PluginComponent) GuiActivator
.bundleContext.getService(serRefs[i]);;
this.add((Component)component.getComponent()); this.add((Component)component.getComponent());
}
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

Loading…
Cancel
Save