1
/*******************************************************************************
2
* Copyright (c) 2002, 2007 QNX Software Systems 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
9
* QNX Software Systems - initial API and implementation
10
*******************************************************************************/
11
package org.eclipse.cdt.newmake.internal.core;
13
import com.ibm.icu.text.MessageFormat;
14
import java.util.MissingResourceException;
15
import java.util.ResourceBundle;
18
public class MakeMessages {
20
private static final String RESOURCE_BUNDLE= MakeMessages.class.getName();
21
private static ResourceBundle fgResourceBundle;
24
fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
25
} catch (MissingResourceException x) {
26
fgResourceBundle = null;
30
private MakeMessages() {
33
public static String getString(String key) {
35
return fgResourceBundle.getString(key);
36
} catch (MissingResourceException e) {
37
return '!' + key + '!';
38
} catch (NullPointerException e) {
39
return "#" + key + "#"; //$NON-NLS-1$ //$NON-NLS-2$
44
* Gets a string from the resource bundle and formats it with the argument
46
* @param key the string used to get the bundle value, must not be null
48
public static String getFormattedString(String key, Object arg) {
49
return MessageFormat.format(getString(key), new Object[] { arg });
53
* Gets a string from the resource bundle and formats it with arguments
55
public static String getFormattedString(String key, Object[] args) {
56
return MessageFormat.format(getString(key), args);