google-code-export / choosel

Automatically exported from code.google.com/p/choosel
0 stars 0 forks source link

Encapsulate resource set selections/changes in commands. #171

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently, selection changes cannot be undone/redone because they are lost 
within the selection model. Calls to the selection model should be encapsulated 
within commands so that they can be undone/redone and logged.

Original issue reported on code.google.com by delmyers...@gmail.com on 24 Jun 2011 at 7:42

GoogleCodeExporter commented 9 years ago

Original comment by delmyers...@gmail.com on 24 Jun 2011 at 7:42

GoogleCodeExporter commented 9 years ago
Fixed - task 171: Encapsulate resource set selections/changes in commands. 
http://code.google.com/p/choosel/issues/detail?id=171

As far as I could tell, there were two main places where selections were 
created/changed:

SwitchSelectionOnClickViewItemBehaviour and SelectionResourceSetAvatarFactory

I extended these two classes to create 
CommandDrivenSwitchSelectionOnClickViewItemBehaviour (that's a mouthful) and 
CommandDrivenSelectionResourceSetAvatarFactory. This was done so that previous 
API would not be broken. For example, it might not be necessary to have 
command-driven selections in smaller applications that are based on choosel, 
because there may be no need to undo selections.

This change ended up propagating into the choosel workbench. The 
SelectionDragAvatarFactoryProvider now uses the 
CommandDrivenSelectionResourceSetAvatarFactory and the 
ViewWindowContentProducer uses the 
CommandDrivenSwitchSelectionOnClickViewItemBehaviour, so that applications 
based on the Choosel Workbench will keep track of selection changes in their 
undo stacks.

This change also required a new command: SwitchSelectionCommand, which updates 
the selection in the view. Also, ReplaceSelectionCommand has been updated to 
allow for null (empty) selections.

Original comment by delmyers...@gmail.com on 25 Jun 2011 at 1:42