Copyright header update, 2015 edition
[deliverable/tracecompass.git] / org.eclipse.tracecompass.gdbtrace.core / src / org / eclipse / tracecompass / internal / gdbtrace / core / Activator.java
CommitLineData
a94410d9 1/*******************************************************************************
ed902a2b 2 * Copyright (c) 2013, 2014 Ericsson
a94410d9
MK
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 * Matthew Khouzam - Initial API and implementation
11 *******************************************************************************/
12
04c0d7d3 13package org.eclipse.tracecompass.internal.gdbtrace.core;
a94410d9
MK
14
15import org.eclipse.core.runtime.IStatus;
16import org.eclipse.core.runtime.Plugin;
17import org.eclipse.core.runtime.Status;
18
19/**
20 * The activator class controls the plug-in life cycle. No more than one such
21 * plug-in can exist at any time.
22 * <p>
23 * It also provides the plug-in's general logging facility and manages the
24 * internal tracer.
25 */
26public class Activator extends Plugin {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 /**
33 * The plug-in ID
34 */
35 public static final String PLUGIN_ID = "org.eclipse.linuxtools.gdbtrace.core"; //$NON-NLS-1$
36
37 /**
38 * The shared instance
39 */
40 private static Activator fPlugin;
41
42 // ------------------------------------------------------------------------
43 // Constructors
44 // ------------------------------------------------------------------------
45
46 /**
47 * Constructor
48 */
49 public Activator() {
50 setDefault(this);
51 }
52
53 // ------------------------------------------------------------------------
54 // Accessors
55 // ------------------------------------------------------------------------
56
57 /**
58 * Returns the TMF Core plug-in instance.
59 *
60 * @return the TMF Core plug-in instance.
61 */
62 public static Activator getDefault() {
63 return fPlugin;
64 }
65
66 // Sets plug-in instance
67 private static void setDefault(Activator plugin) {
68 fPlugin = plugin;
69 }
70
71 // ------------------------------------------------------------------------
72 // Log INFO
73 // ------------------------------------------------------------------------
74
75 /**
76 * Logs a message with severity INFO in the runtime log of the plug-in.
77 *
78 * @param message A message to log
79 */
80 public static void logInfo(String message) {
81 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
82 }
83
84 /**
85 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
86 *
87 * @param message A message to log
88 * @param exception The corresponding exception
89 */
90 public static void logInfo(String message, Throwable exception) {
91 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
92 }
93
94 // ------------------------------------------------------------------------
95 // Log WARNING
96 // ------------------------------------------------------------------------
97
98 /**
99 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
100 *
101 * @param message A message to log
102 */
103 public static void logWarning(String message) {
104 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
105 }
106
107 /**
108 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
109 *
110 * @param message A message to log
111 * @param exception The corresponding exception
112 */
113 public static void logWarning(String message, Throwable exception) {
114 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
115 }
116
117 // ------------------------------------------------------------------------
118 // Log ERROR
119 // ------------------------------------------------------------------------
120
121 /**
122 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
123 *
124 * @param message A message to log
125 */
126 public static void logError(String message) {
127 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
128 }
129
130 /**
131 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
132 *
133 * @param message A message to log
134 * @param exception The corresponding exception
135 */
136 public static void logError(String message, Throwable exception) {
137 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
138 }
139
140}
This page took 0.044616 seconds and 5 git commands to generate.