Activator.java
01 /*
02  *
03  * Licensed to the Apache Software Foundation (ASF) under one
04  * or more contributor license agreements.  See the NOTICE file
05  * distributed with this work for additional information
06  * regarding copyright ownership.  The ASF licenses this file
07  * to you under the Apache License, Version 2.0 (the
08  * "License"); you may not use this file except in compliance
09  * with the License.  You may obtain a copy of the License at
10  
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  */
21 package org.apache.qpid.management.ui;
22 
23 import org.eclipse.jface.resource.ImageDescriptor;
24 import org.eclipse.ui.plugin.AbstractUIPlugin;
25 import org.osgi.framework.BundleContext;
26 
27 /**
28  * The activator class controls the plug-in life cycle
29  @author Bhupendra Bhardwaj
30  */
31 public class Activator extends AbstractUIPlugin
32 {
33   // The plug-in ID
34   public static final String PLUGIN_ID = "org.apache.qpid.management.ui";
35 
36   // The shared instance
37   private static Activator plugin;
38   
39   /**
40    * The constructor
41    */
42   public Activator()
43     {
44     plugin = this;
45   }
46 
47   /*
48    * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
49    */
50   public void start(BundleContext contextthrows Exception
51     {
52     super.start(context);
53   }
54 
55   /*
56    * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
57    */
58   public void stop(BundleContext contextthrows Exception
59     {
60     plugin = null;
61     super.stop(context);
62   }
63 
64   /**
65    * Returns the shared instance
66    *
67    @return the shared instance
68    */
69   public static Activator getDefault()
70     {
71     return plugin;
72   }
73 
74   /**
75    * Returns an image descriptor for the image file at the given plug-in relative path
76    *
77    @param path the path
78    @return the image descriptor
79    */
80   public static ImageDescriptor getImageDescriptor(String path)
81     {
82     return imageDescriptorFromPlugin(PLUGIN_ID, path);
83   }
84 }