remotecontrol/com.nokia.s60tools.remotecontrol/src/com/nokia/s60tools/remotecontrol/resources/ImageResourceManager.java
author dpodwall
Tue, 12 Jan 2010 13:17:53 -0600
changeset 0 61163b28edca
permissions -rw-r--r--
initial EPL conversion
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     1
/*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     2
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). 
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     3
* All rights reserved.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     4
* This component and the accompanying materials are made available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     5
* under the terms of "Eclipse Public License v1.0"
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     6
* which accompanies this distribution, and is available
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     8
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
     9
* Initial Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    11
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    12
* Contributors:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    13
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    14
* Description:
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    15
*
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    16
*/
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    17
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    18
package com.nokia.s60tools.remotecontrol.resources;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    19
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    20
import java.io.File;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    21
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    22
import org.eclipse.jface.resource.ImageDescriptor;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    23
import org.eclipse.jface.resource.ImageRegistry;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    24
import org.eclipse.swt.graphics.Image;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    25
import org.eclipse.swt.widgets.Display;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    26
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    27
import com.nokia.s60tools.remotecontrol.RemoteControlActivator;
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    28
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    29
/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    30
 * This class manages images that are used in Remote Control project.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    31
 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    32
public class ImageResourceManager {
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    33
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    34
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    35
	 * Loads images to image registry.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    36
	 * @param imagesPath Path of image directory.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    37
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    38
	public static void loadImages(String imagesPath){
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    39
		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    40
    	Display disp = Display.getCurrent();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    41
    	ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    42
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    43
    	//
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    44
    	// Storing images to image registry.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    45
    	//
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    46
    	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    47
    	Image img = new Image( disp, imagesPath + File.separator + "s60tools_action_icon.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    48
        imgReg.put( ImageKeys.S60TOOLS_ACTION_ICON, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    49
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    50
    	// Remote Control specific images
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    51
    	img = new Image( disp, imagesPath + File.separator + "remote_control.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    52
        imgReg.put( ImageKeys.IMG_APP_ICON, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    53
    	        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    54
    	img = new Image( disp, imagesPath + File.separator + "screen_capture.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    55
        imgReg.put( ImageKeys.IMG_SCREEN_CAPTURE_MODE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    56
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    57
    	img = new Image( disp, imagesPath + File.separator + "file_transfer.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    58
        imgReg.put( ImageKeys.IMG_FILE_TRANSFER_MODE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    59
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    60
    	img = new Image( disp, imagesPath + File.separator + "preferences.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    61
        imgReg.put( ImageKeys.IMG_PREFERENCES, img );        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    62
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    63
    	img = new Image( disp, imagesPath + File.separator + "save_screenshot.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    64
        imgReg.put( ImageKeys.IMG_SAVE_SCREENSHOT, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    65
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    66
        img = new Image( disp, imagesPath + File.separator + "download.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    67
        imgReg.put( ImageKeys.IMG_DOWNLOAD, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    68
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    69
        img = new Image( disp, imagesPath + File.separator + "upload.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    70
        imgReg.put( ImageKeys.IMG_UPLOAD, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    71
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    72
        img = new Image( disp, imagesPath + File.separator + "new_folder.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    73
        imgReg.put( ImageKeys.IMG_NEW_FOLDER, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    74
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    75
        img = new Image( disp, imagesPath + File.separator + "disc_drive.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    76
        imgReg.put( ImageKeys.IMG_DISC_DRIVE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    77
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    78
        img = new Image( disp, imagesPath + File.separator + "disc_drive_dimmed.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    79
        imgReg.put( ImageKeys.IMG_DISC_DRIVE_DIMMED, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    80
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    81
        img = new Image( disp, imagesPath + File.separator + "folder.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    82
        imgReg.put( ImageKeys.IMG_FOLDER, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    83
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    84
    	img = new Image( disp, imagesPath + File.separator + "screenshots_start_taking.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    85
        imgReg.put( ImageKeys.IMG_START_MULTI_SCREENSHOT, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    86
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    87
    	img = new Image( disp, imagesPath + File.separator + "screenshots_stop_taking.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    88
        imgReg.put( ImageKeys.IMG_STOP_MULTI_SCREENSHOT, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    89
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    90
    	img = new Image( disp, imagesPath + File.separator + "go_to_directory.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    91
        imgReg.put( ImageKeys.IMG_GO_TO_DIRECTORY, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    92
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    93
    	img = new Image( disp, imagesPath + File.separator + "refresh.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    94
        imgReg.put( ImageKeys.IMG_REFRESH, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    95
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    96
    	img = new Image( disp, imagesPath + File.separator + "download_as.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    97
        imgReg.put( ImageKeys.IMG_DOWNLOAD_AS, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    98
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
    99
    	img = new Image( disp, imagesPath + File.separator + "download_and_open.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   100
        imgReg.put( ImageKeys.IMG_DOWNLOAD_AND_OPEN, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   101
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   102
    	img = new Image( disp, imagesPath + File.separator + "disc_drive_external_drives.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   103
        imgReg.put( ImageKeys.IMG_EXTERNAL_DRIVE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   104
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   105
    	img = new Image( disp, imagesPath + File.separator + "disc_drive_other_types.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   106
        imgReg.put( ImageKeys.IMG_UNKNOWN_DRIVE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   107
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   108
    	img = new Image( disp, imagesPath + File.separator + "keyboard_view.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   109
        imgReg.put( ImageKeys.IMG_KEYBOARD_VIEW, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   110
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   111
    	img = new Image( disp, imagesPath + File.separator + "keyboard_switch_layout.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   112
        imgReg.put( ImageKeys.IMG_SWITCH_KEYBOARD_MODE, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   113
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   114
    	img = new Image( disp, imagesPath + File.separator + "navigation_keys_icon.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   115
        imgReg.put( ImageKeys.IMG_NAVI_KEYS, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   116
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   117
    	img = new Image( disp, imagesPath + File.separator + "navigation_key_up.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   118
        imgReg.put( ImageKeys.IMG_NAVI_UP, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   119
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   120
    	img = new Image( disp, imagesPath + File.separator + "navigation_key_down.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   121
        imgReg.put( ImageKeys.IMG_NAVI_DOWN, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   122
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   123
    	img = new Image( disp, imagesPath + File.separator + "navigation_key_left.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   124
        imgReg.put( ImageKeys.IMG_NAVI_LEFT, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   125
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   126
    	img = new Image( disp, imagesPath + File.separator + "navigation_key_right.png" ); //$NON-NLS-1$
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   127
        imgReg.put( ImageKeys.IMG_NAVI_RIGHT, img );
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   128
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   129
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   130
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   131
        
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   132
	}
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   133
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   134
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   135
	 * Gets image descriptor for given key from plugin's image registry.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   136
	 * @param key Key for image.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   137
	 * @return ImageDescriptor for given image key.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   138
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   139
	public static ImageDescriptor getImageDescriptor( String key ){
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   140
    	ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   141
    	return  imgReg.getDescriptor( key );		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   142
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   143
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   144
	/**
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   145
	 * Gets image for given key from plugin's image registry.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   146
	 * @param key Key for image.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   147
	 * @return Image for given key.
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   148
	 */
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   149
	public static Image getImage( String key ){
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   150
    	ImageRegistry imgReg = RemoteControlActivator.getDefault().getImageRegistry();
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   151
    	return  imgReg.get(key);		
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   152
	}	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   153
	
61163b28edca initial EPL conversion
dpodwall
parents:
diff changeset
   154
}