private boolean newImage ( String name , String filename ) { ImageDescriptor id ; boolean success ; try { URL fileURL = FileLocator . find ( bundle , new Path ( RESOURCE_DIR + filename ) , null ) ; id = ImageDescriptor . createFromURL ( FileLocator . toFileURL ( fileURL ) ) ; success = true ; } catch ( Exception e ) { e . printStackTrace ( ) ; id = ImageDescriptor . getMissingImageDescriptor ( ) ; // id = getSharedByName(ISharedImages.IMG_OBJS_ERROR_TSK); success = false ; } descMap . put ( name , id ) ; imageMap . put ( name , id . createImage ( true ) ) ; return success ; }
Load and register a new image . If the image resource does not exist or fails to load a default error resource is supplied .