0
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 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 "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.s60tools.remotecontrol.resources;
|
|
19 |
|
|
20 |
import java.io.File;
|
|
21 |
|
|
22 |
import org.eclipse.jface.resource.ImageDescriptor;
|
|
23 |
import org.eclipse.jface.resource.ImageRegistry;
|
|
24 |
import org.eclipse.swt.graphics.Image;
|
|
25 |
import org.eclipse.swt.widgets.Display;
|
|
26 |
|
|
27 |
import com.nokia.s60tools.remotecontrol.RemoteControlActivator;
|
|
28 |
|
|
29 |
/**
|
|
30 |
* This class manages images that are used in Remote Control project.
|
|
31 |
*/
|
|
32 |
public class ImageResourceManager {
|
|
33 |
|
|
34 |
/**
|
|
35 |
* Loads images to image registry.
|
|
36 |
* @param imagesPath Path of image directory.
|
|
37 |
*/
|
|
38 |
public static void loadImages(String imagesPath){
|
|
39 |
|
|
40 |
Display disp = Display.getCurrent();
|
|
41 |
ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
|
|
42 |
|
|
43 |
//
|
|
44 |
// Storing images to image registry.
|
|
45 |
//
|
|
46 |
|
|
47 |
Image img = new Image( disp, imagesPath + File.separator + "s60tools_action_icon.png" ); //$NON-NLS-1$
|
|
48 |
imgReg.put( ImageKeys.S60TOOLS_ACTION_ICON, img );
|
|
49 |
|
|
50 |
// Remote Control specific images
|
|
51 |
img = new Image( disp, imagesPath + File.separator + "remote_control.png" ); //$NON-NLS-1$
|
|
52 |
imgReg.put( ImageKeys.IMG_APP_ICON, img );
|
|
53 |
|
|
54 |
img = new Image( disp, imagesPath + File.separator + "screen_capture.png" ); //$NON-NLS-1$
|
|
55 |
imgReg.put( ImageKeys.IMG_SCREEN_CAPTURE_MODE, img );
|
|
56 |
|
|
57 |
img = new Image( disp, imagesPath + File.separator + "file_transfer.png" ); //$NON-NLS-1$
|
|
58 |
imgReg.put( ImageKeys.IMG_FILE_TRANSFER_MODE, img );
|
|
59 |
|
|
60 |
img = new Image( disp, imagesPath + File.separator + "preferences.png" ); //$NON-NLS-1$
|
|
61 |
imgReg.put( ImageKeys.IMG_PREFERENCES, img );
|
|
62 |
|
|
63 |
img = new Image( disp, imagesPath + File.separator + "save_screenshot.png" ); //$NON-NLS-1$
|
|
64 |
imgReg.put( ImageKeys.IMG_SAVE_SCREENSHOT, img );
|
|
65 |
|
|
66 |
img = new Image( disp, imagesPath + File.separator + "download.png" ); //$NON-NLS-1$
|
|
67 |
imgReg.put( ImageKeys.IMG_DOWNLOAD, img );
|
|
68 |
|
|
69 |
img = new Image( disp, imagesPath + File.separator + "upload.png" ); //$NON-NLS-1$
|
|
70 |
imgReg.put( ImageKeys.IMG_UPLOAD, img );
|
|
71 |
|
|
72 |
img = new Image( disp, imagesPath + File.separator + "new_folder.png" ); //$NON-NLS-1$
|
|
73 |
imgReg.put( ImageKeys.IMG_NEW_FOLDER, img );
|
|
74 |
|
|
75 |
img = new Image( disp, imagesPath + File.separator + "disc_drive.png" ); //$NON-NLS-1$
|
|
76 |
imgReg.put( ImageKeys.IMG_DISC_DRIVE, img );
|
|
77 |
|
|
78 |
img = new Image( disp, imagesPath + File.separator + "disc_drive_dimmed.png" ); //$NON-NLS-1$
|
|
79 |
imgReg.put( ImageKeys.IMG_DISC_DRIVE_DIMMED, img );
|
|
80 |
|
|
81 |
img = new Image( disp, imagesPath + File.separator + "folder.png" ); //$NON-NLS-1$
|
|
82 |
imgReg.put( ImageKeys.IMG_FOLDER, img );
|
|
83 |
|
|
84 |
img = new Image( disp, imagesPath + File.separator + "screenshots_start_taking.png" ); //$NON-NLS-1$
|
|
85 |
imgReg.put( ImageKeys.IMG_START_MULTI_SCREENSHOT, img );
|
|
86 |
|
|
87 |
img = new Image( disp, imagesPath + File.separator + "screenshots_stop_taking.png" ); //$NON-NLS-1$
|
|
88 |
imgReg.put( ImageKeys.IMG_STOP_MULTI_SCREENSHOT, img );
|
|
89 |
|
|
90 |
img = new Image( disp, imagesPath + File.separator + "go_to_directory.png" ); //$NON-NLS-1$
|
|
91 |
imgReg.put( ImageKeys.IMG_GO_TO_DIRECTORY, img );
|
|
92 |
|
|
93 |
img = new Image( disp, imagesPath + File.separator + "refresh.png" ); //$NON-NLS-1$
|
|
94 |
imgReg.put( ImageKeys.IMG_REFRESH, img );
|
|
95 |
|
|
96 |
img = new Image( disp, imagesPath + File.separator + "download_as.png" ); //$NON-NLS-1$
|
|
97 |
imgReg.put( ImageKeys.IMG_DOWNLOAD_AS, img );
|
|
98 |
|
|
99 |
img = new Image( disp, imagesPath + File.separator + "download_and_open.png" ); //$NON-NLS-1$
|
|
100 |
imgReg.put( ImageKeys.IMG_DOWNLOAD_AND_OPEN, img );
|
|
101 |
|
|
102 |
img = new Image( disp, imagesPath + File.separator + "disc_drive_external_drives.png" ); //$NON-NLS-1$
|
|
103 |
imgReg.put( ImageKeys.IMG_EXTERNAL_DRIVE, img );
|
|
104 |
|
|
105 |
img = new Image( disp, imagesPath + File.separator + "disc_drive_other_types.png" ); //$NON-NLS-1$
|
|
106 |
imgReg.put( ImageKeys.IMG_UNKNOWN_DRIVE, img );
|
|
107 |
|
|
108 |
img = new Image( disp, imagesPath + File.separator + "keyboard_view.png" ); //$NON-NLS-1$
|
|
109 |
imgReg.put( ImageKeys.IMG_KEYBOARD_VIEW, img );
|
|
110 |
|
|
111 |
img = new Image( disp, imagesPath + File.separator + "keyboard_switch_layout.png" ); //$NON-NLS-1$
|
|
112 |
imgReg.put( ImageKeys.IMG_SWITCH_KEYBOARD_MODE, img );
|
|
113 |
|
|
114 |
img = new Image( disp, imagesPath + File.separator + "navigation_keys_icon.png" ); //$NON-NLS-1$
|
|
115 |
imgReg.put( ImageKeys.IMG_NAVI_KEYS, img );
|
|
116 |
|
|
117 |
img = new Image( disp, imagesPath + File.separator + "navigation_key_up.png" ); //$NON-NLS-1$
|
|
118 |
imgReg.put( ImageKeys.IMG_NAVI_UP, img );
|
|
119 |
|
|
120 |
img = new Image( disp, imagesPath + File.separator + "navigation_key_down.png" ); //$NON-NLS-1$
|
|
121 |
imgReg.put( ImageKeys.IMG_NAVI_DOWN, img );
|
|
122 |
|
|
123 |
img = new Image( disp, imagesPath + File.separator + "navigation_key_left.png" ); //$NON-NLS-1$
|
|
124 |
imgReg.put( ImageKeys.IMG_NAVI_LEFT, img );
|
|
125 |
|
|
126 |
img = new Image( disp, imagesPath + File.separator + "navigation_key_right.png" ); //$NON-NLS-1$
|
|
127 |
imgReg.put( ImageKeys.IMG_NAVI_RIGHT, img );
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
}
|
|
133 |
|
|
134 |
/**
|
|
135 |
* Gets image descriptor for given key from plugin's image registry.
|
|
136 |
* @param key Key for image.
|
|
137 |
* @return ImageDescriptor for given image key.
|
|
138 |
*/
|
|
139 |
public static ImageDescriptor getImageDescriptor( String key ){
|
|
140 |
ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
|
|
141 |
return imgReg.getDescriptor( key );
|
|
142 |
}
|
|
143 |
|
|
144 |
/**
|
|
145 |
* Gets image for given key from plugin's image registry.
|
|
146 |
* @param key Key for image.
|
|
147 |
* @return Image for given key.
|
|
148 |
*/
|
|
149 |
public static Image getImage( String key ){
|
|
150 |
ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
|
|
151 |
return imgReg.get(key);
|
|
152 |
}
|
|
153 |
|
|
154 |
}
|