Fix some findbugs
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / TmfUiPlugin.java
CommitLineData
b0d3496e
ASL
1/*******************************************************************************
2 * Copyright (c) 2009 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
d34665f9 13package org.eclipse.linuxtools.internal.tmf.ui;
b0d3496e 14
73005152
BH
15import org.eclipse.jface.resource.ImageDescriptor;
16import org.eclipse.jface.resource.ImageRegistry;
12c155f5 17import org.eclipse.linuxtools.tmf.ui.project.model.TmfTraceElement;
abfad0aa 18import org.eclipse.swt.graphics.Image;
b0d3496e
ASL
19import org.eclipse.ui.plugin.AbstractUIPlugin;
20import org.osgi.framework.BundleContext;
21
22/**
23 * <b><u>TmfUiPlugin</u></b>
24 * <p>
12c155f5 25 * The activator class controls the plug-in life cycle.
b0d3496e
ASL
26 */
27public class TmfUiPlugin extends AbstractUIPlugin {
28
12c155f5 29 // ------------------------------------------------------------------------
b0d3496e 30 // Attributes
12c155f5 31 // ------------------------------------------------------------------------
b0d3496e
ASL
32
33 // The plug-in ID
3b38ea61 34 public static final String PLUGIN_ID = "org.eclipse.linuxtools.tmf.ui"; //$NON-NLS-1$
b0d3496e
ASL
35
36 // The shared instance
37 private static TmfUiPlugin plugin;
38
12c155f5 39 // ------------------------------------------------------------------------
b0d3496e 40 // Constructors
12c155f5 41 // ------------------------------------------------------------------------
b0d3496e 42
b0d3496e
ASL
43 public TmfUiPlugin() {
44 }
45
12c155f5 46 // ------------------------------------------------------------------------
b0d3496e 47 // Accessors
12c155f5 48 // ------------------------------------------------------------------------
b0d3496e 49
b0d3496e
ASL
50 public static TmfUiPlugin getDefault() {
51 return plugin;
52 }
53
12c155f5
FC
54 // ------------------------------------------------------------------------
55 // AbstractUIPlugin
56 // ------------------------------------------------------------------------
b0d3496e 57
62d1696a 58 @Override
b0d3496e
ASL
59 public void start(BundleContext context) throws Exception {
60 super.start(context);
61 plugin = this;
73005152 62 TmfUiTracer.init();
12c155f5 63 TmfTraceElement.init();
b0d3496e
ASL
64 }
65
62d1696a 66 @Override
b0d3496e 67 public void stop(BundleContext context) throws Exception {
73005152 68 TmfUiTracer.stop();
b0d3496e
ASL
69 plugin = null;
70 super.stop(context);
71 }
72
12c155f5
FC
73 // ------------------------------------------------------------------------
74 // Operations
75 // ------------------------------------------------------------------------
76
73005152
BH
77 public Image getImageFromPath(String path){
78 return getImageDescripterFromPath(path).createImage();
79 }
80
81 public ImageDescriptor getImageDescripterFromPath(String path){
82 return AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, path);
83 }
84
85 public Image getImageFromImageRegistry(String path) {
86 Image icon = getImageRegistry().get(path);
87 if (icon == null) {
88 icon = getImageDescripterFromPath(path).createImage();
89 plugin.getImageRegistry().put(path, icon);
90 }
91 return icon;
abfad0aa
FC
92 }
93
73005152
BH
94 /*
95 * (non-Javadoc)
96 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
97 */
98 @Override
99 protected void initializeImageRegistry(ImageRegistry reg) {
100 reg.put(ITmfImageConstants.IMG_UI_ZOOM, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM));
101 reg.put(ITmfImageConstants.IMG_UI_ZOOM_IN, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM_IN));
102 reg.put(ITmfImageConstants.IMG_UI_ZOOM_OUT, getImageFromPath(ITmfImageConstants.IMG_UI_ZOOM_OUT));
103 reg.put(ITmfImageConstants.IMG_UI_SEQ_DIAGRAM_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_SEQ_DIAGRAM_OBJ));
104 reg.put(ITmfImageConstants.IMG_UI_ARROW_COLLAPSE_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_COLLAPSE_OBJ));
105 reg.put(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ, getImageFromPath(ITmfImageConstants.IMG_UI_ARROW_UP_OBJ));
106 }
107
108
b0d3496e 109}
This page took 0.040928 seconds and 5 git commands to generate.