Fixes warnings.

cefexperiments 5311
Lyubomir Marinov 11 years ago
parent 5a03482109
commit bcefab613f

@ -1881,43 +1881,45 @@ private String getElementContent(String elementId, String message)
public static ConfigurationForm getChatConfigForm() public static ConfigurationForm getChatConfigForm()
{ {
// General configuration forms only. // General configuration forms only.
String osgiFilter = "(" Collection<ServiceReference<ConfigurationForm>> cfgFormRefs;
+ ConfigurationForm.FORM_TYPE String osgiFilter
+ "="+ConfigurationForm.GENERAL_TYPE+")"; = "(" + ConfigurationForm.FORM_TYPE + "="
+ ConfigurationForm.GENERAL_TYPE + ")";
ServiceReference[] confFormsRefs = null;
try try
{ {
confFormsRefs = GuiActivator.bundleContext cfgFormRefs
.getServiceReferences( = GuiActivator.bundleContext.getServiceReferences(
ConfigurationForm.class.getName(), ConfigurationForm.class,
osgiFilter); osgiFilter);
} }
catch (InvalidSyntaxException ex) catch (InvalidSyntaxException ex)
{} {
cfgFormRefs = null;
String chatConfigFormClassName = }
"net.java.sip.communicator.plugin.chatconfig.ChatConfigPanel";
if(confFormsRefs != null) if ((cfgFormRefs != null) && !cfgFormRefs.isEmpty())
{ {
for (int i = 0; i < confFormsRefs.length; i++) String chatCfgFormClassName
= "net.java.sip.communicator.plugin.chatconfig.ChatConfigPanel";
for (ServiceReference<ConfigurationForm> cfgFormRef : cfgFormRefs)
{ {
ConfigurationForm form ConfigurationForm form
= (ConfigurationForm) GuiActivator.bundleContext = GuiActivator.bundleContext.getService(cfgFormRef);
.getService(confFormsRefs[i]);
if (form instanceof LazyConfigurationForm) if (form instanceof LazyConfigurationForm)
{ {
LazyConfigurationForm lazyConfigForm LazyConfigurationForm lazyConfigForm
= (LazyConfigurationForm) form; = (LazyConfigurationForm) form;
if (lazyConfigForm.getFormClassName() if (chatCfgFormClassName.equals(
.equals(chatConfigFormClassName)) lazyConfigForm.getFormClassName()))
{
return form; return form;
}
} }
else if (form.getClass().getName() else if (form.getClass().getName().equals(chatCfgFormClassName))
.equals(chatConfigFormClassName))
{ {
return form; return form;
} }

@ -811,48 +811,51 @@ private void initPluginComponents()
// Search for plugin components registered through the OSGI bundle // Search for plugin components registered through the OSGI bundle
// context. // context.
ServiceReference[] serRefs = null; Collection<ServiceReference<PluginComponentFactory>> serRefs;
String osgiFilter
String osgiFilter = "(|(" = "(|(" + Container.CONTAINER_ID + "="
+ Container.CONTAINER_ID + Container.CONTAINER_CHAT_WINDOW.getID() + ")("
+ "="+Container.CONTAINER_CHAT_WINDOW.getID()+")" + Container.CONTAINER_ID + "="
+ "(" + Container.CONTAINER_ID + Container.CONTAINER_CHAT_STATUS_BAR.getID() + "))";
+ "="+Container.CONTAINER_CHAT_STATUS_BAR.getID()+"))";
try try
{ {
serRefs = GuiActivator.bundleContext.getServiceReferences( serRefs
PluginComponentFactory.class.getName(), = GuiActivator.bundleContext.getServiceReferences(
osgiFilter); PluginComponentFactory.class,
osgiFilter);
} }
catch (InvalidSyntaxException exc) catch (InvalidSyntaxException ex)
{ {
logger.error("Could not obtain plugin component reference.", exc); serRefs = null;
logger.error("Could not obtain plugin component reference.", ex);
} }
if (serRefs != null) if ((serRefs != null) && !serRefs.isEmpty())
{ {
for (ServiceReference serRef : serRefs) for (ServiceReference<PluginComponentFactory> serRef : serRefs)
{ {
PluginComponentFactory factory PluginComponentFactory factory
= (PluginComponentFactory) = GuiActivator.bundleContext.getService(serRef);
GuiActivator .bundleContext.getService(serRef); Component comp
= (Component)
Component comp = (Component)factory.getPluginComponentInstance( factory
ChatWindow.this).getComponent(); .getPluginComponentInstance(ChatWindow.this)
.getComponent();
// If this component has been already added, we have nothing // If this component has been already added, we have nothing
// more to do here. // more to do here.
if (comp.getParent() != null) if (comp.getParent() != null)
return; return;
Object borderLayoutConstraint = UIServiceImpl Object borderLayoutConstraints
.getBorderLayoutConstraintsFromContainer( = UIServiceImpl.getBorderLayoutConstraintsFromContainer(
factory.getConstraints()); factory.getConstraints());
this.addPluginComponent(comp, addPluginComponent(
factory.getContainer(), comp,
borderLayoutConstraint); factory.getContainer(),
borderLayoutConstraints);
} }
} }
} }

@ -1593,49 +1593,56 @@ void initPluginComponents()
{ {
// Search for plugin components registered through the OSGI bundle // Search for plugin components registered through the OSGI bundle
// context. // context.
ServiceReference[] serRefs = null; Collection<ServiceReference<PluginComponentFactory>> serRefs;
String osgiFilter
String osgiFilter = "(" = "(" + net.java.sip.communicator.service.gui.Container.CONTAINER_ID
+ net.java.sip.communicator.service.gui.Container.CONTAINER_ID + "="
+ "="+net.java.sip.communicator.service.gui.Container. + net.java.sip.communicator.service.gui.Container
CONTAINER_CHAT_WRITE_PANEL.getID()+")"; .CONTAINER_CHAT_WRITE_PANEL.getID()
+ ")";
try try
{ {
serRefs = GuiActivator.bundleContext.getServiceReferences( serRefs
PluginComponentFactory.class.getName(), = GuiActivator.bundleContext.getServiceReferences(
osgiFilter); PluginComponentFactory.class,
osgiFilter);
} }
catch (InvalidSyntaxException exc) catch (InvalidSyntaxException ex)
{ {
logger.error("Could not obtain plugin reference.", exc); serRefs = null;
logger.error("Could not obtain plugin reference.", ex);
} }
if (serRefs != null) if ((serRefs != null) && !serRefs.isEmpty())
{ {
for (int i = 0; i < serRefs.length; i ++) for (ServiceReference<PluginComponentFactory> serRef : serRefs)
{ {
PluginComponentFactory factory = PluginComponentFactory factory
(PluginComponentFactory) GuiActivator = GuiActivator.bundleContext.getService(serRef);
.bundleContext.getService(serRefs[i]); PluginComponent component
= factory.getPluginComponentInstance(this);
PluginComponent component =
factory.getPluginComponentInstance(this);
ChatSession chatSession = chatPanel.getChatSession(); ChatSession chatSession = chatPanel.getChatSession();
if (chatSession != null) if (chatSession != null)
{ {
ChatTransport currentTransport = ChatTransport currentTransport
chatSession.getCurrentChatTransport(); = chatSession.getCurrentChatTransport();
Object currentDescriptor = currentTransport.getDescriptor(); Object currentDescriptor = currentTransport.getDescriptor();
if (currentDescriptor instanceof Contact) if (currentDescriptor instanceof Contact)
{ {
Contact contact = (Contact) currentDescriptor; Contact contact = (Contact) currentDescriptor;
component.setCurrentContact( component.setCurrentContact(
contact, currentTransport.getResourceName()); contact,
currentTransport.getResourceName());
} }
} }
if (component.getComponent() == null)
Object c = component.getComponent();
if (c == null)
continue; continue;
GridBagConstraints constraints = new GridBagConstraints(); GridBagConstraints constraints = new GridBagConstraints();
@ -1648,8 +1655,7 @@ void initPluginComponents()
constraints.weighty = 0f; constraints.weighty = 0f;
constraints.insets = new Insets(0, 3, 0, 0); constraints.insets = new Insets(0, 3, 0, 0);
centerPanel.add( centerPanel.add((Component) c, constraints);
(Component)component.getComponent(), constraints);
} }
} }
GuiActivator.getUIService().addPluginComponentListener(this); GuiActivator.getUIService().addPluginComponentListener(this);

@ -9,6 +9,7 @@
import java.awt.*; import java.awt.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.*;
import net.java.sip.communicator.impl.gui.*; import net.java.sip.communicator.impl.gui.*;
import net.java.sip.communicator.impl.gui.event.*; import net.java.sip.communicator.impl.gui.event.*;
@ -69,34 +70,34 @@ private void initPluginComponents()
{ {
// Search for plugin components registered through the OSGI bundle // Search for plugin components registered through the OSGI bundle
// context. // context.
ServiceReference[] serRefs = null; Collection<ServiceReference<PluginComponentFactory>> serRefs;
String osgiFilter
String osgiFilter = "(" = "(" + Container.CONTAINER_ID + "="
+ Container.CONTAINER_ID + Container.CONTAINER_CHAT_HELP_MENU.getID() + ")";
+ "="+Container.CONTAINER_CHAT_HELP_MENU.getID()+")";
try try
{ {
serRefs = GuiActivator.bundleContext.getServiceReferences( serRefs
PluginComponentFactory.class.getName(), = GuiActivator.bundleContext.getServiceReferences(
osgiFilter); PluginComponentFactory.class,
osgiFilter);
} }
catch (InvalidSyntaxException exc) catch (InvalidSyntaxException ex)
{ {
logger.error("Could not obtain plugin reference.", exc); serRefs = null;
logger.error("Could not obtain plugin reference.", ex);
} }
if (serRefs != null) if ((serRefs != null) && !serRefs.isEmpty())
{ {
for (int i = 0; i < serRefs.length; i ++) for (ServiceReference<PluginComponentFactory> serRef : serRefs)
{ {
PluginComponentFactory factory = PluginComponentFactory factory
(PluginComponentFactory) GuiActivator = GuiActivator.bundleContext.getService(serRef);
.bundleContext.getService(serRefs[i]); PluginComponent component
PluginComponent component = = factory.getPluginComponentInstance(HelpMenu.this);
factory.getPluginComponentInstance(HelpMenu.this);
this.add((Component)component.getComponent()); add((Component) component.getComponent());
} }
} }

@ -23,9 +23,6 @@
*/ */
public class AdHocChatRoomList public class AdHocChatRoomList
{ {
private static final Logger logger
= Logger.getLogger(AdHocChatRoomList.class);
/** /**
* The list containing all chat servers and ad-hoc rooms. * The list containing all chat servers and ad-hoc rooms.
*/ */
@ -37,37 +34,25 @@ public class AdHocChatRoomList
*/ */
public void loadList() public void loadList()
{ {
try Collection<ServiceReference<ProtocolProviderService>> serRefs
{ = ServiceUtils.getServiceReferences(
ServiceReference[] serRefs GuiActivator.bundleContext,
= GuiActivator.bundleContext.getServiceReferences( ProtocolProviderService.class);
ProtocolProviderService.class.getName(),
null);
// If we don't have providers at this stage we just return.
if (serRefs == null)
return;
for (ServiceReference serRef : serRefs) if ((serRefs != null) && !serRefs.isEmpty())
{
for (ServiceReference<ProtocolProviderService> serRef : serRefs)
{ {
ProtocolProviderService protocolProvider ProtocolProviderService protocolProvider
= (ProtocolProviderService) = GuiActivator.bundleContext.getService(serRef);
GuiActivator.bundleContext.getService(serRef);
Object adHocMultiUserChatOpSet Object adHocMultiUserChatOpSet
= protocolProvider = protocolProvider.getOperationSet(
.getOperationSet(OperationSetAdHocMultiUserChat.class); OperationSetAdHocMultiUserChat.class);
if (adHocMultiUserChatOpSet != null) if (adHocMultiUserChatOpSet != null)
{ addChatProvider(protocolProvider);
this.addChatProvider(protocolProvider);
}
} }
} }
catch (InvalidSyntaxException e)
{
logger.error("Failed to obtain service references.", e);
}
} }
/** /**

@ -6,6 +6,7 @@
package net.java.sip.communicator.impl.gui.main.configforms; package net.java.sip.communicator.impl.gui.main.configforms;
import java.awt.*; import java.awt.*;
import java.util.*;
import javax.swing.*; import javax.swing.*;
import javax.swing.border.*; import javax.swing.border.*;
@ -119,30 +120,31 @@ public ConfigurationFrame(MainFrame mainFrame)
GuiActivator.bundleContext.addServiceListener(this); GuiActivator.bundleContext.addServiceListener(this);
// General configuration forms only. // General configuration forms only.
String osgiFilter = "(" Collection<ServiceReference<ConfigurationForm>> cfgFormRefs;
+ ConfigurationForm.FORM_TYPE String osgiFilter
+ "="+ConfigurationForm.GENERAL_TYPE+")"; = "(" + ConfigurationForm.FORM_TYPE + "="
+ ConfigurationForm.GENERAL_TYPE + ")";
ServiceReference[] confFormsRefs = null;
try try
{ {
confFormsRefs = GuiActivator.bundleContext cfgFormRefs
.getServiceReferences( = GuiActivator.bundleContext.getServiceReferences(
ConfigurationForm.class.getName(), ConfigurationForm.class,
osgiFilter); osgiFilter);
} }
catch (InvalidSyntaxException ex) catch (InvalidSyntaxException ex)
{} {
cfgFormRefs = null;
}
if(confFormsRefs != null) if ((cfgFormRefs != null) && !cfgFormRefs.isEmpty())
{ {
for (int i = 0; i < confFormsRefs.length; i++) for (ServiceReference<ConfigurationForm> cfgFormRef : cfgFormRefs)
{ {
ConfigurationForm form ConfigurationForm form
= (ConfigurationForm) GuiActivator.bundleContext = GuiActivator.bundleContext.getService(cfgFormRef);
.getService(confFormsRefs[i]);
this.addConfigurationForm(form); addConfigurationForm(form);
} }
} }
} }
@ -273,41 +275,43 @@ protected void close(boolean isEscaped)
* Handles registration of a new configuration form. * Handles registration of a new configuration form.
* @param event the <tt>ServiceEvent</tt> that notified us * @param event the <tt>ServiceEvent</tt> that notified us
*/ */
@Override
public void serviceChanged(ServiceEvent event) public void serviceChanged(ServiceEvent event)
{ {
if(!GuiActivator.isStarted) if(!GuiActivator.isStarted)
return; return;
ServiceReference serRef = event.getServiceReference(); ServiceReference<?> serRef = event.getServiceReference();
Object property = serRef.getProperty(ConfigurationForm.FORM_TYPE); Object property = serRef.getProperty(ConfigurationForm.FORM_TYPE);
if (property != ConfigurationForm.GENERAL_TYPE) if (property != ConfigurationForm.GENERAL_TYPE)
return; return;
Object sService Object service = GuiActivator.bundleContext.getService(serRef);
= GuiActivator.bundleContext.getService(
event.getServiceReference());
// we don't care if the source service is not a configuration form // we don't care if the source service is not a configuration form
if (!(sService instanceof ConfigurationForm)) if (!(service instanceof ConfigurationForm))
return; return;
ConfigurationForm configForm = (ConfigurationForm) sService; ConfigurationForm cfgForm = (ConfigurationForm) service;
if (configForm.isAdvanced()) if (cfgForm.isAdvanced())
return; return;
switch (event.getType()) switch (event.getType())
{ {
case ServiceEvent.REGISTERED: case ServiceEvent.REGISTERED:
if (logger.isInfoEnabled()) if (logger.isInfoEnabled())
logger.info("Handling registration of a new Configuration Form."); {
this.addConfigurationForm(configForm); logger.info(
"Handling registration of a new Configuration Form.");
}
addConfigurationForm(cfgForm);
break; break;
case ServiceEvent.UNREGISTERING: case ServiceEvent.UNREGISTERING:
this.removeConfigurationForm(configForm); removeConfigurationForm(cfgForm);
break; break;
} }
} }

@ -812,58 +812,60 @@ private void initPluginComponents()
{ {
// Search for plugin components registered through the OSGI bundle // Search for plugin components registered through the OSGI bundle
// context. // context.
ServiceReference[] serRefs = null; Collection<ServiceReference<PluginComponentFactory>> serRefs;
String osgiFilter
String osgiFilter = "(" = "(" + Container.CONTAINER_ID + "="
+ Container.CONTAINER_ID + Container.CONTAINER_CONTACT_LIST.getID() + ")";
+ "="+Container.CONTAINER_CONTACT_LIST.getID()+")";
try try
{ {
serRefs = GuiActivator.bundleContext.getServiceReferences( serRefs
PluginComponentFactory.class.getName(), = GuiActivator.bundleContext.getServiceReferences(
osgiFilter); PluginComponentFactory.class,
osgiFilter);
} }
catch (InvalidSyntaxException exc) catch (InvalidSyntaxException ex)
{ {
logger.error("Could not obtain plugin reference.", exc); serRefs = null;
logger.error("Could not obtain plugin reference.", ex);
} }
if (serRefs != null) if ((serRefs != null) && !serRefs.isEmpty())
{ {
for (ServiceReference serRef : serRefs) for (ServiceReference<PluginComponentFactory> serRef : serRefs)
{ {
PluginComponentFactory factory = PluginComponentFactory factory
(PluginComponentFactory) = GuiActivator.bundleContext.getService(serRef);
GuiActivator.bundleContext.getService(serRef); PluginComponent component
PluginComponent component = = factory.getPluginComponentInstance(this);
factory.getPluginComponentInstance(this);
Object selectedValue = getContactList().getSelectedValue(); Object selectedValue = 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(
.setCurrentContactGroup((MetaContactGroup)selectedValue); (MetaContactGroup) selectedValue);
} }
String pluginConstraints = factory.getConstraints(); String pluginConstraints = factory.getConstraints();
Object constraints; Object constraints;
if (pluginConstraints != null) if (pluginConstraints != null)
constraints = UIServiceImpl {
.getBorderLayoutConstraintsFromContainer( constraints
pluginConstraints); = UIServiceImpl.getBorderLayoutConstraintsFromContainer(
pluginConstraints);
}
else else
constraints = BorderLayout.SOUTH; constraints = BorderLayout.SOUTH;
this.add((Component)component.getComponent(), constraints); add((Component) component.getComponent(), constraints);
this.repaint(); repaint();
} }
} }

@ -8,7 +8,6 @@
import java.util.*; import java.util.*;
import net.java.sip.communicator.impl.protocol.irc.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
/** /**

@ -6,17 +6,19 @@
*/ */
package net.java.sip.communicator.service.resources; package net.java.sip.communicator.service.resources;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.osgi.framework.*;
import javax.swing.*;
import java.io.*; import java.io.*;
import java.net.*; import java.net.*;
import java.text.*; import java.text.*;
import java.util.*; import java.util.*;
import javax.swing.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
import org.jitsi.service.resources.*;
import org.osgi.framework.*;
/** /**
* The abstract class for ResourceManagementService. It listens for * The abstract class for ResourceManagementService. It listens for
* {@link ResourcePack} that are registered and exposes them later for use by * {@link ResourcePack} that are registered and exposes them later for use by
@ -109,16 +111,18 @@ public AbstractResourcesService(BundleContext bundleContext)
this.bundleContext = bundleContext; this.bundleContext = bundleContext;
bundleContext.addServiceListener(this); bundleContext.addServiceListener(this);
colorPack = colorPack
getDefaultResourcePack(ColorPack.class.getName(), = getDefaultResourcePack(
ColorPack.RESOURCE_NAME_DEFAULT_VALUE); ColorPack.class,
ColorPack.RESOURCE_NAME_DEFAULT_VALUE);
if (colorPack != null) if (colorPack != null)
colorResources = getResources(colorPack); colorResources = getResources(colorPack);
imagePack = (ImagePack) getDefaultResourcePack( imagePack
ImagePack.class.getName(), = getDefaultResourcePack(
ImagePack.RESOURCE_NAME_DEFAULT_VALUE); ImagePack.class,
ImagePack.RESOURCE_NAME_DEFAULT_VALUE);
if (imagePack != null) if (imagePack != null)
imageResources = getResources(imagePack); imageResources = getResources(imagePack);
@ -132,9 +136,10 @@ public AbstractResourcesService(BundleContext bundleContext)
Locale.setDefault( Locale.setDefault(
ResourceManagementServiceUtils.getLocale(defaultLocale)); ResourceManagementServiceUtils.getLocale(defaultLocale));
languagePack = (LanguagePack) getDefaultResourcePack( languagePack
LanguagePack.class.getName(), = getDefaultResourcePack(
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); LanguagePack.class,
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
if (languagePack != null) if (languagePack != null)
{ {
@ -142,22 +147,26 @@ public AbstractResourcesService(BundleContext bundleContext)
languageResources = languagePack.getResources(languageLocale); languageResources = languagePack.getResources(languageLocale);
} }
settingsPack = settingsPack
getDefaultResourcePack(SettingsPack.class.getName(), = getDefaultResourcePack(
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); SettingsPack.class,
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE);
if (settingsPack != null) if (settingsPack != null)
settingsResources = getResources(settingsPack); settingsResources = getResources(settingsPack);
soundPack = soundPack
getDefaultResourcePack(SoundPack.class.getName(), = getDefaultResourcePack(
SoundPack.RESOURCE_NAME_DEFAULT_VALUE); SoundPack.class,
SoundPack.RESOURCE_NAME_DEFAULT_VALUE);
if (soundPack != null) if (soundPack != null)
soundResources = getResources(soundPack); soundResources = getResources(soundPack);
skinPack = (SkinPack) getDefaultResourcePack( skinPack
SkinPack.class.getName(), SkinPack.RESOURCE_NAME_DEFAULT_VALUE); = getDefaultResourcePack(
SkinPack.class,
SkinPack.RESOURCE_NAME_DEFAULT_VALUE);
if (skinPack != null) if (skinPack != null)
{ {
@ -247,48 +256,48 @@ else if (event.getType() == ServiceEvent.UNREGISTERING)
if(resourcePack instanceof ColorPack if(resourcePack instanceof ColorPack
&& colorPack.equals(resourcePack)) && colorPack.equals(resourcePack))
{ {
colorPack = colorPack
getDefaultResourcePack(ColorPack.class.getName(), = getDefaultResourcePack(
ColorPack.RESOURCE_NAME_DEFAULT_VALUE); ColorPack.class,
ColorPack.RESOURCE_NAME_DEFAULT_VALUE);
if (colorPack != null) if (colorPack != null)
colorResources = getResources(colorPack); colorResources = getResources(colorPack);
} }
else if(resourcePack instanceof ImagePack else if(resourcePack instanceof ImagePack
&& imagePack.equals(resourcePack)) && imagePack.equals(resourcePack))
{ {
imagePack = (ImagePack) getDefaultResourcePack( imagePack
ImagePack.class.getName(), = getDefaultResourcePack(
ImagePack.RESOURCE_NAME_DEFAULT_VALUE); ImagePack.class,
ImagePack.RESOURCE_NAME_DEFAULT_VALUE);
if (imagePack != null) if (imagePack != null)
imageResources = getResources(imagePack); imageResources = getResources(imagePack);
} }
else if(resourcePack instanceof LanguagePack else if(resourcePack instanceof LanguagePack
&& languagePack.equals(resourcePack)) && languagePack.equals(resourcePack))
{ {
languagePack = languagePack
(LanguagePack) getDefaultResourcePack( = getDefaultResourcePack(
LanguagePack.class.getName(), LanguagePack.class,
LanguagePack.RESOURCE_NAME_DEFAULT_VALUE); LanguagePack.RESOURCE_NAME_DEFAULT_VALUE);
} }
else if(resourcePack instanceof SettingsPack else if(resourcePack instanceof SettingsPack
&& settingsPack.equals(resourcePack)) && settingsPack.equals(resourcePack))
{ {
settingsPack = settingsPack
getDefaultResourcePack(SettingsPack.class.getName(), = getDefaultResourcePack(
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE); SettingsPack.class,
SettingsPack.RESOURCE_NAME_DEFAULT_VALUE);
if (settingsPack != null) if (settingsPack != null)
settingsResources = getResources(settingsPack); settingsResources = getResources(settingsPack);
} }
else if(resourcePack instanceof SoundPack else if(resourcePack instanceof SoundPack
&& soundPack.equals(resourcePack)) && soundPack.equals(resourcePack))
{ {
soundPack = soundPack
getDefaultResourcePack(SoundPack.class.getName(), = getDefaultResourcePack(
SoundPack.RESOURCE_NAME_DEFAULT_VALUE); SoundPack.class,
SoundPack.RESOURCE_NAME_DEFAULT_VALUE);
if (soundPack != null) if (soundPack != null)
soundResources = getResources(soundPack); soundResources = getResources(soundPack);
} }
@ -310,10 +319,10 @@ else if(resourcePack instanceof SkinPack
settingsResources = getResources(settingsPack); settingsResources = getResources(settingsPack);
} }
skinPack = (SkinPack) getDefaultResourcePack( skinPack
SkinPack.class.getName(), = getDefaultResourcePack(
SkinPack.RESOURCE_NAME_DEFAULT_VALUE); SkinPack.class,
SkinPack.RESOURCE_NAME_DEFAULT_VALUE);
if (skinPack != null) if (skinPack != null)
{ {
imageResources.putAll(skinPack.getImageResources()); imageResources.putAll(skinPack.getImageResources());
@ -341,28 +350,27 @@ else if(resourcePack instanceof SkinPack
* @return the <tt>ResourcePack</tt> corresponding to the given * @return the <tt>ResourcePack</tt> corresponding to the given
* <tt>className</tt> and <tt></tt>. * <tt>className</tt> and <tt></tt>.
*/ */
protected ResourcePack getDefaultResourcePack(String className, protected <T extends ResourcePack> T getDefaultResourcePack(
String typeName) Class<T> clazz,
String typeName)
{ {
ServiceReference[] serRefs = null; Collection<ServiceReference<T>> serRefs;
String osgiFilter
String osgiFilter = = "(" + ResourcePack.RESOURCE_NAME + "=" + typeName + ")";
"(" + ResourcePack.RESOURCE_NAME + "=" + typeName + ")";
try try
{ {
serRefs = bundleContext.getServiceReferences( serRefs = bundleContext.getServiceReferences(clazz, osgiFilter);
className,
osgiFilter);
} }
catch (InvalidSyntaxException exc) catch (InvalidSyntaxException ex)
{ {
logger.error("Could not obtain resource packs reference.", exc); serRefs = null;
logger.error("Could not obtain resource packs reference.", ex);
} }
if ((serRefs != null) && (serRefs.length > 0)) if ((serRefs != null) && !serRefs.isEmpty())
{ {
return (ResourcePack) bundleContext.getService(serRefs[0]); return bundleContext.getService(serRefs.iterator().next());
} }
return null; return null;
} }

@ -1028,7 +1028,7 @@ static class IntHashMap {
*/ */
private static class Entry { private static class Entry {
final int hash; final int hash;
final int key; // final int key;
Object value; Object value;
Entry next; Entry next;
@ -1042,7 +1042,7 @@ private static class Entry {
*/ */
protected Entry(int hash, int key, Object value, Entry next) { protected Entry(int hash, int key, Object value, Entry next) {
this.hash = hash; this.hash = hash;
this.key = key; // this.key = key;
this.value = value; this.value = value;
this.next = next; this.next = next;
} }

@ -228,30 +228,30 @@ public static MediaConfigurationService getMediaConfiguration()
public static Map<Object, ProtocolProviderFactory> public static Map<Object, ProtocolProviderFactory>
getProtocolProviderFactories() getProtocolProviderFactories()
{ {
Collection<ServiceReference<ProtocolProviderFactory>> serRefs;
Map<Object, ProtocolProviderFactory> providerFactoriesMap Map<Object, ProtocolProviderFactory> providerFactoriesMap
= new Hashtable<Object, ProtocolProviderFactory>(); = new Hashtable<Object, ProtocolProviderFactory>();
ServiceReference[] serRefs = null;
try try
{ {
// get all registered provider factories // get all registered provider factories
serRefs serRefs
= bundleContext.getServiceReferences( = bundleContext.getServiceReferences(
ProtocolProviderFactory.class.getName(), ProtocolProviderFactory.class,
null); null);
} }
catch (InvalidSyntaxException e) catch (InvalidSyntaxException ex)
{ {
logger.error("LoginManager : " + e); serRefs = null;
logger.error("LoginManager : " + ex);
} }
if (serRefs != null) if ((serRefs != null) && !serRefs.isEmpty())
{ {
for (ServiceReference serRef : serRefs) for (ServiceReference<ProtocolProviderFactory> serRef : serRefs)
{ {
ProtocolProviderFactory providerFactory ProtocolProviderFactory providerFactory
= (ProtocolProviderFactory) = bundleContext.getService(serRef);
bundleContext.getService(serRef);
providerFactoriesMap.put( providerFactoriesMap.put(
serRef.getProperty(ProtocolProviderFactory.PROTOCOL), serRef.getProperty(ProtocolProviderFactory.PROTOCOL),

@ -6,15 +6,18 @@
*/ */
package net.java.sip.communicator.util.call; package net.java.sip.communicator.util.call;
import java.util.*;
import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.contactlist.*;
import net.java.sip.communicator.service.protocol.*; import net.java.sip.communicator.service.protocol.*;
import net.java.sip.communicator.service.protocol.OperationSetServerStoredContactInfo.*; import net.java.sip.communicator.service.protocol.OperationSetServerStoredContactInfo.DetailsResponseListener;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.*; import net.java.sip.communicator.service.protocol.ServerStoredDetails.GenericDetail;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.MobilePhoneDetail;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.VideoDetail;
import net.java.sip.communicator.service.protocol.ServerStoredDetails.WorkPhoneDetail;
import net.java.sip.communicator.util.*; import net.java.sip.communicator.util.*;
import net.java.sip.communicator.util.account.*; import net.java.sip.communicator.util.account.*;
import java.util.*;
/** /**
* Utility class used to check if there is a telephony service, video calls and * Utility class used to check if there is a telephony service, video calls and
* desktop sharing enabled for a protocol specific <tt>MetaContact</tt>. * desktop sharing enabled for a protocol specific <tt>MetaContact</tt>.
@ -24,13 +27,6 @@
*/ */
public class MetaContactPhoneUtil public class MetaContactPhoneUtil
{ {
/**
* The <tt>Logger</tt> used by the <tt>CallManager</tt> class and its
* instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(MetaContactPhoneUtil.class);
/** /**
* The metacontcat we are working on. * The metacontcat we are working on.
*/ */

Loading…
Cancel
Save