diff options
author | Vincent Lucas <chenzo@jitsi.org> | 2012-06-07 12:02:07 +0000 |
---|---|---|
committer | Vincent Lucas <chenzo@jitsi.org> | 2012-06-07 12:02:07 +0000 |
commit | 5d6b250942bc279f78d755f9e034aaedfcfa58f5 (patch) | |
tree | e4a65661999aadef4accd31e9f1bd78d97b44864 /src/net/java/sip/communicator/plugin | |
parent | fb39a5cace8dd9fa4b5f2fadf3b13d384079b083 (diff) | |
download | jitsi-5d6b250942bc279f78d755f9e034aaedfcfa58f5.zip jitsi-5d6b250942bc279f78d755f9e034aaedfcfa58f5.tar.gz jitsi-5d6b250942bc279f78d755f9e034aaedfcfa58f5.tar.bz2 |
Adds properties to custom the GUI.
Patch proposed by Vieri (JIRA new feature JITSI-1045).
Diffstat (limited to 'src/net/java/sip/communicator/plugin')
15 files changed, 474 insertions, 174 deletions
diff --git a/src/net/java/sip/communicator/plugin/certconfig/CertConfigActivator.java b/src/net/java/sip/communicator/plugin/certconfig/CertConfigActivator.java index 57ff504..12bb093 100644 --- a/src/net/java/sip/communicator/plugin/certconfig/CertConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/certconfig/CertConfigActivator.java @@ -25,6 +25,13 @@ import org.osgi.framework.*; public class CertConfigActivator implements BundleActivator { + /** + * Indicates if the cert configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.certconfig.DISABLED"; + private static BundleContext bundleContext; static ResourceManagementService R; @@ -37,16 +44,20 @@ public class CertConfigActivator R = ServiceUtils.getService(bc, ResourceManagementService.class); - bc.registerService(ConfigurationForm.class.getName(), - new LazyConfigurationForm( - CertConfigPanel.class.getName(), - getClass().getClassLoader(), - null, - "plugin.certconfig.TITLE", - 2000, - true), - properties - ); + // Checks if the cert configuration form is disabled. + if(!getConfigService().getBoolean(DISABLED_PROP, false)) + { + bc.registerService(ConfigurationForm.class.getName(), + new LazyConfigurationForm( + CertConfigPanel.class.getName(), + getClass().getClassLoader(), + null, + "plugin.certconfig.TITLE", + 2000, + true), + properties + ); + } } public void stop(BundleContext arg0) throws Exception diff --git a/src/net/java/sip/communicator/plugin/contactsourceconfig/ContactSourceConfigActivator.java b/src/net/java/sip/communicator/plugin/contactsourceconfig/ContactSourceConfigActivator.java index a875d6a..f0b4d68 100644 --- a/src/net/java/sip/communicator/plugin/contactsourceconfig/ContactSourceConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/contactsourceconfig/ContactSourceConfigActivator.java @@ -20,6 +20,13 @@ import org.osgi.framework.*; public class ContactSourceConfigActivator implements BundleActivator { + /** + * Indicates if the contact source config form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.contactsourceconfig.DISABLED"; + /** * The {@link BundleContext} of the {@link ContactSourceConfigActivator}. */ @@ -61,15 +68,20 @@ public class ContactSourceConfigActivator properties.put( ConfigurationForm.FORM_TYPE, ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - ContactSourceConfigForm.class.getName(), - getClass().getClassLoader(), - null, - "plugin.contactsourceconfig.CONTACT_SOURCE_TITLE", - 101, true), - properties); + + // Checks if the context source configuration form is disabled. + if(!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + ContactSourceConfigForm.class.getName(), + getClass().getClassLoader(), + null, + "plugin.contactsourceconfig.CONTACT_SOURCE_TITLE", + 101, true), + properties); + } } /** diff --git a/src/net/java/sip/communicator/plugin/dnsconfig/DnsConfigActivator.java b/src/net/java/sip/communicator/plugin/dnsconfig/DnsConfigActivator.java index f069cc9..4c1b00c 100644 --- a/src/net/java/sip/communicator/plugin/dnsconfig/DnsConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/dnsconfig/DnsConfigActivator.java @@ -8,6 +8,7 @@ package net.java.sip.communicator.plugin.dnsconfig; import java.util.*; +import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.fileaccess.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.util.*; @@ -22,9 +23,23 @@ import org.osgi.framework.*; public class DnsConfigActivator implements BundleActivator { + /** + * Indicates if the DNS configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.dnsconfig.DISABLED"; + static BundleContext bundleContext; private static FileAccessService fileAccessService; - private ServiceRegistration configForm; + private ServiceRegistration configForm = null; + + /** + * The <tt>ConfigurationService</tt> registered in {@link #bundleContext} + * and used by the <tt>SecurityConfigActivator</tt> instance to read and + * write configuration properties. + */ + private static ConfigurationService configurationService; /** * Starts this bundle. @@ -39,15 +54,19 @@ public class DnsConfigActivator properties.put(ConfigurationForm.FORM_TYPE, ConfigurationForm.ADVANCED_TYPE); - configForm = bc.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - DnsContainerPanel.class.getName(), - getClass().getClassLoader(), - "plugin.dnsconfig.ICON", - "plugin.dnsconfig.TITLE", - 2000, true), - properties); + // Checks if the dns configuration form is disabled. + if(!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + configForm = bc.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + DnsContainerPanel.class.getName(), + getClass().getClassLoader(), + "plugin.dnsconfig.ICON", + "plugin.dnsconfig.TITLE", + 2000, true), + properties); + } } /** @@ -58,7 +77,10 @@ public class DnsConfigActivator public void stop(BundleContext bc) throws Exception { - configForm.unregister(); + if(configForm != null) + { + configForm.unregister(); + } } /** @@ -77,4 +99,23 @@ public class DnsConfigActivator } return fileAccessService; } + + /** + * Returns a reference to the ConfigurationService implementation currently + * registered in the bundle context or null if no such implementation was + * found. + * + * @return a currently valid implementation of the ConfigurationService. + */ + public static ConfigurationService getConfigurationService() + { + if (configurationService == null) + { + configurationService + = ServiceUtils.getService( + bundleContext, + ConfigurationService.class); + } + return configurationService; + } } diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java index 3db99fe..9c9bbc8 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigPluginActivator.java @@ -82,6 +82,14 @@ public class GeneralConfigPluginActivator = "net.java.sip.communicator.plugin.generalconfig.DISABLED"; /** + * Indicates if the SIP configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String SIP_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.SIP_CONFIG_DISABLED"; + + /** * Starts this bundle. * @param bc the bundle context * @throws Exception if something goes wrong @@ -119,18 +127,23 @@ public class GeneralConfigPluginActivator properties); } - // Registers the sip config panel as advanced configuration form. - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - SIPConfigForm.class.getName(), - getClass().getClassLoader(), - null, - "plugin.generalconfig.SIP_CALL_CONFIG", - 52, true), - properties); + // Checks if the SIP configuration form is disabled. + if (!getConfigurationService() + .getBoolean(SIP_CONFIG_DISABLED_PROP, false)) + { + // Registers the sip config panel as advanced configuration form. + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + SIPConfigForm.class.getName(), + getClass().getClassLoader(), + null, + "plugin.generalconfig.SIP_CALL_CONFIG", + 52, true), + properties); + } /* * Wait for the first ProtocolProviderService to register in order to diff --git a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java index 3c1445d..894cefc 100644 --- a/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java +++ b/src/net/java/sip/communicator/plugin/generalconfig/GeneralConfigurationPanel.java @@ -42,6 +42,54 @@ public class GeneralConfigurationPanel private final Logger logger = Logger.getLogger(GeneralConfigurationPanel.class); + /** + * Indicates if the Startup configuration panel should be disabled, i.e. + * not visible to the user. + */ + private static final String STARTUP_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.STARTUP_CONFIG_DISABLED"; + + /** + * Indicates if the Message configuration panel should be disabled, i.e. + * not visible to the user. + */ + private static final String MESSAGE_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.MESSAGE_CONFIG_DISABLED"; + + /** + * Indicates if the AutoAway configuration panel should be disabled, i.e. + * not visible to the user. + */ + private static final String AUTO_AWAY_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.AUTOAWAY_CONFIG_DISABLED"; + + /** + * Indicates if the Notification configuration panel should be disabled, + * i.e. not visible to the user. + */ + private static final String NOTIFICATION_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.NOTIFICATION_CONFIG_DISABLED"; + + /** + * Indicates if the Locale configuration panel should be disabled, i.e. + * not visible to the user. + */ + private static final String LOCALE_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.LOCALE_CONFIG_DISABLED"; + + /** + * Indicates if the Call configuration panel should be disabled, i.e. + * not visible to the user. + */ + private static final String CALL_CONFIG_DISABLED_PROP + = + "net.java.sip.communicator.plugin.generalconfig.CALL_CONFIG_DISABLED"; + /** * Creates the general configuration panel. */ @@ -61,31 +109,55 @@ public class GeneralConfigurationPanel scroller.setBorder(new EmptyBorder(0, 0, 0, 0)); this.add(scroller, BorderLayout.CENTER); - Component startupConfigPanel = createStartupConfigPanel(); - if (startupConfigPanel != null) + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(STARTUP_CONFIG_DISABLED_PROP, false)) { - mainPanel.add(startupConfigPanel); + Component startupConfigPanel = createStartupConfigPanel(); + if (startupConfigPanel != null) + { + mainPanel.add(startupConfigPanel); + mainPanel.add(Box.createVerticalStrut(10)); + } + } + + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(MESSAGE_CONFIG_DISABLED_PROP, false)) + { + mainPanel.add(createMessageConfigPanel()); mainPanel.add(Box.createVerticalStrut(10)); } - mainPanel.add(createMessageConfigPanel()); - mainPanel.add(Box.createVerticalStrut(10)); + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(AUTO_AWAY_CONFIG_DISABLED_PROP, false)) + { + mainPanel.add(new AutoAwayConfigurationPanel()); + mainPanel.add(Box.createVerticalStrut(10)); + } - mainPanel.add(new AutoAwayConfigurationPanel()); - mainPanel.add(Box.createVerticalStrut(10)); + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(NOTIFICATION_CONFIG_DISABLED_PROP, false)) + { + Component notifConfigPanel = createNotificationConfigPanel(); + if (notifConfigPanel != null) + { + mainPanel.add(notifConfigPanel); + mainPanel.add(Box.createVerticalStrut(10)); + } + } - Component notifConfigPanel = createNotificationConfigPanel(); - if (notifConfigPanel != null) + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(LOCALE_CONFIG_DISABLED_PROP, false)) { - mainPanel.add(notifConfigPanel); + mainPanel.add(createLocaleConfigPanel()); mainPanel.add(Box.createVerticalStrut(10)); } - mainPanel.add(createLocaleConfigPanel()); - mainPanel.add(Box.createVerticalStrut(10)); - - mainPanel.add(createCallConfigPanel()); - mainPanel.add(Box.createVerticalStrut(10)); + if(!GeneralConfigPluginActivator.getConfigurationService() + .getBoolean(CALL_CONFIG_DISABLED_PROP, false)) + { + mainPanel.add(createCallConfigPanel()); + mainPanel.add(Box.createVerticalStrut(10)); + } SwingUtilities.invokeLater(new Runnable() { diff --git a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java index d9f664a..e665bb5 100644 --- a/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java +++ b/src/net/java/sip/communicator/plugin/globalproxyconfig/GlobalProxyPluginActivator.java @@ -39,6 +39,13 @@ public class GlobalProxyPluginActivator implements BundleActivator */ protected static BundleContext bundleContext; + /** + * Indicates if the global proxy config form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.globalproxyconfig.DISABLED"; + /** * Starts the bundle. * @param bc the context @@ -48,18 +55,23 @@ public class GlobalProxyPluginActivator implements BundleActivator { bundleContext = bc; - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - GlobalProxyConfigForm.class.getName(), - getClass().getClassLoader(), - "plugin.globalproxy.PLUGIN_ICON", - "plugin.globalproxy.GLOBAL_PROXY_CONFIG", - 51, true), - properties); + // Show/hide global proxy configuration form. + if(!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + GlobalProxyConfigForm.class.getName(), + getClass().getClassLoader(), + "plugin.globalproxy.PLUGIN_ICON", + "plugin.globalproxy.GLOBAL_PROXY_CONFIG", + 51, true), + properties); + } initProperties(); diff --git a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java index 29e9d12..1fc6ab0 100644 --- a/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java +++ b/src/net/java/sip/communicator/plugin/keybindingchooser/KeybindingChooserActivator.java @@ -57,6 +57,13 @@ public class KeybindingChooserActivator private static GlobalShortcutService globalShortcutService = null; /** + * Indicates if the keybindings configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.keybindingsconfig.DISABLED"; + + /** * Starts this bundle and adds the * <td>KeybindingsConfigPanel</tt> contained in it to the configuration * window obtained from the <tt>UIService</tt>. @@ -67,20 +74,26 @@ public class KeybindingChooserActivator bundleContext = bc; if (logger.isDebugEnabled()) - logger.debug("Service Impl: " + getClass().getName() + " [ STARTED ]"); - - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bc.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel", - getClass().getClassLoader(), - "plugin.keybinding.PLUGIN_ICON", - "plugin.keybindings.PLUGIN_NAME", - 900, true), - properties); + logger.debug( + "Service Impl: " + getClass().getName() + " [ STARTED ]"); + + // If the dns configuration form is disabled don't continue. + if(!getConfigService().getBoolean(DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bc.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.keybindingchooser.KeybindingsConfigPanel", + getClass().getClassLoader(), + "plugin.keybinding.PLUGIN_ICON", + "plugin.keybindings.PLUGIN_NAME", + 900, true), + properties); + } } /** diff --git a/src/net/java/sip/communicator/plugin/loggingutils/LoggingUtilsActivator.java b/src/net/java/sip/communicator/plugin/loggingutils/LoggingUtilsActivator.java index 7fd65d5..a6d531f 100644 --- a/src/net/java/sip/communicator/plugin/loggingutils/LoggingUtilsActivator.java +++ b/src/net/java/sip/communicator/plugin/loggingutils/LoggingUtilsActivator.java @@ -55,6 +55,13 @@ public class LoggingUtilsActivator private static NotificationService notificationService; /** + * Indicates if the logging configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.loggingconfig.DISABLED"; + + /** * Creates and register logging configuration. * * @param bundleContext OSGI bundle context @@ -66,22 +73,26 @@ public class LoggingUtilsActivator { LoggingUtilsActivator.bundleContext = bundleContext; - // Config Form - Dictionary<String, String> packetLoggingProps - = new Hashtable<String, String>(); - packetLoggingProps.put( - ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - LoggingConfigForm.class.getName(), - getClass().getClassLoader(), - null, - "plugin.loggingutils.PACKET_LOGGING_CONFIG", - 1200, - true), - packetLoggingProps); + // If the logging configuration form is disabled don't continue. + if (!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + // Config Form + Dictionary<String, String> packetLoggingProps + = new Hashtable<String, String>(); + packetLoggingProps.put( + ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + LoggingConfigForm.class.getName(), + getClass().getClassLoader(), + null, + "plugin.loggingutils.PACKET_LOGGING_CONFIG", + 1200, + true), + packetLoggingProps); + } } /** diff --git a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java index fe7793e..036c262 100644 --- a/src/net/java/sip/communicator/plugin/otr/OtrActivator.java +++ b/src/net/java/sip/communicator/plugin/otr/OtrActivator.java @@ -29,6 +29,13 @@ public class OtrActivator "net.java.sip.communicator.plugin.otr.DISABLED"; /** + * Indicates if the security/chat config form should be disabled, i.e. + * not visible to the user. + */ + private static final String OTR_CHAT_CONFIG_DISABLED_PROP + = "net.java.sip.communicator.impl.neomedia.OTR_CHAT_CONFIG_DISABLED"; + + /** * The {@link BundleContext} of the {@link OtrActivator}. */ public static BundleContext bundleContext; @@ -170,17 +177,22 @@ public class OtrActivator new OtrMetaContactButton(Container.CONTAINER_CHAT_TOOL_BAR), containerFilter); - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.SECURITY_TYPE); - // Register the configuration form. - bundleContext.registerService(ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.otr.OtrConfigurationPanel", - getClass().getClassLoader(), - "plugin.otr.configform.ICON", - "service.gui.CHAT", 1), - properties); + // If the general configuration form is disabled don't register it. + if (!configService.getBoolean(OTR_CHAT_CONFIG_DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.SECURITY_TYPE); + // Register the configuration form. + bundleContext.registerService(ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.otr.OtrConfigurationPanel", + getClass().getClassLoader(), + "plugin.otr.configform.ICON", + "service.gui.CHAT", 1), + properties); + } } private ServiceRegistration regRightClickMenu; diff --git a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java index 27397f9..5ef6833 100644 --- a/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java +++ b/src/net/java/sip/communicator/plugin/pluginmanager/PluginManagerActivator.java @@ -35,6 +35,13 @@ public class PluginManagerActivator */ private static ConfigurationService configService; + /** + * Indicates if the plug-in configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.pluginconfig.DISABLED"; + /** * Starts this bundle and adds the * <td>PluginManagerConfigForm</tt> contained in it to the configuration @@ -47,18 +54,23 @@ public class PluginManagerActivator { bundleContext = bc; - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel", - getClass().getClassLoader(), - "plugin.pluginmanager.PLUGIN_ICON", - "plugin.pluginmanager.PLUGINS", - 1000, true), - properties); + // If the plug-in manager configuration form is disabled don't continue. + if(!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.pluginmanager.PluginManagerPanel", + getClass().getClassLoader(), + "plugin.pluginmanager.PLUGIN_ICON", + "plugin.pluginmanager.PLUGINS", + 1000, true), + properties); + } } /** diff --git a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java index bb9a772..bd081a8 100644 --- a/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java +++ b/src/net/java/sip/communicator/plugin/provisioning/ProvisioningActivator.java @@ -72,6 +72,13 @@ public class ProvisioningActivator private static ProvisioningServiceImpl provisioningService = null; /** + * Indicates if the provisioning configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.provisionconfig.DISABLED"; + + /** * Starts this bundle * * @param bundleContext BundleContext @@ -87,19 +94,24 @@ public class ProvisioningActivator provisioningService = new ProvisioningServiceImpl(); - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); + // Show/hide provisioning configuration form. + if(!getConfigurationService().getBoolean(DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.provisioning.ProvisioningForm", - getClass().getClassLoader(), - "plugin.provisioning.PLUGIN_ICON", - "plugin.provisioning.PROVISIONING", - 2000, true), - properties); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.provisioning.ProvisioningForm", + getClass().getClassLoader(), + "plugin.provisioning.PLUGIN_ICON", + "plugin.provisioning.PROVISIONING", + 2000, true), + properties); + } String method = provisioningService.getProvisioningMethod(); diff --git a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java index 23f56cc..dd3cdd6 100644 --- a/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java +++ b/src/net/java/sip/communicator/plugin/securityconfig/SecurityConfigActivator.java @@ -68,6 +68,13 @@ public class SecurityConfigActivator = "net.java.sip.communicator.plugin.securityconfig.DISABLED"; /** + * Indicates if the master password config form should be disabled, i.e. + * not visible to the user. + */ + private static final String MASTER_PASSWORD_DISABLED_PROP + = "net.java.sip.communicator.plugin.securityconfig.MASTER_PASSWORD_DISABLED"; + + /** * Starts this plugin. * @param bc the BundleContext * @throws Exception if some of the operations executed in the start method @@ -97,18 +104,23 @@ public class SecurityConfigActivator 20), properties); - properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.SECURITY_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.securityconfig.masterpassword.ConfigurationPanel", - getClass().getClassLoader(), - null /* iconID */, - "plugin.securityconfig.masterpassword.TITLE", - 3), - properties); + // If the master password config form is disabled don't register it. + if(!getConfigurationService() + .getBoolean(MASTER_PASSWORD_DISABLED_PROP, false)) + { + properties = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.SECURITY_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.securityconfig.masterpassword.ConfigurationPanel", + getClass().getClassLoader(), + null /* iconID */, + "plugin.securityconfig.masterpassword.TITLE", + 3), + properties); + } } /** diff --git a/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java b/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java index c73da84..dee40b1 100644 --- a/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java +++ b/src/net/java/sip/communicator/plugin/simpleaccreg/SimpleAccountRegistrationActivator.java @@ -9,6 +9,7 @@ package net.java.sip.communicator.plugin.simpleaccreg; import java.awt.*; import java.util.*; +import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.contactlist.*; import net.java.sip.communicator.service.gui.*; import net.java.sip.communicator.service.protocol.*; @@ -41,6 +42,13 @@ public class SimpleAccountRegistrationActivator = "net.java.sip.communicator.plugin.provisioning.ProvisioningForm"; /** + * Indicates if the configuration wizard should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.simpleaccreg.DISABLED"; + + /** * OSGi bundle context. */ public static BundleContext bundleContext; @@ -51,12 +59,16 @@ public class SimpleAccountRegistrationActivator { bundleContext = bc; + /* * Because the stored accounts may be asynchronously loaded, relying * only on the registered accounts isn't possible. Instead, presume the * stored accounts are valid and will later successfully be registered. + * + * And if the account registration wizard is disabled don't continue. */ - if (!hasStoredAccounts()) + if (!hasStoredAccounts() + && !getConfigService().getBoolean(DISABLED_PROP, false)) { // If no preferred wizard is specified we launch the default wizard. InitialAccountRegistrationFrame accountRegFrame = @@ -313,4 +325,17 @@ public class SimpleAccountRegistrationActivator return null; } + + /** + * Returns a reference to a ConfigurationService implementation currently + * registered in the bundle context or null if no such implementation was + * found. + * + * @return a currently valid implementation of the ConfigurationService. + */ + public static ConfigurationService getConfigService() + { + return ServiceUtils.getService(bundleContext, + ConfigurationService.class); + } } diff --git a/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerActivator.java b/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerActivator.java index 9c0fa71..9953a0d 100644 --- a/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerActivator.java +++ b/src/net/java/sip/communicator/plugin/skinmanager/SkinManagerActivator.java @@ -7,7 +7,9 @@ package net.java.sip.communicator.plugin.skinmanager; import java.util.*; +import net.java.sip.communicator.service.configuration.*; import net.java.sip.communicator.service.gui.*; +import net.java.sip.communicator.util.*; import org.osgi.framework.*; @@ -31,6 +33,13 @@ public class SkinManagerActivator private static UIService uiService; /** + * Indicates if the skin manager configuration form should be disabled, i.e. + * not visible to the user. + */ + private static final String DISABLED_PROP + = "net.java.sip.communicator.plugin.skinconfig.DISABLED"; + + /** * Starts this bundle and adds the * <td>SkinManagerConfigForm</tt> contained in it to the configuration * window obtained from the <tt>UIService</tt>. @@ -42,18 +51,23 @@ public class SkinManagerActivator { bundleContext = bc; - Dictionary<String, String> properties = new Hashtable<String, String>(); - properties.put( ConfigurationForm.FORM_TYPE, - ConfigurationForm.ADVANCED_TYPE); - bundleContext.registerService( - ConfigurationForm.class.getName(), - new LazyConfigurationForm( - "net.java.sip.communicator.plugin.skinmanager.SkinManagerPanel", - getClass().getClassLoader(), - "plugin.skinmanager.PLUGIN_ICON", - "plugin.skinmanager.SKINS", - 1001, true), - properties); + // If the skin manager configuration form is disabled don't continue. + if(!getConfigService().getBoolean(DISABLED_PROP, false)) + { + Dictionary<String, String> properties + = new Hashtable<String, String>(); + properties.put( ConfigurationForm.FORM_TYPE, + ConfigurationForm.ADVANCED_TYPE); + bundleContext.registerService( + ConfigurationForm.class.getName(), + new LazyConfigurationForm( + "net.java.sip.communicator.plugin.skinmanager.SkinManagerPanel", + getClass().getClassLoader(), + "plugin.skinmanager.PLUGIN_ICON", + "plugin.skinmanager.SKINS", + 1001, true), + properties); + } } /** @@ -83,4 +97,18 @@ public class SkinManagerActivator return uiService; } + + /** + * Returns a reference to a ConfigurationService implementation currently + * registered in the bundle context or null if no such implementation was + * found. + * + * @return a currently valid implementation of the ConfigurationService. + */ + public static ConfigurationService getConfigService() + { + return ServiceUtils.getService( + bundleContext, + ConfigurationService.class); + } } diff --git a/src/net/java/sip/communicator/plugin/update/UpdateActivator.java b/src/net/java/sip/communicator/plugin/update/UpdateActivator.java index 26c7b03..5bcc363 100644 --- a/src/net/java/sip/communicator/plugin/update/UpdateActivator.java +++ b/src/net/java/sip/communicator/plugin/update/UpdateActivator.java @@ -41,6 +41,13 @@ public class UpdateActivator = "net.java.sip.communicator.plugin.updatechecker.ENABLED";
/**
+ * The name of the configuration property which indicates whether the
+ * "checking for updates" menu entry is disabled.
+ */
+ private static final String CHECK_FOR_UPDATES_MENU_DISABLED_PROP
+ = "net.java.sip.communicator.plugin.update.CHECK_FOR_UPDATES_MENU_DISABLED";
+
+ /**
* Reference to the <tt>BrowserLauncherService</tt>.
*/
private static BrowserLauncherService browserLauncher;
@@ -157,24 +164,31 @@ public class UpdateActivator updateService,
null);
- // Register the "Check for Updates" menu item.
- CheckForUpdatesMenuItemComponent checkForUpdatesMenuItemComponent
- = new CheckForUpdatesMenuItemComponent(
- Container.CONTAINER_HELP_MENU);
-
- Hashtable<String, String> toolsMenuFilter
- = new Hashtable<String, String>();
- toolsMenuFilter.put(
- Container.CONTAINER_ID,
- Container.CONTAINER_HELP_MENU.getID());
+ ConfigurationService cfg = getConfiguration();
- bundleContext.registerService(
- PluginComponent.class.getName(),
- checkForUpdatesMenuItemComponent,
- toolsMenuFilter);
+ // Register the "Check for Updates" menu item if
+ // the "Check for Updates" property isn't disabled.
+ if(!cfg.getBoolean(CHECK_FOR_UPDATES_MENU_DISABLED_PROP, false))
+ {
+ // Register the "Check for Updates" menu item.
+ CheckForUpdatesMenuItemComponent
+ checkForUpdatesMenuItemComponent
+ = new CheckForUpdatesMenuItemComponent(
+ Container.CONTAINER_HELP_MENU);
+
+ Hashtable<String, String> toolsMenuFilter
+ = new Hashtable<String, String>();
+ toolsMenuFilter.put(
+ Container.CONTAINER_ID,
+ Container.CONTAINER_HELP_MENU.getID());
+
+ bundleContext.registerService(
+ PluginComponent.class.getName(),
+ checkForUpdatesMenuItemComponent,
+ toolsMenuFilter);
+ }
// Check for software update upon startup if enabled.
- ConfigurationService cfg = getConfiguration();
if(cfg.getBoolean(UPDATE_ENABLED, true))
updateService.checkForUpdates(false);
}
|