tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / Activator.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 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 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.tmf.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 * The activator class controls the plug-in life cycle. No more than one such
22 * plug-in can exist at any time.
23 * <p>
24 * It also provides the plug-in's general logging facility and manages the
25 * internal tracer.
26 */
27 public class Activator extends Plugin {
28
29 // ------------------------------------------------------------------------
30 // Attributes
31 // ------------------------------------------------------------------------
32
33 /**
34 * The plug-in ID
35 */
36 public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.core"; //$NON-NLS-1$
37
38 /**
39 * The shared instance
40 */
41 private static Activator fPlugin;
42
43 // ------------------------------------------------------------------------
44 // Constructors
45 // ------------------------------------------------------------------------
46
47 /**
48 * Constructor
49 */
50 public Activator() {
51 setDefault(this);
52 }
53
54 // ------------------------------------------------------------------------
55 // Accessors
56 // ------------------------------------------------------------------------
57
58 /**
59 * Returns the TMF Core plug-in instance.
60 *
61 * @return the TMF Core plug-in instance.
62 */
63 public static Activator getDefault() {
64 return fPlugin;
65 }
66
67 // Sets plug-in instance
68 private static void setDefault(Activator plugin) {
69 fPlugin = plugin;
70 }
71
72 // ------------------------------------------------------------------------
73 // Plugin
74 // ------------------------------------------------------------------------
75
76 @Override
77 public void start(BundleContext context) throws Exception {
78 super.start(context);
79 setDefault(this);
80 TmfCoreTracer.init();
81 }
82
83 @Override
84 public void stop(BundleContext context) throws Exception {
85 TmfCoreTracer.stop();
86 setDefault(null);
87 super.stop(context);
88 }
89
90 // ------------------------------------------------------------------------
91 // Log INFO
92 // ------------------------------------------------------------------------
93
94 /**
95 * Logs a message with severity INFO in the runtime log of the plug-in.
96 *
97 * @param message
98 * A message to log
99 */
100 public static void logInfo(String message) {
101 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
102 }
103
104 /**
105 * Logs a message and exception with severity INFO in the runtime log of the
106 * plug-in.
107 *
108 * @param message
109 * A message to log
110 * @param exception
111 * The corresponding exception
112 */
113 public static void logInfo(String message, Throwable exception) {
114 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
115 }
116
117 // ------------------------------------------------------------------------
118 // Log WARNING
119 // ------------------------------------------------------------------------
120
121 /**
122 * Logs a message and exception with severity WARNING in the runtime log of
123 * the plug-in.
124 *
125 * @param message
126 * A message to log
127 */
128 public static void logWarning(String message) {
129 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
130 }
131
132 /**
133 * Logs a message and exception with severity WARNING in the runtime log of
134 * the plug-in.
135 *
136 * @param message
137 * A message to log
138 * @param exception
139 * The corresponding exception
140 */
141 public static void logWarning(String message, Throwable exception) {
142 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
143 }
144
145 // ------------------------------------------------------------------------
146 // Log ERROR
147 // ------------------------------------------------------------------------
148
149 /**
150 * Logs a message and exception with severity ERROR in the runtime log of
151 * the plug-in.
152 *
153 * @param message
154 * A message to log
155 */
156 public static void logError(String message) {
157 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
158 }
159
160 /**
161 * Logs a message and exception with severity ERROR in the runtime log of
162 * the plug-in.
163 *
164 * @param message
165 * A message to log
166 * @param exception
167 * The corresponding exception
168 */
169 public static void logError(String message, Throwable exception) {
170 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
171 }
172
173 }
This page took 0.034284 seconds and 5 git commands to generate.