Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 87af5c89f1b3b9f8804e46c85fd0c2597d7d6859 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*******************************************************************************
 * Copyright (c) 2017 Red Hat.
 * 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 - Initial Contribution
 *******************************************************************************/
package org.eclipse.linuxtools.internal.mylyn.osio.rest.core;

import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class OSIORestMessages {

        private static final String BUNDLE_NAME = OSIORestMessages.class.getName();

        public static String getString(String key) {
                try {
                        return ResourceBundle.getBundle(BUNDLE_NAME).getString(key);
                } catch (MissingResourceException e) {
                        return '!' + key + '!';
                } catch (NullPointerException e) {
                        return '#' + key + '#'; //$NON-NLS-1$ //$NON-NLS-2$
                }
        }

        public static String getFormattedString(String key, String arg) {
                return MessageFormat.format(getString(key), arg);
        }

        public static String getFormattedString(String key, String[] args) {
                return MessageFormat.format(getString(key), (Object[]) args);
        }

}

Back to the top