Mercurial > projects > dwt2
comparison org.eclipse.core.databinding/src/org/eclipse/core/internal/databinding/BindingMessages.d @ 78:0a55d2d5a946
Added file for databinding
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Tue, 14 Apr 2009 11:35:29 +0200 |
parents | |
children | 6be48cf9f95c |
comparison
equal
deleted
inserted
replaced
76:f05e6e8b2f2d | 78:0a55d2d5a946 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2005, 2008 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Tom Schindl<tom.schindl@bestsolution.at> - bugfix for 217940 | |
11 *******************************************************************************/ | |
12 module org.eclipse.core.internal.databinding.BindingMessages; | |
13 | |
14 import java.lang.all; | |
15 | |
16 import java.util.MissingResourceException; | |
17 import java.util.ResourceBundle; | |
18 | |
19 import com.ibm.icu.text.MessageFormat; | |
20 | |
21 /** | |
22 * @since 1.0 | |
23 * | |
24 */ | |
25 public class BindingMessages { | |
26 | |
27 /** | |
28 * The Binding resource bundle; eagerly initialized. | |
29 */ | |
30 private static final ResourceBundle bundle = ResourceBundle | |
31 .getBundle("org.eclipse.core.internal.databinding.messages"); //$NON-NLS-1$ | |
32 | |
33 /** | |
34 * Key to be used for an index out of range message. | |
35 */ | |
36 public static final String INDEX_OUT_OF_RANGE = "IndexOutOfRange"; //$NON-NLS-1$ | |
37 | |
38 /** | |
39 * Key to be used for a "Multiple Problems." message. | |
40 */ | |
41 public static final String MULTIPLE_PROBLEMS = "MultipleProblems"; //$NON-NLS-1$ | |
42 | |
43 /** | |
44 * Key to be used for a "ValueBinding_ErrorWhileSettingValue" message | |
45 */ | |
46 public static final String VALUEBINDING_ERROR_WHILE_SETTING_VALUE = "ValueBinding_ErrorWhileSettingValue"; //$NON-NLS-1$ | |
47 | |
48 /** | |
49 * Key to be used for a "DateFormat_DateTime" message | |
50 */ | |
51 public static final String DATE_FORMAT_DATE_TIME = "DateFormat_DateTime"; //$NON-NLS-1$ | |
52 | |
53 /** | |
54 * Key to be used for a "DateFormat_Time" message | |
55 */ | |
56 public static final String DATEFORMAT_TIME = "DateFormat_Time"; //$NON-NLS-1$ | |
57 | |
58 /** | |
59 * Key to be used for a "ValueDelimiter" message | |
60 */ | |
61 public static final String VALUE_DELIMITER = "ValueDelimiter"; //$NON-NLS-1$ | |
62 | |
63 /** | |
64 * Key to be used for a "TrueStringValues" message | |
65 */ | |
66 public static final String TRUE_STRING_VALUES = "TrueStringValues"; //$NON-NLS-1$ | |
67 | |
68 /** | |
69 * Key to be used for a "FalseStringValues" message | |
70 */ | |
71 public static final String FALSE_STRING_VALUES = "FalseStringValues"; //$NON-NLS-1$ | |
72 | |
73 /** | |
74 * Key to be used for a "Validate_NumberOutOfRangeError" message | |
75 */ | |
76 public static final String VALIDATE_NUMBER_OUT_OF_RANGE_ERROR = "Validate_NumberOutOfRangeError"; //$NON-NLS-1$ | |
77 | |
78 /** | |
79 * Key to be used for a "Validate_NumberParseError" message | |
80 */ | |
81 public static final String VALIDATE_NUMBER_PARSE_ERROR = "Validate_NumberParseError"; //$NON-NLS-1$ | |
82 | |
83 /** | |
84 * Key to be used for a "Validate_ConversionToPrimitive" message | |
85 */ | |
86 public static final String VALIDATE_CONVERSION_TO_PRIMITIVE = "Validate_ConversionToPrimitive"; //$NON-NLS-1$ | |
87 | |
88 /** | |
89 * Key to be used for a "Validate_ConversionFromClassToPrimitive" message | |
90 */ | |
91 public static final String VALIDATE_CONVERSION_FROM_CLASS_TO_PRIMITIVE = "Validate_ConversionFromClassToPrimitive"; //$NON-NLS-1$ | |
92 | |
93 /** | |
94 * Key to be used for a "Validate_NoChangeAllowedHelp" message | |
95 */ | |
96 public static final String VALIDATE_NO_CHANGE_ALLOWED_HELP = "Validate_NoChangeAllowedHelp"; //$NON-NLS-1$ | |
97 | |
98 /** | |
99 * Key to be used for a "Validate_CharacterHelp" message | |
100 */ | |
101 public static final String VALIDATE_CHARACTER_HELP = "Validate_CharacterHelp"; //$NON-NLS-1$ | |
102 | |
103 /** | |
104 * Key to be used for a "Examples" message | |
105 */ | |
106 public static final String EXAMPLES = "Examples"; //$NON-NLS-1$ | |
107 | |
108 /** | |
109 * Key to be used for a "Validate_NumberParseErrorNoCharacter" message | |
110 */ | |
111 public static final String VALIDATE_NUMBER_PARSE_ERROR_NO_CHARACTER = "Validate_NumberParseErrorNoCharacter"; //$NON-NLS-1$ | |
112 | |
113 /** | |
114 * Returns the resource object with the given key in the resource bundle for | |
115 * JFace Data Binding. If there isn't any value under the given key, the key | |
116 * is returned. | |
117 * | |
118 * @param key | |
119 * the resource name | |
120 * @return the string | |
121 */ | |
122 public static String getString(String key) { | |
123 try { | |
124 return bundle.getString(key); | |
125 } catch (MissingResourceException e) { | |
126 return key; | |
127 } | |
128 } | |
129 | |
130 /** | |
131 * Returns a formatted string with the given key in the resource bundle for | |
132 * JFace Data Binding. | |
133 * | |
134 * @param key | |
135 * @param arguments | |
136 * @return formatted string, the key if the key is invalid | |
137 */ | |
138 public static String formatString(String key, Object[] arguments) { | |
139 try { | |
140 return MessageFormat.format(bundle.getString(key), arguments); | |
141 } catch (MissingResourceException e) { | |
142 return key; | |
143 } | |
144 } | |
145 } |