Community
Participate
Working Groups
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.
No this is what platform is notifying (we simply convert a resource delta into a Java one). Same notification stages.
John and I checked, and the platform does send any pre_auto_build event when a file is closed or opened.
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.
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.
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.
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.
Got it. Note though that pre/post build notifications also occur when no builder is running (autobuild is off).
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.
Working as per design.
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?
Flags aren't necessary, the associated Java element can be asked if it represents a working copy.