/*
 * Copyright (C) 2005 NTT DATA Corporation
 * 
 */
package org.postgresforest.tool.util;

import java.text.MessageFormat;

import org.postgresforest.tool.ForestToolPlugin;

/**
 * TODO To change the template for this generated type comment go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
public class Messages {
	
	/**
	 * 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 getString(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) {
		return ForestToolPlugin.getResourceString(key);
	}
	
	public static String getString(String key, String arg) {

		String[] args = {arg};
		return getString(key, args);
	
	}

}