Latency: introduce latency density view
[deliverable/tracecompass.git] / analysis / org.eclipse.tracecompass.analysis.timing.ui / src / org / eclipse / tracecompass / internal / analysis / timing / ui / Activator.java
CommitLineData
39c2b938
BH
1/*******************************************************************************
2 * Copyright (c) 2015 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
10package org.eclipse.tracecompass.internal.analysis.timing.ui;
11
12import org.eclipse.core.runtime.IStatus;
13import org.eclipse.core.runtime.Status;
b23cbbfc
MAL
14import org.eclipse.jface.resource.ImageDescriptor;
15import org.eclipse.swt.graphics.Image;
39c2b938
BH
16import org.eclipse.ui.plugin.AbstractUIPlugin;
17import org.osgi.framework.BundleContext;
18
19/**
20 * The activator class controls the plug-in life cycle
21 */
22public class Activator extends AbstractUIPlugin {
23
24 /** The plug-in ID */
25 public static final String PLUGIN_ID = "org.eclipse.tracecompass.analysis.timing.ui"; //$NON-NLS-1$
26
27 // The shared instance
28 private static Activator plugin;
29
30 /**
31 * The constructor
32 */
33 public Activator() {
34 }
35
36 @Override
37 public void start(BundleContext context) throws Exception {
38 super.start(context);
39 plugin = this;
40 }
41
42 @Override
43 public void stop(BundleContext context) throws Exception {
44 plugin = null;
45 super.stop(context);
46 }
47
b23cbbfc
MAL
48 /**
49 * Get the image object from a given path
50 *
51 * @param path
52 * The path to the image file
53 * @return The Image object
54 */
55 public Image getImageFromPath(String path) {
56 return getImageDescripterFromPath(path).createImage();
57 }
58
59 /**
60 * Get the ImageDescriptor from a given path
61 *
62 * @param path
63 * The path to the image file
64 * @return The ImageDescriptor object
65 */
66 public ImageDescriptor getImageDescripterFromPath(String path) {
67 return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
68 }
69
70 /**
71 * Get the Image from a registry
72 *
73 * @param path
74 * The path to the image registry
75 * @return The Image object
76 */
77 public Image getImageFromImageRegistry(String path) {
78 Image icon = getImageRegistry().get(path);
79 if (icon == null) {
80 icon = getImageDescripterFromPath(path).createImage();
81 plugin.getImageRegistry().put(path, icon);
82 }
83 return icon;
84 }
85
39c2b938
BH
86 /**
87 * Returns the shared instance
88 *
89 * @return the shared instance
90 */
91 public static Activator getDefault() {
92 return plugin;
93 }
94
95 // --------------------------------------
96 // Log functions
97 // --------------------------------------
98
99 /**
100 * Logs a message with severity INFO in the runtime log of the plug-in.
101 *
102 * @param message
103 * A message to log
104 */
105 public void logInfo(String message) {
106 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message));
107 }
108
109 /**
110 * Logs a message and exception with severity INFO in the runtime log of the
111 * plug-in.
112 *
113 * @param message
114 * A message to log
115 * @param exception
116 * A exception to log
117 */
118 public void logInfo(String message, Throwable exception) {
119 getLog().log(new Status(IStatus.INFO, PLUGIN_ID, message, exception));
120 }
121
122 /**
123 * Logs a message and exception with severity WARNING in the runtime log of
124 * the plug-in.
125 *
126 * @param message
127 * A message to log
128 */
129 public void logWarning(String message) {
130 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message));
131 }
132
133 /**
134 * Logs a message and exception with severity WARNING in the runtime log of
135 * the plug-in.
136 *
137 * @param message
138 * A message to log
139 * @param exception
140 * A exception to log
141 */
142 public void logWarning(String message, Throwable exception) {
143 getLog().log(new Status(IStatus.WARNING, PLUGIN_ID, message, exception));
144 }
145
146 /**
147 * Logs a message and exception with severity ERROR in the runtime log of
148 * the plug-in.
149 *
150 * @param message
151 * A message to log
152 */
153 public void logError(String message) {
154 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message));
155 }
156
157 /**
158 * Logs a message and exception with severity ERROR in the runtime log of
159 * the plug-in.
160 *
161 * @param message
162 * A message to log
163 * @param exception
164 * A exception to log
165 */
166 public void logError(String message, Throwable exception) {
167 getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, exception));
168 }
169
170}
This page took 0.031949 seconds and 5 git commands to generate.