Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.analysis.xml.ui / src / org / eclipse / linuxtools / internal / tmf / analysis / xml / ui / Activator.java
CommitLineData
faf37fd0
GB
1/*******************************************************************************
2 * Copyright (c) 2013 École Polytechnique de Montréal
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 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.internal.tmf.analysis.xml.ui;
14
15import org.eclipse.core.runtime.IStatus;
16import org.eclipse.core.runtime.Status;
17import org.eclipse.ui.plugin.AbstractUIPlugin;
18import org.osgi.framework.BundleContext;
19
20/**
21 * The activator class controls the plug-in life cycle
22 *
23 * @author Geneviève Bastien
24 */
25public class Activator extends AbstractUIPlugin {
26
27 /** The plug-in ID */
28 public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.analysis.xml.ui"; //$NON-NLS-1$
29
30 // The shared instance
31 private static Activator fPlugin;
32
33 /**
34 * The constructor
35 */
36 public Activator() {
37 setDefault(this);
38 }
39
40 @Override
41 public void start(BundleContext context) throws Exception {
42 super.start(context);
43 setDefault(this);
44 }
45
46 @Override
47 public void stop(BundleContext context) throws Exception {
48 setDefault(null);
49 super.stop(context);
50 }
51
52 /**
53 * Returns the shared instance
54 *
55 * @return the shared instance
56 */
57 public static Activator getDefault() {
58 return fPlugin;
59 }
60
61 // Sets plug-in instance
62 private static void setDefault(Activator plugin) {
63 fPlugin = plugin;
64 }
65
66 // ------------------------------------------------------------------------
67 // Log an IStatus
68 // ------------------------------------------------------------------------
69
70 /**
71 * Log an IStatus object directly
72 *
73 * @param status
74 * The status to log
75 */
76 public static void log(IStatus status) {
77 fPlugin.getLog().log(status);
78 }
79
80 // ------------------------------------------------------------------------
81 // Log INFO
82 // ------------------------------------------------------------------------
83
84 /**
85 * Logs a message with severity INFO in the runtime log of the plug-in.
86 *
87 * @param message
88 * A message to log
89 */
90 public static void logInfo(String message) {
91 fPlugin.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
96 * plug-in.
97 *
98 * @param message
99 * A message to log
100 * @param exception
101 * The corresponding exception
102 */
103 public static void logInfo(String message, Throwable exception) {
104 fPlugin.getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
105 }
106
107 // ------------------------------------------------------------------------
108 // Log WARNING
109 // ------------------------------------------------------------------------
110
111 /**
112 * Logs a message and exception with severity WARNING in the runtime log of
113 * the plug-in.
114 *
115 * @param message
116 * A message to log
117 */
118 public static void logWarning(String message) {
119 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
120 }
121
122 /**
123 * Logs a message and exception with severity WARNING in the runtime log of
124 * the plug-in.
125 *
126 * @param message
127 * A message to log
128 * @param exception
129 * The corresponding exception
130 */
131 public static void logWarning(String message, Throwable exception) {
132 fPlugin.getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
133 }
134
135 // ------------------------------------------------------------------------
136 // Log ERROR
137 // ------------------------------------------------------------------------
138
139 /**
140 * Logs a message and exception with severity ERROR in the runtime log of
141 * the plug-in.
142 *
143 * @param message
144 * A message to log
145 */
146 public static void logError(String message) {
147 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
148 }
149
150 /**
151 * Logs a message and exception with severity ERROR in the runtime log of
152 * the plug-in.
153 *
154 * @param message
155 * A message to log
156 * @param exception
157 * The corresponding exception
158 */
159 public static void logError(String message, Throwable exception) {
160 fPlugin.getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
161 }
162
163}
This page took 0.071467 seconds and 5 git commands to generate.