Bug 9869 - Need more support for creating/deleting resources
Summary: Need more support for creating/deleting resources
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Andre Weinand CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-02-14 17:13 EST by James Moody CLA
Modified: 2002-03-05 05:35 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Moody CLA 2002-02-14 17:13:01 EST
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.
Comment 1 Andre Weinand CLA 2002-03-05 05:35:41 EST
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.