001 /**
002 * <copyright>
003 *
004 * Copyright (c) 2002-2004 IBM Corporation and others.
005 * All rights reserved. This program and the accompanying materials
006 * are made available under the terms of the Eclipse Public License v1.0
007 * which accompanies this distribution, and is available at
008 * http://www.eclipse.org/legal/epl-v10.html
009 *
010 * Contributors:
011 * IBM - Initial API and implementation
012 *
013 * </copyright>
014 *
015 * $Id: ResourceLocator.java,v 1.4 2007/06/12 20:56:17 emerks Exp $
016 */
017 package org.eclipse.emf.common.util;
018
019
020 import java.net.URL;
021
022
023 /**
024 * A locator of Java resources.
025 */
026 public interface ResourceLocator
027 {
028 /**
029 * Returns the URL from which all resources are based.
030 * @return the URL from which all resources are based.
031 */
032 URL getBaseURL();
033
034 /**
035 * Returns the description that can be used to create the image resource associated with the key.
036 * The description will typically be in the form of a URL to the image data.
037 * Creation of an actual image depends on the GUI environment;
038 * within Eclipse, org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry can be used.
039 * @param key the key of the image resource.
040 * @return the description on the image resource.
041 */
042 Object getImage(String key);
043
044 /**
045 * Returns the string resource associated with the key.
046 * @param key the key of the string resource.
047 * @return the string resource associated with the key.
048 */
049 String getString(String key);
050
051 /**
052 * Returns the string resource associated with the key.
053 * @param key the key of the string resource.
054 * @param translate whether the result is to be translated to the current locale.
055 * @return the string resource associated with the key.
056 */
057 String getString(String key, boolean translate);
058
059 /**
060 * Returns a string resource associated with the key, and performs substitutions.
061 * @param key the key of the string.
062 * @param substitutions the message substitutions.
063 * @return a string resource associated with the key.
064 * @see #getString(String)
065 * @see java.text.MessageFormat#format(String, Object[])
066 */
067 String getString(String key, Object [] substitutions);
068
069 /**
070 * Returns a string resource associated with the key, and performs substitutions.
071 * @param key the key of the string.
072 * @param substitutions the message substitutions.
073 * @param translate whether the result is to be translated to the current locale.
074 * @return a string resource associated with the key.
075 * @see #getString(String)
076 * @see java.text.MessageFormat#format(String, Object[])
077 */
078 String getString(String key, Object [] substitutions, boolean translate);
079 }