srcanaapps/depexplorer/com.nokia.s60tools.appdep/src/com/nokia/s60tools/appdep/resources/ImageResourceManager.java
changeset 0 a02c979e8dfd
equal deleted inserted replaced
-1:000000000000 0:a02c979e8dfd
       
     1 /*
       
     2 * Copyright (c) 2006 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  
       
    19 package com.nokia.s60tools.appdep.resources;
       
    20 
       
    21 import org.eclipse.jface.resource.ImageDescriptor;
       
    22 import org.eclipse.jface.resource.ImageRegistry;
       
    23 import org.eclipse.swt.graphics.Image;
       
    24 import org.eclipse.swt.widgets.Display;
       
    25 
       
    26 import com.nokia.s60tools.appdep.plugin.AppDepPlugin;
       
    27 
       
    28 /**
       
    29  * Manages image resources for the tool.
       
    30  */
       
    31 public class ImageResourceManager {
       
    32 
       
    33 	public static void loadImages(String imagesPath){
       
    34 		
       
    35     	Display disp = Display.getCurrent();
       
    36     	
       
    37     	ImageRegistry imgReg = AppDepPlugin.getDefault().getImageRegistry();
       
    38     	
       
    39     	//
       
    40     	// Storing images to image registry.
       
    41     	//
       
    42     	Image img = new Image( disp, imagesPath + "\\appdep.png" );        	 //$NON-NLS-1$
       
    43         imgReg.put( ImageKeys.IMG_APP_ICON, img );
       
    44 
       
    45         img = new Image( disp, imagesPath + "\\select_sdk_action.png" );        	 //$NON-NLS-1$
       
    46         imgReg.put( ImageKeys.SELECT_SDK, img );
       
    47         
       
    48     	img = new Image( disp, imagesPath + "\\appdep_wizard_banner.png" );        	 //$NON-NLS-1$
       
    49         imgReg.put( ImageKeys.WIZARD_BANNER, img );
       
    50 
       
    51     	img = new Image( disp, imagesPath + "\\cached_target.png" );        	 //$NON-NLS-1$
       
    52         imgReg.put( ImageKeys.CACHED_TARGET, img );
       
    53 
       
    54     	img = new Image( disp, imagesPath + "\\non_cached_target.png" );        	 //$NON-NLS-1$
       
    55         imgReg.put( ImageKeys.NON_CACHED_TARGET, img );
       
    56 
       
    57     	img = new Image( disp, imagesPath + "\\not_supported_target.png" );        	 //$NON-NLS-1$
       
    58         imgReg.put( ImageKeys.NOT_SUPPORTED_TARGET, img );
       
    59         
       
    60     	img = new Image( disp, imagesPath + "\\cache_warning.png" );        	 //$NON-NLS-1$
       
    61         imgReg.put( ImageKeys.CACHE_WARNING, img );
       
    62 
       
    63     	img = new Image( disp, imagesPath + "\\cache_update.png" );        	 //$NON-NLS-1$
       
    64         imgReg.put( ImageKeys.CACHE_UPDATE_ACTION, img );
       
    65         
       
    66     	img = new Image( disp, imagesPath + "\\find.png" );        	 //$NON-NLS-1$
       
    67         imgReg.put( ImageKeys.FIND_ACTION, img );
       
    68        
       
    69     	img = new Image( disp, imagesPath + "\\folder_obj.png" );        	 //$NON-NLS-1$
       
    70         imgReg.put( ImageKeys.FOLDER_OBJ, img );
       
    71         
       
    72         /*******************************************************************************
       
    73          * The following pieces of the graphic are taken from from Eclipse 3.1 platform 
       
    74          * and CDT project in Eclipse community, which are made available under 
       
    75          * the terms of the Eclipse Public License v1.0.
       
    76          * A copy of the EPL is provided at http://www.eclipse.org/legal/epl-v10.html
       
    77          * 
       
    78          * Note that Eclipse 3.1.2 installation was enhanced with CDT 3.0 plug-ins 
       
    79          * and many graphics actually comes from CDT.
       
    80          * 
       
    81          *******************************************************************************/
       
    82         
       
    83         // Original location of the graphic:
       
    84         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\bin_obj.gif
       
    85     	img = new Image( disp, imagesPath + "\\bin_obj.png" );        	 //$NON-NLS-1$
       
    86         imgReg.put( ImageKeys.BIN_OBJ, img );              
       
    87         
       
    88         // Original location of the graphic:
       
    89         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\function_obj.gif
       
    90     	img = new Image( disp, imagesPath + "\\function_obj.png" );        	 //$NON-NLS-1$
       
    91         imgReg.put( ImageKeys.FUNCTION_OBJ, img );
       
    92         
       
    93         // Original location of the graphic:
       
    94         // eclipse3.1.2\plugins\org.eclipse.help.webapp_3.1.0\advanced\images\plus.gif
       
    95     	img = new Image( disp, imagesPath + "\\expand_subtree.png" );        	 //$NON-NLS-1$
       
    96         imgReg.put( ImageKeys.EXPAND_SUBTREE, img );
       
    97 
       
    98         // Original location of the graphic:
       
    99         // eclipse3.1.2\plugins\org.eclipse.cdt.debug.ui_3.0.2\icons\elcl16\collapseall.gif
       
   100     	img = new Image( disp, imagesPath + "\\collapse_all.png" );        	 //$NON-NLS-1$
       
   101         imgReg.put( ImageKeys.COLLAPSE_ALL_ACTION, img );
       
   102         
       
   103         /*******************************************************************************
       
   104          * The following pieces of the graphic are modified from the graphic taken from Eclipse 3.1 
       
   105          * platform and CDT project in Eclipse community, which are made available under 
       
   106          * the terms of the Eclipse Public License v1.0.
       
   107          * A copy of the EPL is provided at http://www.eclipse.org/legal/epl-v10.html
       
   108          *
       
   109          * Original location of the graphic (unless otherwise mentioned):
       
   110          * eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\bin_obj.gif
       
   111          *  
       
   112          * Note that Eclipse 3.1.2 installation was enhanced with CDT 3.0 plug-ins 
       
   113          * and many graphics actually comes from CDT.
       
   114          * 
       
   115          *******************************************************************************/
       
   116     	img = new Image( disp, imagesPath + "\\bin_obj_error.png" );        	 //$NON-NLS-1$
       
   117         imgReg.put( ImageKeys.BIN_OBJ_ERROR, img );
       
   118 	
       
   119     	img = new Image( disp, imagesPath + "\\bin_obj_link.png" );        	 //$NON-NLS-1$
       
   120         imgReg.put( ImageKeys.BIN_OBJ_LINK, img );
       
   121 	
       
   122     	img = new Image( disp, imagesPath + "\\bin_obj_warning.png" );        	 //$NON-NLS-1$
       
   123         imgReg.put( ImageKeys.BIN_OBJ_WARNING, img );
       
   124 
       
   125     	img = new Image( disp, imagesPath + "\\bin_obj_bind.png" );        	 //$NON-NLS-1$
       
   126         imgReg.put( ImageKeys.BIN_OBJ_BIND, img );          
       
   127         
       
   128     	img = new Image( disp, imagesPath + "\\new_root_action.png" );        	 //$NON-NLS-1$
       
   129         imgReg.put( ImageKeys.NEW_ROOT_ACTION, img );
       
   130 	
       
   131     	img = new Image( disp, imagesPath + "\\root_obj.png" );        	 //$NON-NLS-1$
       
   132         imgReg.put( ImageKeys.ROOT_OBJ, img );
       
   133         
       
   134     	img = new Image( disp, imagesPath + "\\is_used_by_action.png" );        	 //$NON-NLS-1$
       
   135         imgReg.put( ImageKeys.IS_USED_BY_ACTION, img );	        
       
   136         
       
   137     	img = new Image( disp, imagesPath + "\\root_obj_error.png" );        	 //$NON-NLS-1$
       
   138         imgReg.put( ImageKeys.ROOT_OBJ_ERROR, img );
       
   139 	
       
   140     	img = new Image( disp, imagesPath + "\\expand_all.png" );        	 //$NON-NLS-1$
       
   141         imgReg.put( ImageKeys.EXPAND_ALL_ACTION, img );
       
   142 
       
   143         img = new Image( disp, imagesPath + "\\search.png" );        	 //$NON-NLS-1$
       
   144         imgReg.put( ImageKeys.SEARCH, img );          
       
   145         
       
   146         //The image is modified based on following original graphic:
       
   147         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\function_obj.gif
       
   148     	img = new Image( disp, imagesPath + "\\virtual_func_obj.png" );        	 //$NON-NLS-1$
       
   149         imgReg.put( ImageKeys.VIRTUAL_FUNCTION_OBJ, img );
       
   150         
       
   151         //The image is modified based on following original graphic:
       
   152         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\function_obj.gif
       
   153     	img = new Image( disp, imagesPath + "\\traffic_light_green_obj.png" );        	 //$NON-NLS-1$
       
   154         imgReg.put( ImageKeys.TRAFFIC_LIGHT_GREEN_OBJ, img );
       
   155         
       
   156         //The image is modified based on following original graphic:
       
   157         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\function_obj.gif
       
   158     	img = new Image( disp, imagesPath + "\\traffic_light_yellow_obj.png" );        	 //$NON-NLS-1$
       
   159         imgReg.put( ImageKeys.TRAFFIC_LIGHT_YELLOW_OBJ, img );
       
   160         
       
   161         //The image is modified based on following original graphic:
       
   162         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\obj16\function_obj.gif
       
   163     	img = new Image( disp, imagesPath + "\\traffic_light_red_obj.png" );        	 //$NON-NLS-1$
       
   164         imgReg.put( ImageKeys.TRAFFIC_LIGHT_RED_OBJ, img );
       
   165         
       
   166         //The image is modified based on following original graphic:
       
   167         // eclipse3.1.2\plugins\org.eclipse.cdt.ui_3.0.2.5\icons\ovr16\error_co.gif
       
   168     	img = new Image( disp, imagesPath + "\\folder_obj_err.png" );        	 //$NON-NLS-1$
       
   169         imgReg.put( ImageKeys.FOLDER_OBJ_ERR, img );
       
   170 	}
       
   171 	
       
   172 	/**
       
   173 	 * Gets image descriptor for the given key.
       
   174 	 * @param key Image key.
       
   175 	 * @return image descriptor for the given key
       
   176 	 */
       
   177 	public static ImageDescriptor getImageDescriptor( String key ){
       
   178     	ImageRegistry imgReg = AppDepPlugin.getDefault().getImageRegistry();
       
   179     	return  imgReg.getDescriptor( key );		
       
   180 	}	
       
   181 
       
   182 	/**
       
   183 	 * Gets image for the given key.
       
   184 	 * @param key Image key.
       
   185 	 * @return image for the given key
       
   186 	 */
       
   187 	public static Image getImage( String key ){
       
   188     	ImageRegistry imgReg = AppDepPlugin.getDefault().getImageRegistry();
       
   189     	return  imgReg.get(key);		
       
   190 	}	
       
   191 }