Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIan Pun2017-06-26 21:01:41 +0000
committerLeo Ufimtsev2017-08-10 14:52:30 +0000
commit9d1e2228537739092cbe86deec0fa218488dd335 (patch)
tree50d1cfce9e7b4977978a22c84bff1a4be4ce1d20 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom
parentdb68f7c25be16c685565173f918881a59f9fffa2 (diff)
downloadeclipse.platform.swt-9d1e2228537739092cbe86deec0fa218488dd335.tar.gz
eclipse.platform.swt-9d1e2228537739092cbe86deec0fa218488dd335.tar.xz
eclipse.platform.swt-9d1e2228537739092cbe86deec0fa218488dd335.zip
Bug 304893 - [Custom Widgets] READ_ONLY CCombo does not de-select text
on FocusOut Fixes the issue with Ccombo so that it is not automatically selected, and also deselects correctly on focus out. Requires testing on OSX and Windows. Change-Id: Ia61b74cc56ba1b34ab1eaca93c7ce178871d9ff2 Signed-off-by: Ian Pun <ipun@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
index ffb53969b7..e5a9495c37 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CCombo.java
@@ -145,7 +145,7 @@ public CCombo (Composite parent, int style) {
}
};
- int [] comboEvents = {SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize};
+ int [] comboEvents = {SWT.Dispose, SWT.FocusIn, SWT.Move, SWT.Resize, SWT.FocusOut};
for (int i=0; i<comboEvents.length; i++) this.addListener (comboEvents [i], listener);
int [] textEvents = {SWT.DefaultSelection, SWT.DragDetect, SWT.KeyDown, SWT.KeyUp, SWT.MenuDetect, SWT.Modify,
@@ -420,6 +420,9 @@ void comboEvent (Event event) {
text.setFocus();
}
break;
+ case SWT.FocusOut:
+ text.clearSelection();
+ break;
case SWT.Move:
dropDown (false);
break;
@@ -1162,7 +1165,7 @@ void listEvent (Event event) {
int index = list.getSelectionIndex ();
if (index == -1) return;
text.setText (list.getItem (index));
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
list.setSelection (index);
Event e = new Event ();
e.time = event.time;
@@ -1451,7 +1454,7 @@ public void select (int index) {
if (0 <= index && index < list.getItemCount()) {
if (index != getSelectionIndex()) {
text.setText (list.getItem (index));
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
list.select (index);
list.showSelection ();
}
@@ -1654,7 +1657,7 @@ public void setText (String string) {
return;
}
text.setText (string);
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
list.setSelection (index);
list.showSelection ();
}
@@ -1769,7 +1772,7 @@ void textEvent (Event event) {
event.doit = false;
if ((event.stateMask & SWT.ALT) != 0) {
boolean dropped = isDropped ();
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
if (!dropped) setFocus ();
dropDown (!dropped);
break;
@@ -1844,7 +1847,7 @@ void textEvent (Event event) {
if (event.button != 1) return;
if (text.getEditable ()) return;
boolean dropped = isDropped ();
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
if (!dropped) setFocus ();
dropDown (!dropped);
break;
@@ -1863,7 +1866,7 @@ void textEvent (Event event) {
if (!event.doit) break;
if (event.button != 1) return;
if (text.getEditable ()) return;
- text.selectAll ();
+ if (text.getEditable() && text.isFocusControl()) text.selectAll ();
break;
}
case SWT.MouseWheel: {

Back to the top