analysis: Move plugins to their own sub-directory
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.os.linux.core / src / org / eclipse / tracecompass / internal / analysis / os / linux / core / Activator.java
1 /*******************************************************************************
2 * Copyright (c) 2015 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 * Alexandre Montplaisir - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.tracecompass.internal.analysis.os.linux.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.eclipse.jdt.annotation.Nullable;
19 import org.osgi.framework.BundleContext;
20
21 /**
22 * <b><u>Activator</u></b>
23 * <p>
24 * The activator class controls the plug-in life cycle
25 */
26 public class Activator extends Plugin {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 /**
33 * The plug-in ID
34 */
35 public static final String PLUGIN_ID = "org.eclipse.tracecompass.analysis.linux.core"; //$NON-NLS-1$
36
37 /**
38 * The shared instance
39 */
40 private static @Nullable Activator fPlugin;
41
42 // ------------------------------------------------------------------------
43 // Constructors
44 // ------------------------------------------------------------------------
45
46 /**
47 * The constructor
48 */
49 public Activator() {
50 }
51
52 // ------------------------------------------------------------------------
53 // Accessors
54 // ------------------------------------------------------------------------
55
56 /**
57 * Returns the shared instance
58 *
59 * @return the shared instance
60 */
61 public static Activator getDefault() {
62 Activator plugin = fPlugin;
63 if (plugin == null) {
64 throw new IllegalStateException();
65 }
66 return plugin;
67 }
68
69 // ------------------------------------------------------------------------
70 // Operators
71 // ------------------------------------------------------------------------
72
73 @Override
74 public void start(@Nullable BundleContext context) throws Exception {
75 super.start(context);
76 fPlugin = this;
77 }
78
79 @Override
80 public void stop(@Nullable BundleContext context) throws Exception {
81 fPlugin = null;
82 super.stop(context);
83 }
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 }
141
142 }
This page took 0.035221 seconds and 5 git commands to generate.