Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 325121

Summary: provide progress while loading Resource
Product: [Modeling] EMF Reporter: Nicolas Bros <nicolas.bros>
Component: CoreAssignee: Ed Merks <Ed.Merks>
Status: RESOLVED WONTFIX QA Contact:
Severity: enhancement    
Priority: P3 CC: stepper
Version: 2.6.0   
Target Milestone: ---   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 321689    

Description Nicolas Bros CLA 2010-09-13 10:50:48 EDT
Currently, there doesn't seem to be any way to follow the progress while loading a Resource. ResourceSet#getResource is blocking until the Resource is fully loaded.

It would be useful to be able to receive notifications as the Resource is being loaded, for example through some sort of listener or callback mechanism, to be able to display a progress bar.
Comment 1 Ed Merks CLA 2010-09-16 17:04:18 EDT
I'm not sure what kind of useful progress could be reported.  It would certainly need to be up to each individual type of resource do implement such a thing, e.g., XMLResourceImpl... Generally resources load so quickly I'm not sure a human being would derive anything useful from dozens of updates happening in the course of a few seconds.  What would be useful to report and wouldn't be produced in such volumes so as to add significantly to the overall time of loading?
Comment 2 Nicolas Bros CLA 2010-09-17 03:39:49 EDT
Maybe the InputStream (in XMLLoadImpl) could be used (when loading a XMLResourceImpl) to know how many bytes have been read so far. By comparing this to the size of the file, we can get a percentage that can be reported back to the caller through a listener or callback.

To avoid slowing down the loading process by sending too many notifications, we can send only significant changes, for example every 1%, or every megabyte read.
Comment 3 Ed Merks CLA 2012-10-05 01:12:17 EDT
It all sounds complicated and invasive.  Much of the loading is done when proxies are resolved in which case there's little opportunity for displaying progress.