Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 322401

Summary: [LinkedResources] Linked Resources properties page should have a Remove button
Product: [Eclipse Project] Platform Reporter: Markus Keller <markus.kell.r>
Component: UIAssignee: Serge Beauchamp <serge>
Status: RESOLVED FIXED QA Contact: Serge Beauchamp <serge>
Severity: enhancement    
Priority: P3 CC: Szymon.Brandys
Version: 3.7Flags: Szymon.Brandys: review+
Target Milestone: 3.7 M3   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
Implementation
none
New version, with better error handling.
none
New version, without the fProjectFiles array none

Description Markus Keller CLA 2010-08-11 12:18:36 EDT
I20100810-0800

Project properties > Resource > Linked Resources > Linked Resources:
Especially for invalid locations, a Remove button would be handy to remove one or multiple links.
Comment 1 Serge Beauchamp CLA 2010-09-13 05:34:49 EDT
Created attachment 178726 [details]
Implementation
Comment 2 Serge Beauchamp CLA 2010-09-13 05:43:34 EDT
Szymon, can you review it please?  Thanks
Comment 3 Szymon Brandys CLA 2010-09-15 07:23:20 EDT
Questions/comments:
1. is there a reason to keep fProjectFiles in LinkedResourceEditor
2. We should handle exceptions thrown from ProgressMonitorDialog#run more gracefully. Especially InvocationTargetException. Maybe an error dialog, or at least logging using our log facility.
3. I think that 'found' in the for loop (lines 591 - 602) is not required.
Comment 4 Serge Beauchamp CLA 2010-09-15 07:37:36 EDT
(In reply to comment #3)
> Questions/comments:
> 1. is there a reason to keep fProjectFiles in LinkedResourceEditor

Well, fProjectFiles is used to cache the linked resources list in a project.  

Without it, the linked resource list would have to be fetched again using the resource visitor each time the user switch between the two tabs in the property page (since changes to path variables can change linked resource locations).

Internally, the linked resource list is readily available in the core.resource ProjectDescription, so if we had a public API to get the list of all linked resources in a project, we wouldn't need to use the fProjectFiles structure, nor the resource visitor.  It would then be much faster.

But we don't have such API at the moment.

> 2. We should handle exceptions thrown from ProgressMonitorDialog#run more
> gracefully. Especially InvocationTargetException. Maybe an error dialog, or at
> least logging using our log facility.

Good point, I'll make the changes.

> 3. I think that 'found' in the for loop (lines 591 - 602) is not required.

Hum, you must be thinking about some other way to accomplish the removal of deleted IResource from the fProjectFiles array.

The way the code does it is to make a copy, and copy only the files that were not deleted, hence it uses the 'found' variable to know if it should copy the existing resource to the new array.
Comment 5 Serge Beauchamp CLA 2010-09-15 07:41:46 EDT
Created attachment 178916 [details]
New version, with better error handling.
Comment 6 Serge Beauchamp CLA 2010-09-15 08:20:13 EDT
Created attachment 178920 [details]
New version, without the fProjectFiles array
Comment 7 Szymon Brandys CLA 2010-09-15 09:15:56 EDT
Looks good.
Comment 8 Serge Beauchamp CLA 2010-09-30 07:15:05 EDT
Now fixed on head.