8629784bc45043ed70a24186b3bba39728260da9
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.core / src / org / eclipse / linuxtools / internal / lttng2 / kernel / core / Activator.java
1 /*******************************************************************************
2 * Copyright (c) 2012, 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.lttng2.kernel.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.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpEventMatching;
19 import org.eclipse.linuxtools.lttng2.kernel.core.event.matching.TcpLttngEventMatching;
20 import org.eclipse.linuxtools.tmf.core.event.matching.TmfEventMatching;
21 import org.osgi.framework.BundleContext;
22
23 /**
24 * <b><u>Activator</u></b>
25 * <p>
26 * The activator class controls the plug-in life cycle
27 */
28 public class Activator extends Plugin {
29
30 // ------------------------------------------------------------------------
31 // Attributes
32 // ------------------------------------------------------------------------
33
34 /**
35 * The plug-in ID
36 */
37 public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng2.core"; //$NON-NLS-1$
38
39 /**
40 * The shared instance
41 */
42 private static Activator plugin;
43
44 // ------------------------------------------------------------------------
45 // Constructors
46 // ------------------------------------------------------------------------
47
48 /**
49 * The constructor
50 */
51 public Activator() {
52 }
53
54 // ------------------------------------------------------------------------
55 // Accessors
56 // ------------------------------------------------------------------------
57
58 /**
59 * Returns the shared instance
60 *
61 * @return the shared instance
62 */
63 public static Activator getDefault() {
64 return plugin;
65 }
66
67 // ------------------------------------------------------------------------
68 // Operators
69 // ------------------------------------------------------------------------
70
71 @Override
72 public void start(BundleContext context) throws Exception {
73 super.start(context);
74 plugin = this;
75 TmfEventMatching.registerMatchObject(new TcpEventMatching());
76 TmfEventMatching.registerMatchObject(new TcpLttngEventMatching());
77 }
78
79 @Override
80 public void stop(BundleContext context) throws Exception {
81 plugin = null;
82 super.stop(context);
83 }
84
85 /**
86 * Logs a message with severity INFO in the runtime log of the plug-in.
87 *
88 * @param message A message to log
89 */
90 public void logInfo(String message) {
91 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
92 }
93
94 /**
95 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
96 *
97 * @param message A message to log
98 * @param exception A exception to log
99 */
100 public void logInfo(String message, Throwable exception) {
101 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
102 }
103
104 /**
105 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
106 *
107 * @param message A message to log
108 */
109 public void logWarning(String message) {
110 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
111 }
112
113 /**
114 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
115 *
116 * @param message A message to log
117 * @param exception A exception to log
118 */
119 public void logWarning(String message, Throwable exception) {
120 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
121 }
122
123 /**
124 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
125 *
126 * @param message A message to log
127 */
128 public void logError(String message) {
129 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
130 }
131
132 /**
133 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
134 *
135 * @param message A message to log
136 * @param exception A exception to log
137 */
138 public void logError(String message, Throwable exception) {
139 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
140 }
141
142 }
This page took 0.041368 seconds and 4 git commands to generate.