1 /*******************************************************************************
2 * Copyright (c) 2012, 2014 Ericsson
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
10 * Francois Chouinard - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.internal
.lttng2
.kernel
.ui
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
16 import org
.eclipse
.core
.runtime
.Status
;
17 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
18 import org
.eclipse
.jface
.resource
.ImageRegistry
;
19 import org
.eclipse
.swt
.graphics
.Image
;
20 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
21 import org
.osgi
.framework
.BundleContext
;
24 * The activator class controls the plug-in life cycle
26 public class Activator
extends AbstractUIPlugin
{
28 // ------------------------------------------------------------------------
30 // ------------------------------------------------------------------------
35 public static final String PLUGIN_ID
= "org.eclipse.linuxtools.lttng2.kernel.ui"; //$NON-NLS-1$
40 private static Activator plugin
;
42 // ------------------------------------------------------------------------
44 // ------------------------------------------------------------------------
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
57 * Returns the shared instance
59 * @return the shared instance
61 public static Activator
getDefault() {
65 // ------------------------------------------------------------------------
67 // ------------------------------------------------------------------------
70 public void start(BundleContext context
) throws Exception
{
76 public void stop(BundleContext context
) throws Exception
{
82 protected void initializeImageRegistry(ImageRegistry reg
) {
85 // ------------------------------------------------------------------------
87 // ------------------------------------------------------------------------
90 * Get the image object from a given path
93 * The path to the image file
94 * @return The Image object
96 public Image
getImageFromPath(String path
) {
97 return getImageDescripterFromPath(path
).createImage();
101 * Get the ImageDescriptor from a given path
104 * The path to the image file
105 * @return The ImageDescriptor object
107 public ImageDescriptor
getImageDescripterFromPath(String path
) {
108 return AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, path
);
112 * Get the Image from a registry
115 * The path to the image registry
116 * @return The Image object
118 public Image
getImageFromImageRegistry(String path
) {
119 Image icon
= getImageRegistry().get(path
);
121 icon
= getImageDescripterFromPath(path
).createImage();
122 plugin
.getImageRegistry().put(path
, icon
);
128 * Logs a message with severity INFO in the runtime log of the plug-in.
130 * @param message A message to log
132 public void logInfo(String message
) {
133 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
));
137 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
139 * @param message A message to log
140 * @param exception A exception to log
142 public void logInfo(String message
, Throwable exception
) {
143 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
, exception
));
147 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
149 * @param message A message to log
151 public void logWarning(String message
) {
152 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
));
156 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
158 * @param message A message to log
159 * @param exception A exception to log
161 public void logWarning(String message
, Throwable exception
) {
162 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
, exception
));
166 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
168 * @param message A message to log
170 public void logError(String message
) {
171 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
));
175 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
177 * @param message A message to log
178 * @param exception A exception to log
180 public void logError(String message
, Throwable exception
) {
181 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
, exception
));
This page took 0.035506 seconds and 5 git commands to generate.