| Summary: | [EditorMgmt] Activate editor (F12) does not set focus in editor | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Luca Davanzo <luca.davanzo> |
| Component: | UI | Assignee: | Douglas Pollock <douglas.pollock> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | CC: | eclipse.felipe, n.a.edgar |
| Version: | 2.0 | Keywords: | accessibility |
| Target Milestone: | 3.1 | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
|
Description
Luca Davanzo
There is a known problem in whereby accelerators aren't processed when a toolbar button has focus. I could not find the PR though. SN may not be around next week. If not, FH can you take a look at this and see if there is anything we can do? I thought the "accelerators not processed when toolbar button has focus" issue had been resolved. I believe this has been fixed for a while. The following code implements an
F12 accelerator and sets focus to a toolbar. When F12 is pressed, the
accelerator is fired:
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
Menu bar = new Menu (shell, SWT.BAR);
shell.setMenuBar (bar);
MenuItem fileItem = new MenuItem (bar, SWT.CASCADE);
fileItem.setText ("&File");
Menu fileMenu = new Menu (shell, SWT.DROP_DOWN);
MenuItem newItem = new MenuItem (fileMenu, SWT.PUSH);
newItem.setText ("&New\tF12");
newItem.setAccelerator (SWT.F12);
fileItem.setMenu (fileMenu);
Listener listener = new Listener () {
public void handleEvent (Event e) {
System.out.println ("Got it! - " + e.widget);
}
};
newItem.addListener (SWT.Selection, listener);
ToolBar toolBar = new ToolBar (shell, SWT.BORDER | SWT.FLAT);
for (int i=0; i<12; i++) {
int style = (i % 3 == 0) ? SWT.CHECK : SWT.PUSH;
ToolItem item = new ToolItem (toolBar, style);
item.setText ("Item &" + i);
item.addListener (SWT.Selection, listener);
}
toolBar.pack ();
Button button = new Button (shell, SWT.PUSH);
button.setText ("&Button");
button.setBounds (64, 64, 64, 64);
button.addListener (SWT.Selection, listener);
shell.pack ();
shell.open ();
toolBar.setFocus ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
Can still reproduce it in 2.0. Works OK if toolbar gets focus from a view. Looks like when the editor is already active, it does not bother to set focus back to the editor. Fixed in CVS. After the editor is activated, focus is then set in the editor part. Updated the summary and keywords to (try to) more clearly reflect the problem. Verified in 3.1 RC1. |