pcap: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / org.eclipse.tracecompass.gdbtrace.core / src / org / eclipse / tracecompass / internal / gdbtrace / core / GdbTraceCorePlugin.java
CommitLineData
6de2f761 1/*******************************************************************************
c19380ab 2 * Copyright (c) 2011, 2015 Ericsson
6de2f761
PT
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 * Patrick Tasse - Updated for TMF 2.0
c19380ab 12 * Matthew Khouzam - Add logging methods
6de2f761
PT
13 *******************************************************************************/
14
04c0d7d3 15package org.eclipse.tracecompass.internal.gdbtrace.core;
6de2f761 16
c19380ab 17import org.eclipse.core.runtime.IStatus;
6de2f761 18import org.eclipse.core.runtime.Plugin;
c19380ab 19import org.eclipse.core.runtime.Status;
6de2f761
PT
20import org.osgi.framework.BundleContext;
21
22/**
23 * GDB Tracepoint Analysis Core plug-in activator
24 * @author Francois Chouinard
25 */
26public class GdbTraceCorePlugin extends Plugin {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 /** The plug-in ID */
c19380ab 33 public static final String PLUGIN_ID = "org.eclipse.tracecompass.gdbtrace.core"; //$NON-NLS-1$
6de2f761 34
c19380ab 35 private static GdbTraceCorePlugin fPlugin;
6de2f761
PT
36
37 private static BundleContext fBundleContext;
38
39 // ------------------------------------------------------------------------
40 // Constructor
41 // ------------------------------------------------------------------------
42
43 /**
44 * Constructor
45 */
46 public GdbTraceCorePlugin() {
47 }
48
49 // ------------------------------------------------------------------------
50 // Plugin
51 // ------------------------------------------------------------------------
52
53 @Override
54 public void start(BundleContext context) throws Exception {
55 super.start(context);
c19380ab 56 fPlugin = this;
6de2f761
PT
57 fBundleContext = context;
58 }
59
60 @Override
61 public void stop(BundleContext context) throws Exception {
c19380ab 62 fPlugin = null;
6de2f761
PT
63 super.stop(context);
64 }
65
66 // ------------------------------------------------------------------------
67 // Accessor
68 // ------------------------------------------------------------------------
69
70 /**
71 * Returns the GDB Tracepoints Core plug-in instance.
72 *
73 * @return the GDB Tracepoints Core plug-in instance
74 */
75 public static GdbTraceCorePlugin getDefault() {
c19380ab 76 return fPlugin;
6de2f761
PT
77 }
78
79 /**
80 * Returns the bundle context
81 *
82 * @return the bundle context
83 */
84 public static BundleContext getBundleContext() {
85 return fBundleContext;
86 }
87
c19380ab
PT
88 // ------------------------------------------------------------------------
89 // Log INFO
90 // ------------------------------------------------------------------------
91
92 /**
93 * Logs a message with severity INFO in the runtime log of the plug-in.
94 *
95 * @param message A message to log
96 */
97 public static void logInfo(String message) {
98 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
99 }
100
101 /**
102 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
103 *
104 * @param message A message to log
105 * @param exception The corresponding exception
106 */
107 public static void logInfo(String message, Throwable exception) {
108 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
109 }
110
111 // ------------------------------------------------------------------------
112 // Log WARNING
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 */
120 public static void logWarning(String message) {
121 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
122 }
123
124 /**
125 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
126 *
127 * @param message A message to log
128 * @param exception The corresponding exception
129 */
130 public static void logWarning(String message, Throwable exception) {
131 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
132 }
133
134 // ------------------------------------------------------------------------
135 // Log ERROR
136 // ------------------------------------------------------------------------
137
138 /**
139 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
140 *
141 * @param message A message to log
142 */
143 public static void logError(String message) {
144 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
145 }
146
147 /**
148 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
149 *
150 * @param message A message to log
151 * @param exception The corresponding exception
152 */
153 public static void logError(String message, Throwable exception) {
154 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
155 }
156
6de2f761 157}
This page took 0.066437 seconds and 5 git commands to generate.