| /* |
| * Copyright (c) 2003, 2004 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Common Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/cpl-v10.html |
| * |
| * Contributors: |
| * IBM - Initial API and implementation |
| * |
| * $Id: ExamplesPlugin.java,v 1.2 2004/05/25 21:58:16 khussey Exp $ |
| */ |
| package org.eclipse.uml2.examples; |
| |
| import java.util.MissingResourceException; |
| import java.util.ResourceBundle; |
| |
| import org.eclipse.core.resources.IWorkspace; |
| import org.eclipse.core.resources.ResourcesPlugin; |
| |
| import org.eclipse.emf.common.EMFPlugin; |
| |
| /** |
| * |
| */ |
| public class ExamplesPlugin |
| extends EMFPlugin.EclipsePlugin { |
| |
| //The shared instance. |
| private static ExamplesPlugin plugin; |
| |
| //Resource bundle. |
| private ResourceBundle resourceBundle; |
| |
| /** |
| * The constructor. |
| */ |
| public ExamplesPlugin() { |
| super(); |
| |
| plugin = this; |
| |
| try { |
| resourceBundle = ResourceBundle |
| .getBundle("org.eclipse.uml2.examples.ExamplesPluginResources"); //$NON-NLS-1$ |
| } catch (MissingResourceException x) { |
| resourceBundle = null; |
| } |
| } |
| |
| /** |
| * Returns the shared instance. |
| */ |
| public static ExamplesPlugin getDefault() { |
| return plugin; |
| } |
| |
| /** |
| * Returns the workspace instance. |
| */ |
| public static IWorkspace getWorkspace() { |
| return ResourcesPlugin.getWorkspace(); |
| } |
| |
| /** |
| * Returns the string from the plugin's resource bundle, or 'key' if not |
| * found. |
| */ |
| public static String getResourceString(String key) { |
| ResourceBundle bundle = ExamplesPlugin.getDefault().getResourceBundle(); |
| |
| try { |
| return bundle.getString(key); |
| } catch (MissingResourceException e) { |
| return key; |
| } |
| } |
| |
| /** |
| * Returns the plugin's resource bundle, |
| */ |
| public ResourceBundle getResourceBundle() { |
| return resourceBundle; |
| } |
| } |