- 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.
cusax-fix
Lyubomir Marinov 16 years ago
parent 0f9368c115
commit 144a0baee3

@ -16,12 +16,11 @@
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 void start(BundleContext bc) throws Exception
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 void start(BundleContext bc) throws Exception
{
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 void stop(BundleContext bc) throws Exception
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 static Map<Object, ProtocolProviderFactory> getProtocolProviderFactories(
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);
}
}

@ -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 void actionPerformed(ActionEvent e)
}
}
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 void actionPerformed(ActionEvent arg0)
}
// TODO We should listen for configuration value changes.
class DefaultOtrPolicyPanel
private static class DefaultOtrPolicyPanel
extends TransparentPanel
{
public DefaultOtrPolicyPanel()
@ -521,4 +522,4 @@ private void initComponents()
c.gridy = 2;
this.add(pnlFingerprints, c);
}
}
}

@ -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 void actionPerformed(ActionEvent e)
public void setCurrentContactGroup(MetaContactGroup metaGroup)
{
}
}
}

Loading…
Cancel
Save