|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 package com.nokia.carbide.internal.bugreport.resources; |
|
19 |
|
20 import org.eclipse.jface.resource.ImageDescriptor; |
|
21 import org.eclipse.jface.resource.ImageRegistry; |
|
22 import org.eclipse.jface.resource.JFaceResources; |
|
23 import org.eclipse.swt.graphics.Image; |
|
24 import org.eclipse.swt.widgets.Display; |
|
25 |
|
26 import com.nokia.carbide.internal.bugreport.resources.ImageKeys; |
|
27 |
|
28 /** |
|
29 * Class for handling bug_reporter icons. |
|
30 * |
|
31 */ |
|
32 public class ImageResourceManager { |
|
33 |
|
34 /** |
|
35 * Loads images from given path. |
|
36 * @param imagesPath path where images are found. |
|
37 */ |
|
38 public static void loadImages(String imagesPath){ |
|
39 |
|
40 Display disp = Display.getCurrent(); |
|
41 |
|
42 ImageRegistry imgReg = JFaceResources.getImageRegistry(); |
|
43 |
|
44 Image img = new Image( disp, imagesPath + "\\bug_report_with_banner_75x66.png" ); //$NON-NLS-1$ |
|
45 imgReg.put( ImageKeys.WIZARD_BANNER, img ); |
|
46 } |
|
47 |
|
48 /** |
|
49 * Gets the image descriptor for given key. |
|
50 * @param key |
|
51 * @return imageDescriptor |
|
52 */ |
|
53 public static ImageDescriptor getImageDescriptor( String key ){ |
|
54 ImageRegistry imgReg = JFaceResources.getImageRegistry(); |
|
55 return imgReg.getDescriptor( key ); |
|
56 } |
|
57 |
|
58 /** |
|
59 * Gets the image of the given key. |
|
60 * @param key |
|
61 * @return Image |
|
62 */ |
|
63 public static Image getImage( String key ){ |
|
64 ImageRegistry imgReg = JFaceResources.getImageRegistry(); |
|
65 return imgReg.get(key); |
|
66 } |
|
67 |
|
68 /** |
|
69 * This class is not meant to be instantiated. |
|
70 * |
|
71 */ |
|
72 private ImageResourceManager() { |
|
73 } |
|
74 } |