Add copyright header.
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / TmfCorePlugin.java
1 /*******************************************************************************
2 * Copyright (c) 2009, 2010, 2011 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.linuxtools.internal.tmf.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.osgi.framework.BundleContext;
19
20 /**
21 * <b><u>TmfCorePlugin</u></b>
22 * <p>
23 * The activator class controls the plug-in life cycle. No more than one such
24 * plug-in can exist at any time.
25 */
26 public class TmfCorePlugin 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.tmf.core"; //$NON-NLS-1$
36
37 /**
38 * The shared instance
39 */
40 private static TmfCorePlugin fPlugin;
41
42 // ------------------------------------------------------------------------
43 // Constructors
44 // ------------------------------------------------------------------------
45
46 /**
47 * Constructor
48 */
49 public TmfCorePlugin() {
50 setDefault(this);
51 }
52
53 // ------------------------------------------------------------------------
54 // Accessors
55 // ------------------------------------------------------------------------
56
57 /**
58 * Returns the TMF UI plug-in instance.
59 *
60 * @return the TMF UI plug-in instance.
61 */
62 public static TmfCorePlugin getDefault() {
63 return fPlugin;
64 }
65
66 // Sets plug-in instance
67 private static void setDefault(TmfCorePlugin plugin) {
68 fPlugin = plugin;
69 }
70
71 // ------------------------------------------------------------------------
72 // Plugin
73 // ------------------------------------------------------------------------
74
75 /*
76 * (non-Javadoc)
77 * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
78 */
79 @Override
80 public void start(BundleContext context) throws Exception {
81 super.start(context);
82 setDefault(this);
83 Tracer.init();
84 }
85
86 /*
87 * (non-Javadoc)
88 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
89 */
90 @Override
91 public void stop(BundleContext context) throws Exception {
92 Tracer.stop();
93 setDefault(null);
94 super.stop(context);
95 }
96
97 /**
98 * Logs a message with severity INFO in the runtime log of the plug-in.
99 *
100 * @param message A message to log
101 */
102 public void logInfo(String message) {
103 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
104 }
105
106 /**
107 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
108 *
109 * @param message A message to log
110 * @param exception A exception to log
111 */
112 public void logInfo(String message, Throwable exception) {
113 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
114 }
115
116 /**
117 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
118 *
119 * @param message A message to log
120 */
121 public void logWarning(String message) {
122 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
123 }
124
125 /**
126 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
127 *
128 * @param message A message to log
129 * @param exception A exception to log
130 */
131 public void logWarning(String message, Throwable exception) {
132 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
133 }
134
135 /**
136 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
137 *
138 * @param message A message to log
139 */
140 public void logError(String message) {
141 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
142 }
143
144 /**
145 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
146 *
147 * @param message A message to log
148 * @param exception A exception to log
149 */
150 public void logError(String message, Throwable exception) {
151 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
152 }
153
154 }
This page took 0.049302 seconds and 5 git commands to generate.