Bug 374051 - [JFace] SWTFocusBlockManager & FocusBlockHighlighter
Summary: [JFace] SWTFocusBlockManager & FocusBlockHighlighter
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7.2   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-13 06:12 EDT by Christophe Bouhier CLA
Modified: 2013-10-24 11:49 EDT (History)
2 users (show)

See Also:


Attachments
Screenshot (51.73 KB, image/png)
2012-03-13 06:12 EDT, Christophe Bouhier CLA
no flags Details
Raw code (14.99 KB, application/zip)
2012-03-13 06:18 EDT, Christophe Bouhier CLA
no flags Details
Code with snippet (13.28 KB, application/zip)
2012-03-13 06:50 EDT, Christophe Bouhier CLA
no flags Details

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