Bug 374051

Summary: [JFace] SWTFocusBlockManager & FocusBlockHighlighter
Product: [Eclipse Project] Platform Reporter: Christophe Bouhier <dzonekl>
Component: UIAssignee: Platform UI Triaged <platform-ui-triaged>
Status: NEW --- QA Contact:
Severity: enhancement    
Priority: P3 CC: pwebster, tom.schindl
Version: 3.7.2   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Screenshot
none
Raw code
none
Code with snippet none

Description Christophe Bouhier CLA 2012-03-13 06:12:29 EDT
Created attachment 212535 [details]
Screenshot

I have created a specialized version of the SWTFocusCellManager, named SWTFocusBlockManager
It maintains a drag state, and updates the block of cells which have focus. For this I also needed a specialized implementation of the FocusBlockHighlighter. This updates the column focus selection. 
While draggin, a command can be prepared. When Mouse.UP the command is executed. 

See a screenshot attached. 

- It now works with SWT.MULTI selection on. 
- The copy command is embedded in the SWTFocusBlockManager, while it shouldn't be part of it (It now creates dependencies on EMF Command etc...).
- The focus/selection direction is now hardcoded. (Down only). 
- Dragging upwards doesn't pain the border properly. 
- Dragging can occur within the bounds of the ViewCell, it would be nice to show a handle in one of the corners to drag down.
Comment 1 Christophe Bouhier CLA 2012-03-13 06:18:06 EDT
Created attachment 212536 [details]
Raw code
Comment 2 Christophe Bouhier CLA 2012-03-13 06:50:07 EDT
Created attachment 212540 [details]
Code with snippet

Note: As various methods from Jface are internal, 
I had to create exposing viewers named OpenTreeViewer and OpenTableViewers, this could eventually use protected methods, when/If part of JFace.
Comment 3 Christophe Bouhier CLA 2012-03-13 07:00:36 EDT
Oops, the current code doesn't work for column 0. 
- to fix remove the column check in FocusBlockOwnerDrawHighlighterForMultipleSelection -> hookListener() -> handleEvent(): 

if (event.index > 0) {
	markFocusedBlock(event, allCells);
}