diff options
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java index 7014f7114b..98db43d16e 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/cocoa/org/eclipse/swt/widgets/Text.java @@ -347,10 +347,11 @@ public void append (String string) { @Override boolean becomeFirstResponder (long id, long sel) { - receivingFocus = true; - boolean result = super.becomeFirstResponder (id, sel); - receivingFocus = false; - return result; + if ((style & SWT.SINGLE) != 0) { + if ((state & DISABLED) != 0) return false; + return true; + } + return super.becomeFirstResponder (id, sel); } static int checkStyle (int style) { @@ -820,6 +821,15 @@ Cursor findCursor () { return (cursor != null) ? cursor : display.getSystemCursor (SWT.CURSOR_IBEAM); } +@Override +boolean forceFocus(NSView focusView) { + receivingFocus = true; + boolean result = super.forceFocus(focusView); + if (((style & SWT.SINGLE) != 0)) ((NSTextField) view).selectText(null); + receivingFocus = false; + return result; +} + /** * Returns the line number of the caret. * <p> |