xref: /AOO41X/test/testassistant/src/org/openoffice/test/assistant/Activator.java (revision e6e6073ddaad3a04a985e8f05823629a884eb203)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * 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 
22 
23 
24 package org.openoffice.test.assistant;
25 
26 import org.eclipse.jface.resource.ImageDescriptor;
27 import org.eclipse.ui.plugin.AbstractUIPlugin;
28 import org.osgi.framework.BundleContext;
29 
30 /**
31  * The activator class controls the plug-in life cycle
32  */
33 public class Activator extends AbstractUIPlugin {
34 
35     // The plug-in ID
36     public static final String PLUGIN_ID = "org.openoffice.test.assistant"; //$NON-NLS-1$
37 
38     // The shared instance
39     private static Activator plugin;
40 
41     /**
42      * The constructor
43      */
Activator()44     public Activator() {
45     }
46 
47     /*
48      * (non-Javadoc)
49      * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
50      */
start(BundleContext context)51     public void start(BundleContext context) throws Exception {
52         super.start(context);
53         plugin = this;
54     }
55 
56     /*
57      * (non-Javadoc)
58      * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
59      */
stop(BundleContext context)60     public void stop(BundleContext context) throws Exception {
61         plugin = null;
62         super.stop(context);
63     }
64 
65     /**
66      * Returns the shared instance
67      *
68      * @return the shared instance
69      */
getDefault()70     public static Activator getDefault() {
71         return plugin;
72     }
73 
74     /**
75      * Returns an image descriptor for the image file at the given
76      * plug-in relative path
77      *
78      * @param path the path
79      * @return the image descriptor
80      */
getImageDescriptor(String path)81     public static ImageDescriptor getImageDescriptor(String path) {
82         return imageDescriptorFromPlugin(PLUGIN_ID, path);
83     }
84 }
85