Commit | Line | Data |
---|---|---|
9c0ffa34 BH |
1 | /********************************************************************** |
2 | * Copyright (c) 2013 Ericsson | |
3 | * | |
4 | * All rights reserved. This program and the accompanying materials are | |
5 | * made available under the terms of the Eclipse Public License v1.0 which | |
6 | * accompanies this distribution, and is available at | |
7 | * http://www.eclipse.org/legal/epl-v10.html | |
8 | * | |
9 | * Contributors: | |
10 | * Bernd Hufmann - Initial API and implementation | |
11 | **********************************************************************/ | |
12 | package org.eclipse.linuxtools.internal.tracing.rcp.ui; | |
13 | ||
14 | import org.eclipse.jface.resource.ImageDescriptor; | |
15 | import org.eclipse.ui.plugin.AbstractUIPlugin; | |
16 | import org.osgi.framework.BundleContext; | |
17 | ||
18 | /** | |
19 | * The activator class controls the plug-in life cycle. | |
20 | * | |
21 | * @author Bernd Hufmann | |
22 | */ | |
23 | public class TracingRcpPlugin extends AbstractUIPlugin { | |
24 | ||
25 | // ------------------------------------------------------------------------ | |
26 | // Constants | |
27 | // ------------------------------------------------------------------------ | |
28 | /** | |
29 | * The plug-in ID | |
30 | */ | |
31 | public static final String PLUGIN_ID = "org.eclipse.linuxtools.tracing.rcp.ui"; //$NON-NLS-1$ | |
32 | ||
33 | // ------------------------------------------------------------------------ | |
34 | // Attributes | |
35 | // ------------------------------------------------------------------------ | |
36 | ||
37 | // The shared instance | |
38 | private static TracingRcpPlugin fPlugin; | |
39 | ||
40 | // ------------------------------------------------------------------------ | |
41 | // Constructor(s) | |
42 | // ------------------------------------------------------------------------ | |
43 | /** | |
44 | * The default constructor | |
45 | */ | |
46 | public TracingRcpPlugin() { | |
47 | } | |
48 | ||
49 | // ------------------------------------------------------------------------ | |
50 | // Accessors | |
51 | // ------------------------------------------------------------------------ | |
52 | /** | |
53 | * Returns the shared instance | |
54 | * | |
55 | * @return the shared instance | |
56 | */ | |
57 | public static TracingRcpPlugin getDefault() { | |
58 | return fPlugin; | |
59 | } | |
60 | ||
61 | // ------------------------------------------------------------------------ | |
62 | // Operation | |
63 | // ------------------------------------------------------------------------ | |
64 | @Override | |
65 | public void start(BundleContext context) throws Exception { | |
66 | super.start(context); | |
67 | fPlugin = this; | |
68 | } | |
69 | ||
70 | @Override | |
71 | public void stop(BundleContext context) throws Exception { | |
72 | fPlugin = null; | |
73 | super.stop(context); | |
74 | } | |
75 | ||
76 | /** | |
77 | * Returns an image descriptor for the image file at the given | |
78 | * plug-in relative path | |
79 | * | |
80 | * @param path the path | |
81 | * @return the image descriptor | |
82 | */ | |
83 | public static ImageDescriptor getImageDescriptor(String path) { | |
84 | return imageDescriptorFromPlugin(PLUGIN_ID, path); | |
85 | } | |
86 | } |