⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eclipsemecorestrings.java

📁 eclipseme的最新版本的source,欢迎j2me程序员使用
💻 JAVA
字号:
/*  
 ********************************************************************
 * 
 *	File    	:   EclipseMECoreStrings
 *  Package     :   eclipseme.core
 *	System      :   eclipseme.core
 *	Author      :   Kevin Hunter
 *	Description :   This class provides internationalization of strings
 *					in the EclipseME eclipseme.core package.
 *	                
 * Copyright (c) 2004 Kevin Hunter
 * All Rights Reserved.
 * Licensed under the Eclipse Public License - v 1.0
 * For more information see http://www.eclipse.org/legal/epl-v10.html
 *
 *  CVS
 *	$$Source: /cvsroot/eclipseme/eclipseme.core/src/eclipseme/core/EclipseMECoreStrings.java,v $$
 *	$$Author: kdhunter $$
 *	$$Date: 2004/12/08 00:34:15 $$
 *	$$Revision: 1.3 $$
 *
 ********************************************************************
 */
package eclipseme.core;

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

/**
 * This class provides the means to internationalize strings that are located
 * in the eclipseme.core package.  It sets up a ResourceBundle based on the
 * file <code>EclipseMECoreStrings.properties</code> in the eclipseme.core
 * package, and allows retrieval of keyed strings from that bundle. 
 * 
 * @author khunter
 *
 */
public class EclipseMECoreStrings
{
	private static final String BUNDLE_NAME = "eclipseme.core.EclipseMEPluginResources";
	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME);
	
	/**
	 * Returns the string from the plugin's resource bundle,
	 * or 'key' if not found.
	 */
	
	public static String getString(String key)
	{
		String result = key;
		try
		{
			result = RESOURCE_BUNDLE.getString(key).trim();
		}
		catch(MissingResourceException e)
		{
		}
		
		return(result);
	}
	
	/**
	 * Returns the string from the plugin's resource bundle,
	 * or 'key' if not found.  Substitutions will be made if
	 * supplied.
	 * 
	 * @param key
	 * @param substitutions
	 * @return String
	 */
	
	public static String getString(String key, Object[] substitutions)
	{
		String result = '!' + key + '!';
		try
		{
			result = RESOURCE_BUNDLE.getString(key).trim();
		}
		catch(MissingResourceException e)
		{
		}
		
		return MessageFormat.format(result, substitutions);
	}
	
	/**
	 * Returns the string from the plugin's resource bundle,
	 * or <code>null</code> if not found.
	 */
	
	public static String getBundleString(String key)
	{
		String result = null;
		try
		{
			result = RESOURCE_BUNDLE.getString(key).trim();
		}
		catch(MissingResourceException e)
		{
		}
		
		return(result);
	}
	
}

/*
 ********************************************************************
 *	CVS History
 *	$$Log: EclipseMECoreStrings.java,v $
 *	$Revision 1.3  2004/12/08 00:34:15  kdhunter
 *	$Modified other classes in core to use new
 *	$resource strings class.
 *	$
 *	$Revision 1.2  2004/12/07 03:24:14  kdhunter
 *	$Tied into existing property bundle
 *	$
 *	$Revision 1.1  2004/12/07 02:43:24  kdhunter
 *	$Switched from custom exception classes to CoreException
 *	$in signing routines.
 *	$Set up basic error code and error message handling, including
 *	$prep for internationalization
 *	$$
 *
 ********************************************************************
 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -