1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.text.java.hover;
13 import java.text.MessageFormat;
14 import java.util.MissingResourceException;
15 import java.util.ResourceBundle;
17 class JavaHoverMessages {
19 private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.internal.ui.text.java.hover.JavaHoverMessages";//$NON-NLS-1$
21 private static ResourceBundle fgResourceBundle = ResourceBundle
22 .getBundle(RESOURCE_BUNDLE);
24 private JavaHoverMessages() {
27 public static String getString(String key) {
29 return fgResourceBundle.getString(key);
30 } catch (MissingResourceException e) {
31 return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
36 * Gets a string from the resource bundle and formats it with the argument
39 * the string used to get the bundle value, must not be null
42 public static String getFormattedString(String key, Object arg) {
45 format = fgResourceBundle.getString(key);
46 } catch (MissingResourceException e) {
47 return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
50 arg = ""; //$NON-NLS-1$
51 return MessageFormat.format(format, new Object[] { arg });
55 * Gets a string from the resource bundle and formats it with the arguments
58 * the string used to get the bundle value, must not be null
61 public static String getFormattedString(String key, Object arg1, Object arg2) {
64 format = fgResourceBundle.getString(key);
65 } catch (MissingResourceException e) {
66 return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
69 arg1 = ""; //$NON-NLS-1$
71 arg2 = ""; //$NON-NLS-1$
72 return MessageFormat.format(format, new Object[] { arg1, arg2 });
76 * Gets a string from the resource bundle and formats it with the argument
79 * the string used to get the bundle value, must not be null
82 public static String getFormattedString(String key, boolean arg) {
85 format = fgResourceBundle.getString(key);
86 } catch (MissingResourceException e) {
87 return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
89 return MessageFormat.format(format, new Object[] { new Boolean(arg) });