1
2
3
4
5
6
7
8
9
10
11
12 package sk.uniba.euromath.editor.lang;
13
14 import java.util.MissingResourceException;
15 import java.util.ResourceBundle;
16 import sk.uniba.euromath.tools.LangTools;
17
18 /***
19 * Class for retreiving common error messages in editor, that are displayed to
20 * user.
21 *
22 * @author Tomáš Studva 24.1.2006
23 */
24 public class ErrorMessages {
25 /***
26 * Name of bundle with messages.
27 */
28 private static final String BUNDLE_NAME = "sk.uniba.euromath.editor.lang.errorMessages";
29
30 /***
31 * Resource bundle.
32 */
33 private static final ResourceBundle RESOURCE_BUNDLE = LangTools.newBundle(
34 BUNDLE_NAME, ErrorMessages.class);
35
36 /***
37 * Hides contructor.
38 */
39 private ErrorMessages() {
40
41 }
42
43 /***
44 * Gets message for given key.
45 * @param key key in the properties file.
46 * @return message associated with the key.
47 */
48 public static String getString(String key) {
49 try {
50 return RESOURCE_BUNDLE.getString(key);
51 } catch (MissingResourceException e) {
52 return '!' + key + '!';
53 }
54 }
55 }