Bug 32044 - Pre auto build notification fired when closing or opening a file
Summary: Pre auto build notification fired when closing or opening a file
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows 2000
: P3 major (vote)
Target Milestone: 2.1 RC1   Edit
Assignee: Philipe Mulet CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-02-17 13:27 EST by Pascal Rapicault CLA
Modified: 2003-02-18 09:11 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Rapicault CLA 2003-02-17 13:27:16 EST
I have a listener registered on java core to listen to pre auto build events.
Whenever a file is opened (I double click on the file in the resource view) or 
closed, my listener is notified that a compilation unit has been added or 
removed. Then the builder is NOT started.

It seems to me that the pre_auto_build event is used when creating or deleting 
a working copy, which seems to be incorrect.

According to the general model of the builders, I would expect the 
pre_auto_build event to only occurs when the builder is run.
Comment 1 Philipe Mulet CLA 2003-02-17 13:35:38 EST
No this is what platform is notifying (we simply convert a resource delta into 
a Java one). Same notification stages.
Comment 2 Pascal Rapicault CLA 2003-02-17 13:47:49 EST
John and I checked, and the platform does send any pre_auto_build event when a 
file is closed or opened.
Comment 3 John Arthorne CLA 2003-02-17 14:00:15 EST
To correct Pascal's comment, the platform does NOT send pre auto build events
when a file is opened or closed.  This seems to be a special working copy delta
that is not based on a resource delta.
Comment 4 Philipe Mulet CLA 2003-02-17 14:42:09 EST
I see. However, this doesn't strike me. Pre-auto-build isn't meant to be 
specifically for builders, just a hook to prepare some forthcoming build 
actions.

Comment 5 Philipe Mulet CLA 2003-02-17 14:58:13 EST
Also, does platform notifies opening/closing a file ? I didn't think it existed.
Working copies are not truly resources, and their deltas are useful for many 
kind of usage.
Comment 6 John Arthorne CLA 2003-02-17 15:56:51 EST
Opening and closing a file does not modify any resources, so the platform does
not fire any kind of event.  I think Pascal's problem is that he receives a pre
"build" notification even in this case, where a build can't possibly happen. 
The name of the event is confusing in this case.
Comment 7 Philipe Mulet CLA 2003-02-17 17:48:34 EST
Got it. Note though that pre/post build notifications also occur when no 
builder is running (autobuild is off). 

Comment 8 Philipe Mulet CLA 2003-02-18 05:18:38 EST
Won't change this behavior as this would be a contract change. The JavaModel 
has a notion of working copies, which platform doesn't. We notify their changes 
along other resource changes, i.e. JavaModel offers more deltas at finer grain.

Comment 9 Philipe Mulet CLA 2003-02-18 05:20:20 EST
Working as per design.
Comment 10 Pascal Rapicault CLA 2003-02-18 08:51:40 EST
I understand that you provide more deltas, but the usage of the pre_auto_build 
flag for the notification of working copy is confusing compared to the platform 
behavior, and what is described in the article about builders.

I wonder if this should not be fixed for 2.2? 
A non breaking change for know would be to provide a workingCopy flag into the 
delta. Is this possible?
Comment 11 Philipe Mulet CLA 2003-02-18 09:11:13 EST
Flags aren't necessary, the associated Java element can be asked if it 
represents a working copy.