| Summary: | AbstractHyperlink should call setFocus before calling linkActivated listeners | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Carolyn MacLeod <carolynmacleod4> |
| Component: | User Assistance | Assignee: | platform-ua-inbox <platform-ua-inbox> |
| Status: | CLOSED WORKSFORME | QA Contact: | |
| Severity: | normal | ||
| Priority: | P3 | ||
| Version: | 4.2 | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
|
Description
Carolyn MacLeod
Here is a simple JFace snippet for testing.
This fails in the manner described in the forum post.
import org.eclipse.jface.dialogs.*;
import org.eclipse.swt.*;
import org.eclipse.swt.events.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
public class Snippet012BasicPopupDialogAccessibility {
public static void main(String[] args) {
Display display = new Display ();
final Shell shell = new Shell(display);
shell.setLayout(new GridLayout());
Text text = new Text(shell, SWT.SINGLE | SWT.BORDER);
text.setText("This is a text edit field.");
Button button = new Button(shell, SWT.PUSH);
button.setText("Open");
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
PopupDialog testDialog = new PopupDialog(shell,PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE,false,false,false,false,false,"Testing!","This is a test");
testDialog.open();
}
});
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
This is a user error. Changing false to true in the following line fixes this:
PopupDialog testDialog = new
PopupDialog(shell,PopupDialog.INFOPOPUPRESIZE_SHELLSTYLE,true,false,false,false,false,"Testing!","This is a test");
This is because the third parameter to the PopupDialog constructor is:
* @param takeFocusOnOpen
* A boolean indicating whether focus should be taken by this
* popup when it opens.
Closing this bug as "Works for me".
|