Bug 217489

Summary: Support IResourceDelta.COPIED_FROM on IResourceChangeListener
Product: [Eclipse Project] Platform Reporter: Francis Upton IV <francisu>
Component: ResourcesAssignee: Platform-Resources-Inbox <platform-resources-inbox>
Status: CLOSED MOVED QA Contact:
Severity: enhancement    
Priority: P3 CC: a_mergey, john, loskutov, mauromol, peter, Szymon.Brandys
Version: 3.4Keywords: api
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch for I20071213-1500
none
Updated patch none

Description Francis Upton IV CLA 2008-02-01 14:04:47 EST
It is useful to determine when resources are copied so that additional actions may be taken (for example copying other related resources).

A patch will be provided that implements COPIED_FROM in a low overhead fashion using a HashMap in Workspace to track the linkage.  No other fields are added to other classes.
Comment 1 Francis Upton IV CLA 2008-02-01 14:10:25 EST
Created attachment 88619 [details]
Patch for  I20071213-1500

This is for M4, let me know if you need it moved up to M5.

Essentially, this adds a Map (copyMap) to Workspace.  The key is the node Id (as a Long) and the value is the source Resource.  In the various places where a Resource is copied, an entry is recorded in this map.  When the endOperation() at the top level is done, the copyMap pointer is reset.

In preparing the ResourceDelta events, the map is consulted with the nodeId (only for ADD events) and if present the ResourceDelta.oldInfo is added.  Later, when setting the REsourceDelta flags, if there is an oldInfo and it's not a move it must be a copy.

Tests were added for both APIs for copying projects, and the existing copy tests were modified to expect the proper COPIED_FROM notification.

This work might also be useful in support of bug 109166.
Comment 2 Szymon Brandys CLA 2008-04-03 09:09:45 EDT
We are not planning to address this issue in 3.4.
Comment 3 Arnaud MERGEY CLA 2023-04-18 04:09:02 EDT
Created attachment 289030 [details]
Updated patch

Previous patch was using deprecated code and was not compiling anymore (missing generics in Map)
Comment 4 Andrey Loskutov CLA 2023-04-18 04:16:12 EDT
(In reply to Arnaud MERGEY from comment #3)
> Created attachment 289030 [details]
> Updated patch
> 
> Previous patch was using deprecated code and was not compiling anymore
> (missing generics in Map)

Please create issue at https://github.com/eclipse-platform/eclipse.platform/issues and provide a PR with the patch.
Project development moved to github.