lttng: Quick fix for the lttng2.kernel.core Javadoc
[deliverable/tracecompass.git] / org.eclipse.linuxtools.lttng2.kernel.ui / src / org / eclipse / linuxtools / internal / lttng2 / kernel / ui / Activator.java
CommitLineData
a7780cc8
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 13package org.eclipse.linuxtools.internal.lttng2.kernel.ui;
a7780cc8 14
9fa32496
BH
15import org.eclipse.core.runtime.IStatus;
16import org.eclipse.core.runtime.Status;
a7780cc8
FC
17import org.eclipse.jface.resource.ImageDescriptor;
18import org.eclipse.jface.resource.ImageRegistry;
19import org.eclipse.swt.graphics.Image;
20import org.eclipse.ui.plugin.AbstractUIPlugin;
21import org.osgi.framework.BundleContext;
22
23/**
24 * The activator class controls the plug-in life cycle
25 */
26public class Activator extends AbstractUIPlugin {
27
28 // ------------------------------------------------------------------------
29 // Attributes
30 // ------------------------------------------------------------------------
31
32 /**
33 * The plug-in ID
34 */
04835162 35 public static final String PLUGIN_ID = "org.eclipse.linuxtools.lttng2.kernel.ui"; //$NON-NLS-1$
a7780cc8
FC
36
37 /**
38 * The shared instance
39 */
40 private static 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 Activator getDefault() {
62 return plugin;
63 }
64
65 // ------------------------------------------------------------------------
66 // AbstractUIPlugin
67 // ------------------------------------------------------------------------
68
69 /* (non-Javadoc)
70 * @see org.eclipse.ui.plugin.AbstractUIPlugin#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 /* (non-Javadoc)
79 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
80 */
81 @Override
82 public void stop(BundleContext context) throws Exception {
83 plugin = null;
84 super.stop(context);
85 }
86
87 /* (non-Javadoc)
88 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
89 */
90 @Override
91 protected void initializeImageRegistry(ImageRegistry reg) {
92 }
93
94 // ------------------------------------------------------------------------
95 // Operations
96 // ------------------------------------------------------------------------
97
98 public Image getImageFromPath(String path) {
99 return getImageDescripterFromPath(path).createImage();
100 }
101
102 public ImageDescriptor getImageDescripterFromPath(String path) {
103 return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
104 }
105
106 public Image getImageFromImageRegistry(String path) {
107 Image icon = getImageRegistry().get(path);
108 if (icon == null) {
109 icon = getImageDescripterFromPath(path).createImage();
110 plugin.getImageRegistry().put(path, icon);
111 }
112 return icon;
113 }
9fa32496
BH
114
115 /**
116 * Logs a message with severity INFO in the runtime log of the plug-in.
117 *
118 * @param message A message to log
119 */
120 public void logInfo(String message) {
121 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
122 }
123
124 /**
125 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
126 *
127 * @param message A message to log
128 * @param exception A exception to log
129 */
130 public void logInfo(String message, Throwable exception) {
131 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
132 }
133
134 /**
135 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
136 *
137 * @param message A message to log
138 */
139 public void logWarning(String message) {
140 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
141 }
142
143 /**
144 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
145 *
146 * @param message A message to log
147 * @param exception A exception to log
148 */
149 public void logWarning(String message, Throwable exception) {
150 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
151 }
152
153 /**
154 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
155 *
156 * @param message A message to log
157 */
158 public void logError(String message) {
159 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
160 }
161
162 /**
163 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
164 *
165 * @param message A message to log
166 * @param exception A exception to log
167 */
168 public void logError(String message, Throwable exception) {
169 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
170 }
a7780cc8
FC
171
172}
This page took 0.032323 seconds and 5 git commands to generate.