1
package org.eclipse.linuxtools.internal.threadprofiler;
3
import java.io.IOException;
6
import org.eclipse.core.runtime.FileLocator;
7
import org.eclipse.core.runtime.Path;
8
import org.eclipse.jface.resource.ImageDescriptor;
9
import org.eclipse.ui.plugin.AbstractUIPlugin;
10
import org.osgi.framework.Bundle;
11
import org.osgi.framework.BundleContext;
14
* The activator class controls the plug-in life cycle
16
public class ThreadProfilerPlugin extends AbstractUIPlugin {
19
public static final String PLUGIN_ID = "org.eclipse.linuxtools.threadprofiler";
21
// The shared instance
22
private static ThreadProfilerPlugin plugin;
27
public ThreadProfilerPlugin() {
32
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
34
public void start(BundleContext context) throws Exception {
41
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
43
public void stop(BundleContext context) throws Exception {
49
* Returns the shared instance
51
* @return the shared instance
53
public static ThreadProfilerPlugin getDefault() {
58
* Returns the location of the plugin by checking the path of the bundle's
63
public String getPluginLocation() {
64
Bundle bundle = getBundle();
66
URL locationUrl = FileLocator.find(bundle,new Path("/"), null); //$NON-NLS-1$
69
fileUrl = FileLocator.toFileURL(locationUrl);
70
} catch (IOException e) {
73
return fileUrl.getFile();
77
* Returns an image descriptor for the image file at the given
78
* plug-in relative path
80
* @param path the path
81
* @return the image descriptor
83
public static ImageDescriptor getImageDescriptor(String path) {
84
return imageDescriptorFromPlugin(PLUGIN_ID, path);