Commit | Line | Data |
---|---|---|
bcec0116 AM |
1 | /******************************************************************************* |
2 | * Copyright (c) 2012, 2013 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.statesystem.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>Activator</u></b> | |
22 | * <p> | |
23 | * The activator class controls the plug-in life cycle | |
24 | */ | |
25 | public final 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.statesystem.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 | @Override | |
69 | public void start(BundleContext context) throws Exception { | |
70 | super.start(context); | |
71 | plugin = this; | |
72 | } | |
73 | ||
74 | @Override | |
75 | public void stop(BundleContext context) throws Exception { | |
76 | plugin = null; | |
77 | super.stop(context); | |
78 | } | |
79 | ||
80 | /** | |
81 | * Logs a message with severity INFO in the runtime log of the plug-in. | |
82 | * | |
83 | * @param message A message to log | |
84 | */ | |
85 | public void logInfo(String message) { | |
86 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message)); | |
87 | } | |
88 | ||
89 | /** | |
90 | * Logs a message and exception with severity INFO in the runtime log of the plug-in. | |
91 | * | |
92 | * @param message A message to log | |
93 | * @param exception A exception to log | |
94 | */ | |
95 | public void logInfo(String message, Throwable exception) { | |
96 | getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception)); | |
97 | } | |
98 | ||
99 | /** | |
100 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
101 | * | |
102 | * @param message A message to log | |
103 | */ | |
104 | public void logWarning(String message) { | |
105 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message)); | |
106 | } | |
107 | ||
108 | /** | |
109 | * Logs a message and exception with severity WARNING in the runtime log of the plug-in. | |
110 | * | |
111 | * @param message A message to log | |
112 | * @param exception A exception to log | |
113 | */ | |
114 | public void logWarning(String message, Throwable exception) { | |
115 | getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception)); | |
116 | } | |
117 | ||
118 | /** | |
119 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
120 | * | |
121 | * @param message A message to log | |
122 | */ | |
123 | public void logError(String message) { | |
124 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message)); | |
125 | } | |
126 | ||
127 | /** | |
128 | * Logs a message and exception with severity ERROR in the runtime log of the plug-in. | |
129 | * | |
130 | * @param message A message to log | |
131 | * @param exception A exception to log | |
132 | */ | |
133 | public void logError(String message, Throwable exception) { | |
134 | getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception)); | |
135 | } | |
136 | ||
137 | } |