1) Reintroduced PHPPerspectiveFactory (was lost with refactoring).
[phpeclipse.git] / net.sourceforge.phpeclipse.ui / src / net / sourceforge / phpdt / internal / ui / text / java / hover / JavaHoverMessages.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.ui.text.java.hover;
12
13 import java.text.MessageFormat;
14 import java.util.MissingResourceException;
15 import java.util.ResourceBundle;
16
17 class JavaHoverMessages {
18
19         private static final String RESOURCE_BUNDLE = "net.sourceforge.phpdt.internal.ui.text.java.hover.JavaHoverMessages";//$NON-NLS-1$
20
21         private static ResourceBundle fgResourceBundle = ResourceBundle
22                         .getBundle(RESOURCE_BUNDLE);
23
24         private JavaHoverMessages() {
25         }
26
27         public static String getString(String key) {
28                 try {
29                         return fgResourceBundle.getString(key);
30                 } catch (MissingResourceException e) {
31                         return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
32                 }
33         }
34
35         /**
36          * Gets a string from the resource bundle and formats it with the argument
37          * 
38          * @param key
39          *            the string used to get the bundle value, must not be null
40          * @since 3.0
41          */
42         public static String getFormattedString(String key, Object arg) {
43                 String format = null;
44                 try {
45                         format = fgResourceBundle.getString(key);
46                 } catch (MissingResourceException e) {
47                         return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
48                 }
49                 if (arg == null)
50                         arg = ""; //$NON-NLS-1$
51                 return MessageFormat.format(format, new Object[] { arg });
52         }
53
54         /**
55          * Gets a string from the resource bundle and formats it with the arguments
56          * 
57          * @param key
58          *            the string used to get the bundle value, must not be null
59          * @since 3.0
60          */
61 //      public static String getFormattedString(String key, Object arg1, Object arg2) {
62 //              String format = null;
63 //              try {
64 //                      format = fgResourceBundle.getString(key);
65 //              } catch (MissingResourceException e) {
66 //                      return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
67 //              }
68 //              if (arg1 == null)
69 //                      arg1 = ""; //$NON-NLS-1$
70 //              if (arg2 == null)
71 //                      arg2 = ""; //$NON-NLS-1$
72 //              return MessageFormat.format(format, new Object[] { arg1, arg2 });
73 //      }
74
75         /**
76          * Gets a string from the resource bundle and formats it with the argument
77          * 
78          * @param key
79          *            the string used to get the bundle value, must not be null
80          * @since 3.0
81          */
82 //      public static String getFormattedString(String key, boolean arg) {
83 //              String format = null;
84 //              try {
85 //                      format = fgResourceBundle.getString(key);
86 //              } catch (MissingResourceException e) {
87 //                      return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
88 //              }
89 //              return MessageFormat.format(format, new Object[] { new Boolean(arg) });
90 //      }
91 }