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 | ||
a9d52b8f | 13 | package org.eclipse.linuxtools.internal.ctf.core; |
866e5b51 FC |
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 | /** | |
a9d52b8f | 21 | * <b><u>Activator</u></b> |
866e5b51 | 22 | * <p> |
a9d52b8f | 23 | * The activator class controls the plug-in life cycle. |
866e5b51 | 24 | */ |
a9d52b8f | 25 | public class Activator extends Plugin { |
866e5b51 FC |
26 | |
27 | // ------------------------------------------------------------------------ | |
28 | // Attributes | |
29 | // ------------------------------------------------------------------------ | |
30 | ||
31 | // The plug-in ID | |
32 | public static final String PLUGIN_ID = "org.eclipse.linuxtools.ctf"; //$NON-NLS-1$ | |
33 | ||
34 | // The shared instance | |
a9d52b8f | 35 | private static Activator fPlugin; |
866e5b51 FC |
36 | |
37 | // ------------------------------------------------------------------------ | |
38 | // Constructors | |
39 | // ------------------------------------------------------------------------ | |
40 | ||
a9d52b8f | 41 | public Activator() { |
866e5b51 FC |
42 | setDefault(this); |
43 | } | |
44 | ||
45 | // ------------------------------------------------------------------------ | |
46 | // Accessors | |
47 | // ------------------------------------------------------------------------ | |
48 | ||
a9d52b8f | 49 | public static Activator getDefault() { |
866e5b51 FC |
50 | return fPlugin; |
51 | } | |
52 | ||
a9d52b8f | 53 | private static void setDefault(Activator plugin) { |
866e5b51 FC |
54 | fPlugin = plugin; |
55 | } | |
56 | ||
57 | // ------------------------------------------------------------------------ | |
58 | // Plugin | |
59 | // ------------------------------------------------------------------------ | |
60 | ||
61 | @Override | |
62 | public void start(BundleContext context) throws Exception { | |
63 | super.start(context); | |
64 | setDefault(this); | |
65 | } | |
66 | ||
67 | @Override | |
68 | public void stop(BundleContext context) throws Exception { | |
69 | setDefault(null); | |
70 | super.stop(context); | |
71 | } | |
72 | ||
73 | // ------------------------------------------------------------------------ | |
74 | // Logging | |
75 | // ------------------------------------------------------------------------ | |
76 | ||
77 | public void log(String msg) { | |
78 | log(msg, null); | |
79 | } | |
80 | ||
81 | public void log(String msg, Exception e) { | |
82 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, IStatus.OK, msg, e)); | |
83 | } | |
84 | ||
85 | } |