885adc1726eca6bfca2b3727f9d26cf10f313087
[deliverable/tracecompass.git] / org.eclipse.linuxtools.pcap.core / src / org / eclipse / linuxtools / internal / pcap / core / Activator.java
1 /*******************************************************************************
2 * Copyright (c) 2014 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 * Vincent Perot - Initial API and implementation
11 *******************************************************************************/
12
13 package org.eclipse.linuxtools.internal.pcap.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 final 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.linuxtools.pcap.core"; //$NON-NLS-1$
36
37 /**
38 * The shared instance
39 */
40 private static @Nullable Activator plugin;
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 @Nullable Activator getDefault() {
62 return plugin;
63 }
64
65 // ------------------------------------------------------------------------
66 // Operators
67 // ------------------------------------------------------------------------
68
69 @Override
70 public void start(@Nullable BundleContext context) throws Exception {
71 super.start(context);
72 plugin = this;
73 }
74
75 @Override
76 public void stop(@Nullable BundleContext context) throws Exception {
77 plugin = null;
78 super.stop(context);
79 }
80
81 /**
82 * Logs a message with severity INFO in the runtime log of the plug-in.
83 *
84 * @param message A message to log
85 */
86 public void logInfo(String message) {
87 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
88 }
89
90 /**
91 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
92 *
93 * @param message A message to log
94 * @param exception A exception to log
95 */
96 public void logInfo(String message, Throwable exception) {
97 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
98 }
99
100 /**
101 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
102 *
103 * @param message A message to log
104 */
105 public void logWarning(String message) {
106 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
107 }
108
109 /**
110 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
111 *
112 * @param message A message to log
113 * @param exception A exception to log
114 */
115 public void logWarning(String message, Throwable exception) {
116 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
117 }
118
119 /**
120 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
121 *
122 * @param message A message to log
123 */
124 public void logError(String message) {
125 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
126 }
127
128 /**
129 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
130 *
131 * @param message A message to log
132 * @param exception A exception to log
133 */
134 public void logError(String message, Throwable exception) {
135 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
136 }
137
138 }
This page took 0.044248 seconds and 4 git commands to generate.