1 /*******************************************************************************
2 * Copyright (c) 2012 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
.linuxtools
.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 * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
73 public void start(BundleContext context
) throws Exception
{
79 * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
82 public void stop(BundleContext context
) throws Exception
{
88 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
91 protected void initializeImageRegistry(ImageRegistry reg
) {
94 // ------------------------------------------------------------------------
96 // ------------------------------------------------------------------------
99 * Get the image object from a given path
102 * The path to the image file
103 * @return The Image object
105 public Image
getImageFromPath(String path
) {
106 return getImageDescripterFromPath(path
).createImage();
110 * Get the ImageDescriptor from a given path
113 * The path to the image file
114 * @return The ImageDescriptor object
116 public ImageDescriptor
getImageDescripterFromPath(String path
) {
117 return AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, path
);
121 * Get the Image from a registry
124 * The path to the image registry
125 * @return The Image object
127 public Image
getImageFromImageRegistry(String path
) {
128 Image icon
= getImageRegistry().get(path
);
130 icon
= getImageDescripterFromPath(path
).createImage();
131 plugin
.getImageRegistry().put(path
, icon
);
137 * Logs a message with severity INFO in the runtime log of the plug-in.
139 * @param message A message to log
141 public void logInfo(String message
) {
142 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
));
146 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
148 * @param message A message to log
149 * @param exception A exception to log
151 public void logInfo(String message
, Throwable exception
) {
152 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
, exception
));
156 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
158 * @param message A message to log
160 public void logWarning(String message
) {
161 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
));
165 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
167 * @param message A message to log
168 * @param exception A exception to log
170 public void logWarning(String message
, Throwable exception
) {
171 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
, exception
));
175 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
177 * @param message A message to log
179 public void logError(String message
) {
180 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
));
184 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
186 * @param message A message to log
187 * @param exception A exception to log
189 public void logError(String message
, Throwable exception
) {
190 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
, exception
));
This page took 0.034484 seconds and 5 git commands to generate.