1 /*******************************************************************************
2 * Copyright (c) 2009 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
.tmf
.ui
;
15 import org
.eclipse
.jface
.resource
.ImageDescriptor
;
16 import org
.eclipse
.jface
.resource
.ImageRegistry
;
17 import org
.eclipse
.linuxtools
.tmf
.ui
.parsers
.ParserProviderManager
;
18 import org
.eclipse
.linuxtools
.tmf
.ui
.project
.model
.TmfTraceElement
;
19 import org
.eclipse
.swt
.graphics
.Image
;
20 import org
.eclipse
.ui
.plugin
.AbstractUIPlugin
;
21 import org
.osgi
.framework
.BundleContext
;
24 * <b><u>TmfUiPlugin</u></b>
26 * The activator class controls the plug-in life cycle.
28 public class TmfUiPlugin
extends AbstractUIPlugin
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
35 public static final String PLUGIN_ID
= "org.eclipse.linuxtools.tmf.ui"; //$NON-NLS-1$
37 // The shared instance
38 private static TmfUiPlugin plugin
;
40 // ------------------------------------------------------------------------
42 // ------------------------------------------------------------------------
44 public TmfUiPlugin() {
47 // ------------------------------------------------------------------------
49 // ------------------------------------------------------------------------
51 public static TmfUiPlugin
getDefault() {
55 // ------------------------------------------------------------------------
57 // ------------------------------------------------------------------------
60 public void start(BundleContext context
) throws Exception
{
64 ParserProviderManager
.init();
65 TmfTraceElement
.init();
69 public void stop(BundleContext context
) throws Exception
{
75 // ------------------------------------------------------------------------
77 // ------------------------------------------------------------------------
79 public Image
getImageFromPath(String path
){
80 return getImageDescripterFromPath(path
).createImage();
83 public ImageDescriptor
getImageDescripterFromPath(String path
){
84 return AbstractUIPlugin
.imageDescriptorFromPlugin(PLUGIN_ID
, path
);
87 public Image
getImageFromImageRegistry(String path
) {
88 Image icon
= getImageRegistry().get(path
);
90 icon
= getImageDescripterFromPath(path
).createImage();
91 plugin
.getImageRegistry().put(path
, icon
);
98 * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry)
101 protected void initializeImageRegistry(ImageRegistry reg
) {
102 reg
.put(ITmfImageConstants
.IMG_UI_ZOOM
, getImageFromPath(ITmfImageConstants
.IMG_UI_ZOOM
));
103 reg
.put(ITmfImageConstants
.IMG_UI_ZOOM_IN
, getImageFromPath(ITmfImageConstants
.IMG_UI_ZOOM_IN
));
104 reg
.put(ITmfImageConstants
.IMG_UI_ZOOM_OUT
, getImageFromPath(ITmfImageConstants
.IMG_UI_ZOOM_OUT
));
105 reg
.put(ITmfImageConstants
.IMG_UI_SEQ_DIAGRAM_OBJ
, getImageFromPath(ITmfImageConstants
.IMG_UI_SEQ_DIAGRAM_OBJ
));
106 reg
.put(ITmfImageConstants
.IMG_UI_ARROW_COLLAPSE_OBJ
, getImageFromPath(ITmfImageConstants
.IMG_UI_ARROW_COLLAPSE_OBJ
));
107 reg
.put(ITmfImageConstants
.IMG_UI_ARROW_UP_OBJ
, getImageFromPath(ITmfImageConstants
.IMG_UI_ARROW_UP_OBJ
));