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