1 /*******************************************************************************
2 * Copyright (c) 2015 EfficiOS Inc., Alexandre Montplaisir
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 *******************************************************************************/
10 package org
.eclipse
.tracecompass
.internal
.analysis
.lami
.ui
;
12 import org
.eclipse
.core
.runtime
.IStatus
;
13 import org
.eclipse
.core
.runtime
.Status
;
14 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
15 import org
.eclipse
.jface
.resource
.ImageRegistry
;
16 import org
.eclipse
.swt
.graphics
.Image
;
17 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
18 import org
.osgi
.framework
.BundleContext
;
21 * The activator class controls the plug-in life cycle
23 public class Activator
extends AbstractUIPlugin
{
25 // ------------------------------------------------------------------------
27 // ------------------------------------------------------------------------
32 public static final String PLUGIN_ID
= "org.eclipse.tracecompass.analysis.lami.ui"; //$NON-NLS-1$
37 private static Activator plugin
;
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
49 // ------------------------------------------------------------------------
51 // ------------------------------------------------------------------------
54 * Returns the shared instance
56 * @return the shared instance
58 public static Activator
getDefault() {
62 // ------------------------------------------------------------------------
64 // ------------------------------------------------------------------------
67 public void start(BundleContext context
) throws Exception
{
73 public void stop(BundleContext context
) throws Exception
{
79 protected void initializeImageRegistry(ImageRegistry reg
) {
82 // ------------------------------------------------------------------------
84 // ------------------------------------------------------------------------
87 * Get the image object from a given path
90 * The path to the image file
91 * @return The Image object
93 public Image
getImageFromPath(String path
) {
94 return getImageDescripterFromPath(path
).createImage();
98 * Get the ImageDescriptor from a given path
101 * The path to the image file
102 * @return The ImageDescriptor object
104 public ImageDescriptor
getImageDescripterFromPath(String path
) {
105 return AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, path
);
109 * Get the Image from a registry
112 * The path to the image registry
113 * @return The Image object
115 public Image
getImageFromImageRegistry(String path
) {
116 Image icon
= getImageRegistry().get(path
);
118 icon
= getImageDescripterFromPath(path
).createImage();
119 plugin
.getImageRegistry().put(path
, icon
);
125 * Logs a message with severity INFO in the runtime log of the plug-in.
127 * @param message A message to log
129 public void logInfo(String message
) {
130 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
));
134 * Logs a message and exception with severity INFO in the runtime log of the plug-in.
136 * @param message A message to log
137 * @param exception A exception to log
139 public void logInfo(String message
, Throwable exception
) {
140 getLog().log(new Status(IStatus
.INFO
, PLUGIN_ID
, message
, exception
));
144 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
146 * @param message A message to log
148 public void logWarning(String message
) {
149 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
));
153 * Logs a message and exception with severity WARNING in the runtime log of the plug-in.
155 * @param message A message to log
156 * @param exception A exception to log
158 public void logWarning(String message
, Throwable exception
) {
159 getLog().log(new Status(IStatus
.WARNING
, PLUGIN_ID
, message
, exception
));
163 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
165 * @param message A message to log
167 public void logError(String message
) {
168 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
));
172 * Logs a message and exception with severity ERROR in the runtime log of the plug-in.
174 * @param message A message to log
175 * @param exception A exception to log
177 public void logError(String message
, Throwable exception
) {
178 getLog().log(new Status(IStatus
.ERROR
, PLUGIN_ID
, message
, exception
));
This page took 0.038099 seconds and 6 git commands to generate.