KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > presentations > r21 > R21PresentationPlugin


1 /*******************************************************************************
2  * Copyright (c) 2003, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.presentations.r21;
12
13 import java.util.MissingResourceException JavaDoc;
14 import java.util.ResourceBundle JavaDoc;
15
16 import org.eclipse.ui.plugin.AbstractUIPlugin;
17 import org.osgi.framework.BundleContext;
18
19 /**
20  * The main plugin class to be used in the desktop.
21  */

22 public class R21PresentationPlugin extends AbstractUIPlugin {
23     //The shared instance.
24
private static R21PresentationPlugin plugin;
25
26     //Resource bundle.
27
private ResourceBundle JavaDoc resourceBundle;
28
29     /**
30      * The constructor.
31      */

32     public R21PresentationPlugin() {
33         super();
34         plugin = this;
35         try {
36             resourceBundle = ResourceBundle
37                     .getBundle("org.eclipse.ui.internal.r21presentation.R21lookPluginResources"); //$NON-NLS-1$
38
} catch (MissingResourceException JavaDoc x) {
39             resourceBundle = null;
40         }
41     }
42
43     /**
44      * Returns the shared instance.
45      */

46     public static R21PresentationPlugin getDefault() {
47         return plugin;
48     }
49
50     /**
51      * Returns the string from the plugin's resource bundle,
52      * or 'key' if not found.
53      */

54     public static String JavaDoc getResourceString(String JavaDoc key) {
55         ResourceBundle JavaDoc bundle = R21PresentationPlugin.getDefault()
56                 .getResourceBundle();
57         try {
58             return (bundle != null) ? bundle.getString(key) : key;
59         } catch (MissingResourceException JavaDoc e) {
60             return key;
61         }
62     }
63
64     /**
65      * Returns the plugin's resource bundle,
66      */

67     public ResourceBundle JavaDoc getResourceBundle() {
68         return resourceBundle;
69     }
70
71     /* (non-Javadoc)
72      * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
73      */

74     public void start(BundleContext context) throws Exception JavaDoc {
75         super.start(context);
76         R21Colors.startup();
77     }
78
79     /* (non-Javadoc)
80      * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
81      */

82     public void stop(BundleContext context) throws Exception JavaDoc {
83         super.stop(context);
84         R21Colors.shutdown();
85     }
86 }
87
Popular Tags