/******************************************************************************* * Copyright (c) 2006, 2012 Red Hat Inc.. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors: * Red Hat Incorporated - initial API and implementation *******************************************************************************/ package org.eclipse.cdt.internal.autotools.ui.actions; import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; public class InvokeMessages { private static final String BUNDLE_NAME = InvokeMessages.class.getName(); private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle .getBundle(BUNDLE_NAME); private InvokeMessages() { } /** * Returns the string from the resource bundle, * or 'key' if not found. * * @param key the message key * @return the resource bundle message */ public static String getString(String key) { try { return RESOURCE_BUNDLE.getString(key); } catch (MissingResourceException e) { return '!' + key + '!'; } } /** * Returns the formatted string from the resource bundle, * or 'key' if not found. * * @param key the message key * @param args an array of substituition strings * @return the resource bundle message */ public static String getFormattedString(String key, String[] args) { return MessageFormat.format(getString(key), (Object[])args); } }