Refactory: remove unused classes, imports, fields and methods.
[phpeclipse.git] / net.sourceforge.phpeclipse.externaltools / src / net / sourceforge / phpdt / externaltools / internal / model / ExternalToolsModelMessages.java
1 package net.sourceforge.phpdt.externaltools.internal.model;
2
3 /**********************************************************************
4  Copyright (c) 2002 IBM Corp. and others. All rights reserved.
5  This file is made available under the terms of the Common Public License v1.0
6  which accompanies this distribution, and is available at
7  http://www.eclipse.org/legal/cpl-v10.html
8  �
9  Contributors:
10  **********************************************************************/
11
12 import java.text.MessageFormat;
13 import java.util.MissingResourceException;
14 import java.util.ResourceBundle;
15
16 /**
17  * Utility class which helps managing messages
18  */
19 public final class ExternalToolsModelMessages {
20         private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.externaltools.internal.model.ExternalToolsModelMessages"; //$NON-NLS-1$
21
22         private static ResourceBundle bundle = ResourceBundle
23                         .getBundle(RESOURCE_BUNDLE);
24
25         private ExternalToolsModelMessages() {
26                 // prevent instantiation of class
27         }
28
29         /**
30          * Returns the formatted message for the given key in the resource bundle.
31          * 
32          * @param key
33          *            the message name
34          * @param args
35          *            the message arguments
36          * @return the formatted message
37          */
38         public static String format(String key, Object[] args) {
39                 return MessageFormat.format(getString(key), args);
40         }
41
42         /**
43          * Returns the message with the given key in the resource bundle. If there
44          * isn't any value under the given key, the key is returned.
45          * 
46          * @param key
47          *            the message name
48          * @return the message
49          */
50         public static String getString(String key) {
51                 try {
52                         return bundle.getString(key);
53                 } catch (MissingResourceException e) {
54                         return key;
55                 }
56         }
57
58         /**
59          * Returns the resource bundle for the plug-in
60          */
61 //      public static ResourceBundle getResourceBundle() {
62 //              return bundle;
63 //      }
64 }