blob: f09b7ee0b0da2d30c1833747aba7c02054acdfc0 [file] [log] [blame]
package org.eclipse.ui.views.framelist;
/**********************************************************************
Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
All rights reserved.   This program and the accompanying materials
are made available under the terms of the Common Public License v0.5
which accompanies this distribution, and is available at
http://www.eclipse.org/legal/cpl-v05.html
 
Contributors:
**********************************************************************/
import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
/**
* Utility class which helps with managing messages.
*/
class FrameListMessages {
private static final String RESOURCE_BUNDLE = "org.eclipse.ui.views.framelist.messages"; //$NON-NLS-1$
private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
private FrameListMessages() {
// prevent instantiation of class
}
/**
* Returns the formatted message for the given key in
* the resource bundle.
*
* @param key the resource name
* @param args the message arguments
* @return the string
*/
public static String format(String key, Object[] args) {
return MessageFormat.format(getString(key), args);
}
/**
* Returns the resource object with the given key in
* the resource bundle. If there isn't any value under
* the given key, the key is returned.
*
* @param key the resource name
* @return the string
*/
public static String getString(String key) {
try {
return bundle.getString(key);
} catch (MissingResourceException e) {
return key;
}
}
}