tmf: CtfTmfEvent improvements
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.core / src / org / eclipse / linuxtools / internal / tmf / core / Activator.java
CommitLineData
8c8bf09f 1/*******************************************************************************
12c155f5 2 * Copyright (c) 2009, 2010, 2011 Ericsson
8c8bf09f
ASL
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
4918b8f2 13package org.eclipse.linuxtools.internal.tmf.core;
8c8bf09f 14
9fa32496 15import org.eclipse.core.runtime.IStatus;
e1ab8984 16import org.eclipse.core.runtime.Plugin;
9fa32496 17import org.eclipse.core.runtime.Status;
cbd4ad82 18import org.osgi.framework.BundleContext;
8c8bf09f
ASL
19
20/**
21 * <b><u>TmfCorePlugin</u></b>
22 * <p>
cbd4ad82
FC
23 * The activator class controls the plug-in life cycle. No more than one such
24 * plug-in can exist at any time.
8c8bf09f 25 */
8fd82db5 26public class Activator extends Plugin {
8c8bf09f 27
e31e01e8 28 // ------------------------------------------------------------------------
8c8bf09f 29 // Attributes
e31e01e8 30 // ------------------------------------------------------------------------
8c8bf09f 31
9fa32496
BH
32 /**
33 * The plug-in ID
34 */
5179fc01 35 public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.core"; //$NON-NLS-1$
8c8bf09f 36
9fa32496
BH
37 /**
38 * The shared instance
39 */
8fd82db5 40 private static Activator fPlugin;
8c8bf09f 41
e31e01e8 42 // ------------------------------------------------------------------------
8c8bf09f 43 // Constructors
e31e01e8 44 // ------------------------------------------------------------------------
8c8bf09f 45
9fa32496
BH
46 /**
47 * Constructor
48 */
8fd82db5 49 public Activator() {
cbd4ad82 50 setDefault(this);
8c8bf09f
ASL
51 }
52
e31e01e8 53 // ------------------------------------------------------------------------
8c8bf09f 54 // Accessors
e31e01e8 55 // ------------------------------------------------------------------------
8c8bf09f 56
9fa32496
BH
57 /**
58 * Returns the TMF UI plug-in instance.
59 *
60 * @return the TMF UI plug-in instance.
61 */
8fd82db5 62 public static Activator getDefault() {
cbd4ad82 63 return fPlugin;
8c8bf09f
ASL
64 }
65
9fa32496 66 // Sets plug-in instance
8fd82db5 67 private static void setDefault(Activator plugin) {
cbd4ad82
FC
68 fPlugin = plugin;
69 }
70
71 // ------------------------------------------------------------------------
12c155f5 72 // Plugin
cbd4ad82
FC
73 // ------------------------------------------------------------------------
74
9fa32496
BH
75 /*
76 * (non-Javadoc)
77 * @see org.eclipse.core.runtime.Plugin#start(org.osgi.framework.BundleContext)
78 */
cbd4ad82
FC
79 @Override
80 public void start(BundleContext context) throws Exception {
81 super.start(context);
82 setDefault(this);
36548af3 83 Tracer.init();
cbd4ad82
FC
84 }
85
9fa32496
BH
86 /*
87 * (non-Javadoc)
88 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
89 */
cbd4ad82
FC
90 @Override
91 public void stop(BundleContext context) throws Exception {
9b635e61 92 Tracer.stop();
cbd4ad82
FC
93 setDefault(null);
94 super.stop(context);
95 }
96
9fa32496
BH
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
8c8bf09f 154}
This page took 0.046157 seconds and 5 git commands to generate.