| Summary: | Selection event in table doesn't reveal if selection is triggered by mouse or keyboard | ||
|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Moritz Post <mpost> |
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | P3 | CC: | tbuschto |
| Version: | unspecified | ||
| Target Milestone: | 2.3 M3 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Moritz Post
Moritz, just checked with Controls Demo -> Table tab and the stateMask is correctly set on the SelectionEvent. Could you explain the problem in more details? Could you provide a simple snippet how the mouse/keyboard is detected from the SelectionEvent#stateMask? By checking the stateMask against mouse buttons modifiers? Here is a sample snippet:
this.getControl().addSelectionListener(new SelectionListener() {
@Override
public void widgetSelected(SelectionEvent e) {
final boolean leftButton = (e.stateMask & SWT.BUTTON1) != 0;
final boolean rightButton = (e.stateMask & SWT.BUTTON3) != 0;
final boolean mouseSelection = leftButton || rightButton;
if (mouseSelection) {
System.out.println("Mouse selection");
PvTTable.this.uebertrageSelektionZurView();
} else {
System.out.println("Key selection - delay transmission");
PvTTable.this.handleTimer();
}
}
@Override
public void widgetDefaultSelected(SelectionEvent e) {
System.out.println(e.detail + " / " + e.stateMask);
PvTTable.this.uebertrageDefaultAktionZurView();
}
});
Since the javadoc doesn't mention this feature i will mark this as an enhancement. Fixed in master with change https://git.eclipse.org/r/25184. |