Community
Participate
Working Groups
I20030710 The Java element delta still informs clients about deleted working copies. Due to the handle stability the destroyed working copy unit passed around in the delta answer false for unit.isWorkingCopy(). Hence the listener things a original was destroyed and in the affected case flushes the undo stack. The question is: how do I now find out if a working copy got destroyed. Do I have to check the owner ? Do we need some additional delta describing the state change to and from a working copy ?
Good find. Indeed, this is a problem. Adding/deleting primary working copies shouldn't be notified as added/remove deltas, but rather changed with some flag. Or something in the same spirit. However, this would be somewhat inconsistent with other working copies, which isn't very nice.
Added flag IJavaElementDelta.F_PRIMARY_WORKING_COPY. When a primary compilation unit becomes a working copy, the delta is no longer an added delta but a change delta with this flag. Symetrically, when a primary working copy is discarded and becomes a compilation unit, the delta is no longer a remove delta but a change delta with this flag.
Verified.