KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jface > internal > JFaceActivator


1 /*******************************************************************************
2  * Copyright (c) 2007 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.jface.internal;
12
13 import org.osgi.framework.*;
14
15 /**
16  * JFaceActivator is the activator class for the JFace plug-in when it is being used
17  * within a full Eclipse install.
18  * @since 3.3
19  *
20  */

21 public class JFaceActivator implements BundleActivator {
22
23     private static BundleContext bundleContext;
24
25     /* (non-Javadoc)
26      * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
27      */

28     public void start(BundleContext context) throws Exception JavaDoc {
29         bundleContext = context;
30     }
31
32     /* (non-Javadoc)
33      * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext)
34      */

35     public void stop(BundleContext context) throws Exception JavaDoc {
36         bundleContext = null;
37     }
38
39     /**
40      * Return the bundle context for this bundle, or <code>null</code> if
41      * there is not one. (for instance if the bundle is not activated or we aren't
42      * running OSGi.
43      *
44      * @return the bundle context or <code>null</code>
45      */

46     public static BundleContext getBundleContext() {
47         return bundleContext;
48     }
49
50     /**
51      * Return the Bundle object for JFace. Returns <code>null</code> if it is not
52      * available.
53      *
54      * @return the bundle or <code>null</code>
55      */

56     public static Bundle getBundle() {
57         return bundleContext == null ? null : bundleContext.getBundle();
58     }
59
60 }
61
Popular Tags