ctf: Introduce new empty tmf.ctf.ui plugin
[deliverable/tracecompass.git] / ctf / org.eclipse.tracecompass.tmf.ctf.ui / src / org / eclipse / tracecompass / internal / tmf / ctf / ui / Activator.java
1 /*******************************************************************************
2 * Copyright (c) 2016 EfficiOS Inc. and others
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
10 package org.eclipse.tracecompass.internal.tmf.ctf.ui;
11
12 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
13
14 import org.eclipse.core.runtime.IStatus;
15 import org.eclipse.core.runtime.Status;
16 import org.eclipse.jdt.annotation.Nullable;
17 import org.eclipse.ui.plugin.AbstractUIPlugin;
18 import org.osgi.framework.BundleContext;
19
20 /**
21 * The activator class controls the plug-in life cycle.
22 */
23 public class Activator extends AbstractUIPlugin {
24
25 // ------------------------------------------------------------------------
26 // Attributes
27 // ------------------------------------------------------------------------
28
29 /** The plug-in ID */
30 public static final String PLUGIN_ID = "org.eclipse.tracecompass.tmf.ctf.ui"; //$NON-NLS-1$
31
32 private static @Nullable Activator plugin;
33
34 // ------------------------------------------------------------------------
35 // Accessors
36 // ------------------------------------------------------------------------
37
38 /**
39 * Returns the TMF UI plug-in instance.
40 *
41 * @return the TMF UI plug-in instance.
42 */
43 public static Activator getDefault() {
44 return checkNotNull(plugin);
45 }
46
47 // ------------------------------------------------------------------------
48 // AbstractUIPlugin
49 // ------------------------------------------------------------------------
50
51 @Override
52 public void start(@Nullable BundleContext context) throws Exception {
53 super.start(context);
54 plugin = this;
55 }
56
57 @Override
58 public void stop(@Nullable BundleContext context) throws Exception {
59 plugin = null;
60 super.stop(context);
61 }
62
63
64 // ------------------------------------------------------------------------
65 // Operations
66 // ------------------------------------------------------------------------
67
68 /**
69 * Logs a message with severity INFO in the runtime log of the plug-in.
70 *
71 * @param message
72 * A message to log
73 */
74 public void logInfo(String message) {
75 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
76 }
77
78 /**
79 * Logs a message and exception with severity INFO in the runtime log of the
80 * plug-in.
81 *
82 * @param message
83 * A message to log
84 * @param exception
85 * A exception to log
86 */
87 public void logInfo(String message, Throwable exception) {
88 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
89 }
90
91 /**
92 * Logs a message and exception with severity WARNING in the runtime log of
93 * the plug-in.
94 *
95 * @param message
96 * A message to log
97 */
98 public void logWarning(String message) {
99 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
100 }
101
102 /**
103 * Logs a message and exception with severity WARNING in the runtime log of
104 * the plug-in.
105 *
106 * @param message
107 * A message to log
108 * @param exception
109 * A exception to log
110 */
111 public void logWarning(String message, Throwable exception) {
112 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
113 }
114
115 /**
116 * Logs a message and exception with severity ERROR in the runtime log of
117 * the plug-in.
118 *
119 * @param message
120 * A message to log
121 */
122 public void logError(String message) {
123 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
124 }
125
126 /**
127 * Logs a message and exception with severity ERROR in the runtime log of
128 * the plug-in.
129 *
130 * @param message
131 * A message to log
132 * @param exception
133 * A exception to log
134 */
135 public void logError(String message, Throwable exception) {
136 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
137 }
138 }
This page took 0.033191 seconds and 5 git commands to generate.