1 /*******************************************************************************
2 * Copyright (c) 2011, 2015 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 * Patrick Tasse - Updated for TMF 2.0
12 * Matthew Khouzam - Add logging methods
13 *******************************************************************************/
15 package org
.eclipse
.tracecompass
.internal
.gdbtrace
.core
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
18 import org
.eclipse
.core
.runtime
.Plugin
;
19 import org
.eclipse
.core
.runtime
.Status
;
20 import org
.osgi
.framework
.BundleContext
;
23 * GDB Tracepoint Analysis Core plug-in activator
24 * @author Francois Chouinard
26 public class GdbTraceCorePlugin
extends Plugin
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
33 public static final String PLUGIN_ID
= "org.eclipse.tracecompass.gdbtrace.core"; //$NON-NLS-1$
35 private static GdbTraceCorePlugin fPlugin
;
37 private static BundleContext fBundleContext
;
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
46 public GdbTraceCorePlugin() {
49 // ------------------------------------------------------------------------
51 // ------------------------------------------------------------------------
54 public void start(BundleContext context
) throws Exception
{
57 fBundleContext
= context
;
61 public void stop(BundleContext context
) throws Exception
{
66 // ------------------------------------------------------------------------
68 // ------------------------------------------------------------------------
71 * Returns the GDB Tracepoints Core plug-in instance.
73 * @return the GDB Tracepoints Core plug-in instance
75 public static GdbTraceCorePlugin
getDefault() {
80 * Returns the bundle context
82 * @return the bundle context
84 public static BundleContext
getBundleContext() {
85 return fBundleContext
;
88 // ------------------------------------------------------------------------
90 // ------------------------------------------------------------------------
93 * Logs a message with severity INFO in the runtime log of the plug-in.
95 * @param message A message to log
97 public static void logInfo(String message
) {
98 fPlugin
.getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
));
102 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
104 * @param message A message to log
105 * @param exception The corresponding exception
107 public static void logInfo(String message
, Throwable exception
) {
108 fPlugin
.getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
, exception
));
111 // ------------------------------------------------------------------------
113 // ------------------------------------------------------------------------
116 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
118 * @param message A message to log
120 public static void logWarning(String message
) {
121 fPlugin
.getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
));
125 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
127 * @param message A message to log
128 * @param exception The corresponding exception
130 public static void logWarning(String message
, Throwable exception
) {
131 fPlugin
.getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
, exception
));
134 // ------------------------------------------------------------------------
136 // ------------------------------------------------------------------------
139 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
141 * @param message A message to log
143 public static void logError(String message
) {
144 fPlugin
.getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
));
148 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
150 * @param message A message to log
151 * @param exception The corresponding exception
153 public static void logError(String message
, Throwable exception
) {
154 fPlugin
.getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
, exception
));