1 /* 2 ** Copyright 2011, The Android Open Source Project 3 ** 4 ** Licensed under the Apache License, Version 2.0 (the "License"); 5 ** you may not use this file except in compliance with the License. 6 ** You may obtain a copy of the License at 7 ** 8 ** http://www.apache.org/licenses/LICENSE-2.0 9 ** 10 ** Unless required by applicable law or agreed to in writing, software 11 ** distributed under the License is distributed on an "AS IS" BASIS, 12 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 ** See the License for the specific language governing permissions and 14 ** limitations under the License. 15 */ 16 17 package com.android.glesv2debugger; 18 19 import org.eclipse.jface.resource.ImageDescriptor; 20 import org.eclipse.ui.plugin.AbstractUIPlugin; 21 import org.osgi.framework.BundleContext; 22 23 /** 24 * The activator class controls the plug-in life cycle 25 */ 26 public class Activator extends AbstractUIPlugin { 27 28 // The plug-in ID 29 public static final String PLUGIN_ID = "GLESv2DebuggerClient"; //$NON-NLS-1$ 30 31 // The shared instance 32 private static Activator plugin; 33 34 /** 35 * The constructor 36 */ Activator()37 public Activator() { 38 } 39 40 /* 41 * (non-Javadoc) 42 * @see 43 * org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext 44 * ) 45 */ 46 @Override start(BundleContext context)47 public void start(BundleContext context) throws Exception { 48 super.start(context); 49 plugin = this; 50 } 51 52 /* 53 * (non-Javadoc) 54 * @see 55 * org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext 56 * ) 57 */ 58 @Override stop(BundleContext context)59 public void stop(BundleContext context) throws Exception { 60 plugin = null; 61 super.stop(context); 62 } 63 64 /** 65 * Returns the shared instance 66 * 67 * @return the shared instance 68 */ getDefault()69 public static Activator getDefault() { 70 return plugin; 71 } 72 73 /** 74 * Returns an image descriptor for the image file at the given plug-in 75 * relative path 76 * 77 * @param path the path 78 * @return the image descriptor 79 */ getImageDescriptor(String path)80 public static ImageDescriptor getImageDescriptor(String path) { 81 return imageDescriptorFromPlugin(PLUGIN_ID, path); 82 } 83 } 84