Bug 383750 - [Cocoa] Focus transfer copies values into text fields

Don't call super in Text.becomeFirstResponder for SINGLE style Text
widget. This causes multiple focus change events and results in unwanted
chang to the text set in the text field.

Change-Id: I7f3db189b2f6c8315950b970bcc89bf6c7d357d8
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 7014f71..98db43d 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 @@
 
 @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 @@
 	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>