Commit | Line | Data |
---|---|---|
5d10d135 ASL |
1 | /******************************************************************************* |
2 | * Copyright (c) 2009 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 | ||
5945cec9 | 13 | package org.eclipse.linuxtools.internal.lttng.core; |
5d10d135 | 14 | |
9fa32496 | 15 | import org.eclipse.core.runtime.IStatus; |
5d10d135 | 16 | import org.eclipse.core.runtime.Plugin; |
9fa32496 | 17 | import org.eclipse.core.runtime.Status; |
5d10d135 ASL |
18 | import org.osgi.framework.BundleContext; |
19 | ||
20 | /** | |
5945cec9 | 21 | * <b><u>Activator</u></b> |
5d10d135 ASL |
22 | * <p> |
23 | * The activator class controls the plug-in life cycle | |
24 | */ | |
5945cec9 | 25 | public class Activator extends Plugin { |
5d10d135 ASL |
26 | |
27 | // ======================================================================== | |
28 | // Attributes | |
29 | // ======================================================================== | |
30 | ||
31 | // The plug-in ID | |
5179fc01 | 32 | public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng.core"; //$NON-NLS-1$ |
5d10d135 ASL |
33 | |
34 | // The shared instance | |
5945cec9 | 35 | private static Activator plugin; |
5d10d135 ASL |
36 | |
37 | // ======================================================================== | |
38 | // Constructors | |
39 | // ======================================================================== | |
40 | ||
41 | /** | |
42 | * The constructor | |
43 | */ | |
5945cec9 | 44 | public Activator() { |
5d10d135 ASL |
45 | } |
46 | ||
47 | // ======================================================================== | |
48 | // Accessors | |
49 | // ======================================================================== | |
50 | ||
51 | /** | |
52 | * Returns the shared instance | |
53 | * | |
54 | * @return the shared instance | |
55 | */ | |
5945cec9 | 56 | public static Activator getDefault() { |
5d10d135 ASL |
57 | return plugin; |
58 | } | |
59 | ||
60 | // ======================================================================== | |
61 | // Operators | |
62 | // ======================================================================== | |
63 | ||
64 | /* | |
65 | * (non-Javadoc) | |
66 | * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext) | |
67 | */ | |
68 | @Override | |
69 | public void start(BundleContext context) throws Exception { | |
70 | super.start(context); | |
71 | plugin = this; | |
8827c197 | 72 | LttngFactory.init(); |
5d10d135 ASL |
73 | } |
74 | ||
75 | /* | |
76 | * (non-Javadoc) | |
77 | * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext) | |
78 | */ | |
79 | @Override | |
80 | public void stop(BundleContext context) throws Exception { | |
81 | plugin = null; | |
82 | super.stop(context); | |
83 | } | |
9fa32496 BH |
84 | |
85 | /** | |
86 | * Logs a message with severity INFO in the runtime log of the plug-in. | |
87 | * | |
88 | * @param message A message to log | |
89 | */ | |
90 | public void logInfo(String message) { | |
91 | 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 plug-in. | |
96 | * | |
97 | * @param message A message to log | |
98 | * @param exception A exception to log | |
99 | */ | |
100 | public void logInfo(String message, Throwable exception) { | |
101 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception)); | |
102 | } | |
103 | ||
104 | /** | |
105 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
106 | * | |
107 | * @param message A message to log | |
108 | */ | |
109 | public void logWarning(String message) { | |
110 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message)); | |
111 | } | |
112 | ||
113 | /** | |
114 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
115 | * | |
116 | * @param message A message to log | |
117 | * @param exception A exception to log | |
118 | */ | |
119 | public void logWarning(String message, Throwable exception) { | |
120 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception)); | |
121 | } | |
122 | ||
123 | /** | |
124 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
125 | * | |
126 | * @param message A message to log | |
127 | */ | |
128 | public void logError(String message) { | |
129 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message)); | |
130 | } | |
131 | ||
132 | /** | |
133 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
134 | * | |
135 | * @param message A message to log | |
136 | * @param exception A exception to log | |
137 | */ | |
138 | public void logError(String message, Throwable exception) { | |
139 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception)); | |
140 | } | |
5d10d135 ASL |
141 | |
142 | } |