Commit | Line | Data |
---|---|---|
866e5b51 FC |
1 | /******************************************************************************* |
2 | * Copyright (c) 2011-2012 Ericsson, Ecole Polytechnique de Montreal and others | |
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 | * Francois Chouinard - Initial API and implementation | |
11 | *******************************************************************************/ | |
12 | ||
13 | package org.eclipse.linuxtools.ctf.core; | |
14 | ||
15 | import org.eclipse.core.runtime.IStatus; | |
16 | import org.eclipse.core.runtime.Plugin; | |
17 | import org.eclipse.core.runtime.Status; | |
18 | import org.osgi.framework.BundleContext; | |
19 | ||
20 | /** | |
21 | * <b><u>CtfCorePlugin</u></b> | |
22 | * <p> | |
23 | * The activator class controls the plug-in life cycle. No more than one such | |
24 | * plug-in can exist at any time. | |
25 | */ | |
26 | public class CtfCorePlugin extends Plugin { | |
27 | ||
28 | // ------------------------------------------------------------------------ | |
29 | // Attributes | |
30 | // ------------------------------------------------------------------------ | |
31 | ||
32 | // The plug-in ID | |
33 | public static final String PLUGIN_ID = "org.eclipse.linuxtools.ctf"; //$NON-NLS-1$ | |
34 | ||
35 | // The shared instance | |
36 | private static CtfCorePlugin fPlugin; | |
37 | ||
38 | // ------------------------------------------------------------------------ | |
39 | // Constructors | |
40 | // ------------------------------------------------------------------------ | |
41 | ||
42 | public CtfCorePlugin() { | |
43 | setDefault(this); | |
44 | } | |
45 | ||
46 | // ------------------------------------------------------------------------ | |
47 | // Accessors | |
48 | // ------------------------------------------------------------------------ | |
49 | ||
50 | public static CtfCorePlugin getDefault() { | |
51 | return fPlugin; | |
52 | } | |
53 | ||
54 | private static void setDefault(CtfCorePlugin plugin) { | |
55 | fPlugin = plugin; | |
56 | } | |
57 | ||
58 | // ------------------------------------------------------------------------ | |
59 | // Plugin | |
60 | // ------------------------------------------------------------------------ | |
61 | ||
62 | @Override | |
63 | public void start(BundleContext context) throws Exception { | |
64 | super.start(context); | |
65 | setDefault(this); | |
66 | } | |
67 | ||
68 | @Override | |
69 | public void stop(BundleContext context) throws Exception { | |
70 | setDefault(null); | |
71 | super.stop(context); | |
72 | } | |
73 | ||
74 | // ------------------------------------------------------------------------ | |
75 | // Logging | |
76 | // ------------------------------------------------------------------------ | |
77 | ||
78 | public void log(String msg) { | |
79 | log(msg, null); | |
80 | } | |
81 | ||
82 | public void log(String msg, Exception e) { | |
83 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e)); | |
84 | } | |
85 | ||
86 | } |