Bug 217489 - Support IResourceDelta.COPIED_FROM on IResourceChangeListener
Summary: Support IResourceDelta.COPIED_FROM on IResourceChangeListener
Status: CLOSED MOVED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Resources (show other bugs)
Version: 3.4   Edit
Hardware: PC Linux
: P3 enhancement with 5 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-Resources-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
Depends on:
Blocks:
 
Reported: 2008-02-01 14:04 EST by Francis Upton IV CLA
Modified: 2023-04-18 04:16 EDT (History)
6 users (show)

See Also:


Attachments
Patch for I20071213-1500 (14.62 KB, patch)
2008-02-01 14:10 EST, Francis Upton IV CLA
no flags Details | Diff
Updated patch (35.25 KB, patch)
2023-04-18 04:09 EDT, Arnaud MERGEY CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.