1 /******************************************************************************* 2 * Copyright (c) 2000, 2007 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 *******************************************************************************/ 11 package org.eclipse.test.performance.ui; 12 13 import java.text.MessageFormat; 14 15 import org.eclipse.osgi.util.NLS; 16 17 public class Messages extends NLS { 18 19 private static final String BUNDLE_NAME = "org.eclipse.test.performance.ui.messages";//$NON-NLS-1$ 20 21 private Messages() { 22 // Do not instantiate 23 } 24 25 public static String standardError; 26 27 static { 28 NLS.initializeMessages(BUNDLE_NAME, Messages.class); 29 } 30 31 /** 32 * Bind the given message's substitution locations with the given string values. 33 * 34 * @param message the message to be manipulated 35 * @return the manipulated String 36 */ 37 public static String bind(String message) { 38 return bind(message, null); 39 } 40 41 /** 42 * Bind the given message's substitution locations with the given string values. 43 * 44 * @param message the message to be manipulated 45 * @param binding the object to be inserted into the message 46 * @return the manipulated String 47 */ 48 public static String bind(String message, Object binding) { 49 return bind(message, new Object[] {binding}); 50 } 51 52 /** 53 * Bind the given message's substitution locations with the given string values. 54 * 55 * @param message the message to be manipulated 56 * @param binding1 An object to be inserted into the message 57 * @param binding2 A second object to be inserted into the message 58 * @return the manipulated String 59 */ 60 public static String bind(String message, Object binding1, Object binding2) { 61 return bind(message, new Object[] {binding1, binding2}); 62 } 63 64 /** 65 * Bind the given message's substitution locations with the given string values. 66 * 67 * @param message the message to be manipulated 68 * @param bindings An array of objects to be inserted into the message 69 * @return the manipulated String 70 */ 71 public static String bind(String message, Object[] bindings) { 72 return MessageFormat.format(message, bindings); 73 } 74 75 } 76