tracesrv/tracecompiler/src/com.nokia.tracecompiler/src/com/nokia/tracecompiler/document/Messages.java
changeset 56 aa2539c91954
parent 41 838cdffd57ce
equal deleted inserted replaced
54:a151135b0cf9 56:aa2539c91954
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:
       
    15 *
       
    16 * Localized strings for engine package
       
    17 *
       
    18 */
       
    19 package com.nokia.tracecompiler.document;
       
    20 
       
    21 import java.util.MissingResourceException;
       
    22 import java.util.ResourceBundle;
       
    23 
       
    24 public class Messages {
       
    25 
       
    26 	/**
       
    27 	 * Bundle name
       
    28 	 */
       
    29 	private static final String BUNDLE_NAME = "com.nokia.tracecompiler.document.messages"; //$NON-NLS-1$
       
    30 
       
    31 	/**
       
    32 	 * Bundle
       
    33 	 */
       
    34 	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
       
    35 			.getBundle(BUNDLE_NAME);
       
    36 
       
    37 	/**
       
    38 	 * Prevents construction
       
    39 	 */
       
    40 	private Messages() {
       
    41 	}
       
    42 
       
    43 	/**
       
    44 	 * Gets localized string based on key
       
    45 	 * 
       
    46 	 * @param key
       
    47 	 *            the resource key
       
    48 	 * @return the localized resource
       
    49 	 */
       
    50 	public static String getString(String key) {
       
    51 		try {
       
    52 			return RESOURCE_BUNDLE.getString(key);
       
    53 		} catch (MissingResourceException e) {
       
    54 			return '!' + key + '!';
       
    55 		}
       
    56 	}
       
    57 }