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