From bba761f2b4cd425fb37305f51a69d8b8bfefb71d Mon Sep 17 00:00:00 2001 From: Yana Stamcheva Date: Tue, 15 Jan 2008 10:59:10 +0000 Subject: [PATCH] Application main constants moved to application.properties file in the main resources directory. --- build.xml | 20 ++----- .../impl/gui/utils/ApplicationProperties.java | 57 +++++++++++++++++++ 2 files changed, 63 insertions(+), 14 deletions(-) create mode 100644 src/net/java/sip/communicator/impl/gui/utils/ApplicationProperties.java diff --git a/build.xml b/build.xml index 00d048c35..330d66233 100644 --- a/build.xml +++ b/build.xml @@ -1354,14 +1354,8 @@ javax.swing.event, javax.swing.border"/> prefix="net/java/sip/communicator/service/gui"/> - - - - + @@ -1561,12 +1555,8 @@ javax.swing.event, javax.swing.border"/> manifest="${src}/net/java/sip/communicator/plugin/branding/branding.manifest.mf"> - - - + @@ -1619,6 +1609,8 @@ javax.swing.event, javax.swing.border"/> + diff --git a/src/net/java/sip/communicator/impl/gui/utils/ApplicationProperties.java b/src/net/java/sip/communicator/impl/gui/utils/ApplicationProperties.java new file mode 100644 index 000000000..0e0a581a2 --- /dev/null +++ b/src/net/java/sip/communicator/impl/gui/utils/ApplicationProperties.java @@ -0,0 +1,57 @@ +/* + * SIP Communicator, the OpenSource Java VoIP and Instant Messaging client. + * + * Distributable under LGPL license. + * See terms of license at gnu.org. + */ +package net.java.sip.communicator.impl.gui.utils; + +import java.util.*; + +import net.java.sip.communicator.util.*; + +/** + * Accesses all application properties saved in the application.properties file. + * + * @author Yana Stamcheva + */ +public class ApplicationProperties +{ + /** + * Logger for this class. + */ + private static Logger log = Logger.getLogger(ColorResources.class); + + /** + * Name of the bundle where we will search for color resources. + */ + private static final String BUNDLE_NAME + = "resources.application"; + + /** + * Bundle which handle access to localized resources. + */ + private static final ResourceBundle PROPERTIES_BUNDLE = ResourceBundle + .getBundle( BUNDLE_NAME); + + /** + * Returns the application property corresponding to the given key. + * + * @param key The key of the string. + * + * @return the application property corresponding to the given key + */ + public static String getProperty(String key) + { + try + { + return PROPERTIES_BUNDLE.getString(key); + } + catch (MissingResourceException e) + { + log.error("Missing property.", e); + + return ""; + } + } +}