aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip
diff options
context:
space:
mode:
authorLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-09-05 07:51:53 +0000
committerLyubomir Marinov <lyubomir.marinov@jitsi.org>2009-09-05 07:51:53 +0000
commit144a0baee317ba2973410e09135706fe3d2e325a (patch)
tree3edbf70f2e3163097af5f00af6611340b9fda1ef /src/net/java/sip
parent0f9368c1153401ac66a217b4862a5dde915d9ad0 (diff)
downloadjitsi-144a0baee317ba2973410e09135706fe3d2e325a.zip
jitsi-144a0baee317ba2973410e09135706fe3d2e325a.tar.gz
jitsi-144a0baee317ba2973410e09135706fe3d2e325a.tar.bz2
- Removes unnecessary fields by making inner classes static.
- Hides classes from internal into private visibility for the sake of increasing the chances of better optimizations. - Simplifies code in a few places.
Diffstat (limited to 'src/net/java/sip')
-rw-r--r--src/net/java/sip/communicator/plugin/otr/OtrActivator.java48
-rw-r--r--src/net/java/sip/communicator/plugin/otr/OtrConfigurationPanel.java19
-rw-r--r--src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java4
3 files changed, 32 insertions, 39 deletions
diff --git a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java
index 90398f5..68c8f4a 100644
--- a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java
+++ b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java
@@ -16,12 +16,11 @@ import net.java.sip.communicator.util.*;
import org.osgi.framework.*;
/**
- *
* @author George Politis
- *
*/
public class OtrActivator
- implements BundleActivator, ServiceListener
+ implements BundleActivator,
+ ServiceListener
{
public static BundleContext bundleContext;
@@ -46,17 +45,12 @@ public class OtrActivator
scOtrEngine = new ScOtrEngineImpl();
otrTransformLayer = new OtrTransformLayer();
- ServiceReference refResourceService =
- OtrActivator.bundleContext
- .getServiceReference(ResourceManagementService.class.getName());
-
- if (refResourceService == null)
+ resourceService
+ = ResourceManagementServiceUtils
+ .getService(OtrActivator.bundleContext);
+ if (resourceService == null)
return;
- resourceService =
- (ResourceManagementService) OtrActivator.bundleContext
- .getService(refResourceService);
-
ServiceReference refConfigService =
OtrActivator.bundleContext
.getServiceReference(ConfigurationService.class.getName());
@@ -98,11 +92,11 @@ public class OtrActivator
{
logger.debug("Found " + protocolProviderRefs.length
+ " already installed providers.");
- for (int i = 0; i < protocolProviderRefs.length; i++)
+ for (ServiceReference protocolProviderRef : protocolProviderRefs)
{
- ProtocolProviderService provider =
- (ProtocolProviderService) bundleContext
- .getService(protocolProviderRefs[i]);
+ ProtocolProviderService provider
+ = (ProtocolProviderService)
+ bundleContext.getService(protocolProviderRef);
this.handleProviderAdded(provider);
}
@@ -192,13 +186,12 @@ public class OtrActivator
if (protocolProviderRefs != null && protocolProviderRefs.length > 0)
{
-
// in case we found any
- for (int i = 0; i < protocolProviderRefs.length; i++)
+ for (ServiceReference protocolProviderRef : protocolProviderRefs)
{
- ProtocolProviderService provider =
- (ProtocolProviderService) bundleContext
- .getService(protocolProviderRefs[i]);
+ ProtocolProviderService provider
+ = (ProtocolProviderService)
+ bundleContext.getService(protocolProviderRef);
this.handleProviderRemoved(provider);
}
@@ -278,15 +271,14 @@ public class OtrActivator
new Hashtable<Object, ProtocolProviderFactory>();
if (serRefs != null)
{
- for (int i = 0; i < serRefs.length; i++)
+ for (ServiceReference serRef : serRefs)
{
+ ProtocolProviderFactory providerFactory
+ = (ProtocolProviderFactory)
+ bundleContext.getService(serRef);
- ProtocolProviderFactory providerFactory =
- (ProtocolProviderFactory) bundleContext
- .getService(serRefs[i]);
-
- providerFactoriesMap.put(serRefs[i]
- .getProperty(ProtocolProviderFactory.PROTOCOL),
+ providerFactoriesMap.put(
+ serRef.getProperty(ProtocolProviderFactory.PROTOCOL),
providerFactory);
}
}
diff --git a/src/net/java/sip/communicator/plugin/otr/OtrConfigurationPanel.java b/src/net/java/sip/communicator/plugin/otr/OtrConfigurationPanel.java
index 10bdcec..a614f09 100644
--- a/src/net/java/sip/communicator/plugin/otr/OtrConfigurationPanel.java
+++ b/src/net/java/sip/communicator/plugin/otr/OtrConfigurationPanel.java
@@ -31,16 +31,16 @@ public class OtrConfigurationPanel
extends TransparentPanel
{
- class PrivateKeysPanel
+ private static class PrivateKeysPanel
extends TransparentPanel
{
- class AccountsComboBox
+ private static class AccountsComboBox
extends JComboBox
{
- class AccountsComboBoxItem
+ private static class AccountsComboBoxItem
{
- public AccountID accountID;
+ public final AccountID accountID;
public AccountsComboBoxItem(AccountID accountID)
{
@@ -175,14 +175,15 @@ public class OtrConfigurationPanel
}
}
- class KnownFingerprintsPanel
+ private static class KnownFingerprintsPanel
extends TransparentPanel
{
- class ContactsTableModel
+ private static class ContactsTableModel
extends AbstractTableModel
{
- public java.util.List<Contact> allContacts = new Vector<Contact>();
+ public final java.util.List<Contact> allContacts
+ = new Vector<Contact>();
public ContactsTableModel()
{
@@ -392,7 +393,7 @@ public class OtrConfigurationPanel
}
// TODO We should listen for configuration value changes.
- class DefaultOtrPolicyPanel
+ private static class DefaultOtrPolicyPanel
extends TransparentPanel
{
public DefaultOtrPolicyPanel()
@@ -521,4 +522,4 @@ public class OtrConfigurationPanel
c.gridy = 2;
this.add(pnlFingerprints, c);
}
-} \ No newline at end of file
+}
diff --git a/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java b/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
index b85761e..2c08493 100644
--- a/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
+++ b/src/net/java/sip/communicator/plugin/otr/OtrMetaContactMenu.java
@@ -26,7 +26,7 @@ public class OtrMetaContactMenu
implements PluginComponent
{
- private Container container;
+ private final Container container;
public OtrMetaContactMenu(Container container)
{
@@ -105,4 +105,4 @@ public class OtrMetaContactMenu
public void setCurrentContactGroup(MetaContactGroup metaGroup)
{
}
-} \ No newline at end of file
+}