Bug 227645 - Resource change events during compound resource change
Summary: Resource change events during compound resource change
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.4 RC4   Edit
Assignee: Szymon Brandys CLA
QA Contact:
URL:
Whiteboard:
Keywords: Documentation
Depends on:
Blocks:
 
Reported: 2008-04-17 16:15 EDT by Igor Fedorenko CLA
Modified: 2008-06-13 09:31 EDT (History)
2 users (show)

See Also:


Attachments
example that demonstrates the problem (3.68 KB, application/octet-stream)
2008-04-17 16:15 EDT, Igor Fedorenko CLA
no flags Details
Proposed fix v01 (1.26 KB, patch)
2008-06-03 11:47 EDT, Szymon Brandys CLA
no flags Details | Diff
Proposed fix v01 + updated copyright (1.67 KB, patch)
2008-06-03 11:49 EDT, Szymon Brandys CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Fedorenko CLA 2008-04-17 16:15:01 EDT
Created attachment 96500 [details]
example that demonstrates the problem

According to WorkspaceJob documentation, resource change listeners will not receive event(s) about changes performed by the job until after the job has finished. Apparently, this is not true if another workspace job running concurrently happens to finish while this job is running. I am attaching small example that demonstrates the problem shortly.

Tested with Eclipse 3.3.1.1 and 3.4.0 I20080409-1425
Comment 1 John Arthorne CLA 2008-04-18 16:23:08 EDT
This should just be a doc clarification. WorkspaceJob does have the effect of batching events, but it doesn't guarantee that there will never be events during its execution.
Comment 2 Igor Fedorenko CLA 2008-04-18 16:30:08 EDT
Just to clarify, listeners receive events about changes done by this job before the job has finished. In other words, instead of receiving one big batch for all changes performed by the job, listeners receive events in several smaller batches.  Is this really intended?
Comment 3 John Arthorne CLA 2008-04-18 16:42:29 EDT
Yes, this is really intended. Imagine for example one WorkspaceJob is running a build that may take several minutes.  Another thread adds a breakpoint. If we don't fire a resource change event for the breakpoint, then the UI won't notice and the breakpoint icon will not appear in the editor. You would double-click to add the breakpoint, and five minutes later the build would complete and the icon would appear.  You could imagine sending only the changes that occurred in the other thread (the breakpoint creation), and holding back the changes from the build, but this would result in listeners receiving events out of order, which can be quite problematic for clients.


See also:

http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/porting/3.0/incompatibilities.html#Intermediate%20notifications%20during%20workspace%20operations

http://www.eclipse.org/articles/Article-Resource-deltas/resource-deltas.html (section "When events are sent").
Comment 4 Szymon Brandys CLA 2008-06-03 11:47:34 EDT
Created attachment 103347 [details]
Proposed fix v01
Comment 5 Szymon Brandys CLA 2008-06-03 11:49:16 EDT
Created attachment 103350 [details]
Proposed fix v01 + updated copyright
Comment 6 Szymon Brandys CLA 2008-06-03 11:52:32 EDT
Updated javadoc released to HEAD.
Comment 7 Tomasz Zarna CLA 2008-06-13 09:31:36 EDT
Verified in I20080612-2000.