Community
Participate
Working Groups
Let me begin by stating what we're trying to do. Compare With->Repository Contents is an ideal place to reconcile differences locally. Simple changes are easy, but additions and deletions are problematic. We would like to be able to copy an addition or deletion right-to-left, save, and have the resource created or deleted appropriately. We identify at least two barriers to this: 1. In the addition case (where we have an existing repository node on the right and a non-existing resource node on the left), setContents() is not called on the node because, for example, the compare text viewer checks if the resource exists before calling setContents(). 2. In the case of copying a deleted remote file from right-to-left and saving, we cannot distinguish the empty content case from the deletion case. In both cases, setContents is passed a zero-byte array. We would like to have some way to tell the difference between these two cases. If you have any suggestions about how this can be resolved (either by Compare, or by us, or both), we'd appreciate it.
fixed in 20020305. No API change. Addition case: ICompareInput.copy(boolean) is called (on your DiffNode) where you can create and copy the resource. If the resource is not only copied but modified too, a call to ITypedElement.setContents() follows immediately after the call to copy(). Deletion case: ICompareInput.copy(boolean) is called where you can delete the resource. The default implementation of DiffNode.copy interprets the above cases and calls the replace and setContents methods on the affected ITypedElements. See org.eclipse.compare.internal.BufferedResourceNode for an example.