Bug 72424 - [Sync View] Add "Restore Removed Items" to Synchronize view
Summary: [Sync View] Add "Restore Removed Items" to Synchronize view
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: 3.3 M7   Edit
Assignee: Krzysztof Daniel CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
: 177739 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-08-23 08:57 EDT by Michael Valenta CLA
Modified: 2007-06-05 15:17 EDT (History)
2 users (show)

See Also:


Attachments
Draft (8.60 KB, patch)
2007-04-03 10:15 EDT, Krzysztof Daniel CLA
no flags Details | Diff
Draft 2nd (5.45 KB, patch)
2007-04-04 07:50 EDT, Krzysztof Daniel CLA
no flags Details | Diff
Changes made in PrepareForReplaceVisitor (4.37 KB, patch)
2007-04-17 04:21 EDT, Krzysztof Daniel CLA
no flags Details | Diff
Model based Restore removed items (4.89 KB, patch)
2007-04-20 07:03 EDT, Krzysztof Daniel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Valenta CLA 2004-08-23 08:57:05 EDT
I find myself using Rempve from view alot now that I have Eclipse as source in 
my workspace. It is a bit tedious to remove the same entries every time I 
restate Eclipse. I would propose the following adjustments to remove from view.

1) When an item is removed, remember that it is removed accross restarts
2) When the parent of removed items is refreshed, prompt if there are removed 
items to give the user the option to show them again.
3) If there is ever a state change on a removed item, show it. 

In some cases, step 3 may be undesirable as well, perhaps the user could be 
prompted in that case as well (although this is trickier due to the background 
refreshing).
Comment 1 Michael Valenta CLA 2004-08-25 09:27:02 EDT
I also noticed that the Remove from view action shows a progress dialog which 
doies not give the blocking job information. I did a remove from view at the 
same time a synchronize was happening and an old-style progress dialog was 
shown. Cancel was enabled but there was no progress occurring (I assume it was 
because the remove was b,ocked by the sync).
Comment 2 Michael Valenta CLA 2004-12-16 14:31:40 EST
Not for 3.1
Comment 3 Markus Keller CLA 2006-06-22 07:25:26 EDT
See also bug 147421 for a related feature.
Comment 4 Michael Valenta CLA 2006-12-11 11:25:36 EST
We do not have the manpower to address this in 3.3.
Comment 5 Michael Valenta CLA 2007-03-16 16:31:40 EDT
*** Bug 177739 has been marked as a duplicate of this bug. ***
Comment 6 Dani Megert CLA 2007-03-17 02:23:15 EDT
For 3.3 would it be possible to just add a 'Show Remove Items' somewhere?
Comment 7 Michael Valenta CLA 2007-03-19 08:16:28 EDT
We'll investigate adding a "Restore Removed Items" for M7.
Comment 8 Michael Valenta CLA 2007-03-19 08:17:32 EDT
Dani, am I right to assume that we would need to do this for both the old and new sync?
Comment 9 Dani Megert CLA 2007-03-19 09:02:08 EDT
I don't care about the new one ;-)
Comment 10 Krzysztof Daniel CLA 2007-03-27 08:18:53 EDT
Michael, could you give some clues where to start?
Comment 11 Michael Valenta CLA 2007-03-27 08:38:32 EDT
There are two places you need to change (because there are two different styles of Synchronize as outlined in this URL):

http://wiki.eclipse.org/index.php/CVS_FAQ#Synchronizing_has_some_regressions_in_Eclipse_3.2._Why.3F

For the old sync, look in the org.eclipse.team.internal.ui.synchronize.actions.SubscriberActionContribution class. That is where the RemoveFromViewAction is added. 

For the model-based sync, look in the org.eclipse.team.internal.ui.synchronize.actions.RefreshActionContribution class. That is where the RemoveFromViewAction is added. 

In both places, we should add an action to the view menu to restore any removed items. Have a look at the SynchronizePageActionGroup#appendToGroup(String, String, IAction) method to see how to add an action to the view menu.

Of course, once you have the action added, you will need to restore the removed items. It will be different for both cases but the one similar trait is that neither keep track of the items that have been removed so you will need to reset them so that all items are readded.

For the old sync, have a look at the org.eclipse.team.internal.ui.synchronize.actions.RemoveFromViewAction. The collector that the item was removed from has a reset method so you should get the right behavior by calling that method.

The model-based sync may be a bit more difficult. For the time being, start to work on the old sync (since that's what will make Dani happy ;-) and, once we have all that in place, we can figure out a way to refresh the model-based sync.
Comment 12 Krzysztof Daniel CLA 2007-04-03 10:15:26 EDT
Created attachment 62778 [details]
Draft

Is this good direction?
Comment 13 Michael Valenta CLA 2007-04-03 13:48:45 EDT
The patch is a good start. Here are some comments:

1) The action should be in the View menu and not the context menu. If it is in the context menu and I remove the last item, I can never get it back. To put it in the view menu, you should call SynchronizePageActionGroup#appendToGroup(ISynchronizePageConfiguration.P_VIEW_MENU, ISynchronizePageConfiguration.SYNCHRONIZE_GROUP, restoreRemovedItemsAction) from the initialize method of the SubscriberActionContribution.

2) Adding methods to a general class like SyncInfoSet is not really something we want to do. When the action is executed, just call collector.reset(). 
Comment 14 Krzysztof Daniel CLA 2007-04-04 07:50:10 EDT
Created attachment 62911 [details]
Draft 2nd

I have created action, but I am afraid it is in other place (suggested solution did not worked for me).

Maybe it is good idea to name it "Reset view"? Because this what actually this action does?
Comment 15 Michael Valenta CLA 2007-04-04 12:34:22 EDT
The suggested solution didn't work because the SubscriberActionContribution#fillContextMenu didn't call super. I added that and modified the code appropriately. I want to keep the menu item name as "Restore Removed Item" so the user knows when they would want to pick the item (i.e. "Reset" doesn't necessarily imply that removed items will be restored). I also removed the collection.run that wrapped the reset since a run is performed in the reset itself. I have released the patch to HEAD.

Now for the model-based sync, you should add the menu in a similar way (i.e. add the menu where the remove action is added). As I mentioned, this case will be a bit harder. We may need to localize the fix to the case where we are using a SubscriberMergeContext. When the SubscriberMergeContext is used, you can get at the internal handler using the getAdapter method and then issue an INITIALIZE event to the handler. Take a look at the classes involved to get familiar with them and let me know if you have any questions.
Comment 16 Krzysztof Daniel CLA 2007-04-17 04:21:02 EDT
Created attachment 64002 [details]
Changes made in PrepareForReplaceVisitor

I have no idea how to put errors to the CVS console...
Comment 17 Krzysztof Daniel CLA 2007-04-17 05:15:55 EDT
Comment on attachment 64002 [details]
Changes made in PrepareForReplaceVisitor

The last patch should not go here, sorry
Comment 18 Dani Megert CLA 2007-04-20 03:40:37 EDT
The mnemonic is missing (I20070418-1012), otherwise it works just fine - thanks!
Comment 19 Krzysztof Daniel CLA 2007-04-20 07:03:23 EDT
Created attachment 64411 [details]
Model based Restore removed items
Comment 20 Michael Valenta CLA 2007-04-20 09:39:57 EDT
Patch released (and mnemonic added).
Comment 21 Michael Valenta CLA 2007-05-01 10:15:31 EDT
Verified in I20070501-0010