Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIvan Furnadjiev2017-04-12 13:25:00 +0000
committerGerrit Code Review @ Eclipse.org2017-04-26 11:48:28 +0000
commit6e2768affd3cb5c4a6953f4b8e27d7453dddc391 (patch)
treea04a026e919d681316e488f911739657751b9302
parentec69db4af8f4cf95fb27ddd013f67f0d90bc87ad (diff)
downloadorg.eclipse.rap-6e2768affd3cb5c4a6953f4b8e27d7453dddc391.tar.gz
org.eclipse.rap-6e2768affd3cb5c4a6953f4b8e27d7453dddc391.tar.xz
org.eclipse.rap-6e2768affd3cb5c4a6953f4b8e27d7453dddc391.zip
Add ScrolledComposite to the list of controls that should not take focus
In SWT ScrolledComposite is not focusable by tab regardless NO_FOCUS style flag. 515153: ScrolledComposite should not take focus https://bugs.eclipse.org/bugs/show_bug.cgi?id=515153 Change-Id: Ie1ac5fcec59127a983335e737968f8df78dfe9f9
-rw-r--r--bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java4
-rw-r--r--tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java44
2 files changed, 46 insertions, 2 deletions
diff --git a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
index 73c8feb945..70d3c596f2 100644
--- a/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.rap.rwt/src/org/eclipse/swt/widgets/Control.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002, 2016 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2002, 2017 Innoopract Informationssysteme GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -25,6 +25,7 @@ import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
import org.eclipse.swt.accessibility.Accessible;
import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DragDetectListener;
import org.eclipse.swt.events.FocusListener;
@@ -93,6 +94,7 @@ public abstract class Control extends Widget implements Drawable {
private boolean takesFocus() {
boolean result = ( getStyle() & SWT.NO_FOCUS ) == 0;
result &= Control.this.getClass() != Composite.class;
+ result &= Control.this.getClass() != ScrolledComposite.class;
result &= Control.this.getClass() != SashForm.class;
return result;
}
diff --git a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
index f01c8c4cc2..bd0f1a2a4f 100644
--- a/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
+++ b/tests/org.eclipse.rap.rwt.test/src/org/eclipse/swt/widgets/Control_Test.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2015 Innoopract Informationssysteme GmbH and others.
+ * Copyright (c) 2009, 2017 Innoopract Informationssysteme GmbH and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -46,6 +46,8 @@ import org.eclipse.rap.rwt.theme.BoxDimensions;
import org.eclipse.rap.rwt.theme.ControlThemeAdapter;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTException;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlListener;
import org.eclipse.swt.events.DragDetectListener;
import org.eclipse.swt.events.FocusAdapter;
@@ -277,6 +279,46 @@ public class Control_Test {
}
@Test
+ public void testSetTabIndex_onControl() {
+ Control control = new Button( shell, SWT.PUSH );
+
+ IControlAdapter adapter = ControlUtil.getControlAdapter( control );
+ adapter.setTabIndex( 5 );
+
+ assertEquals( 5, adapter.getTabIndex() );
+ }
+
+ @Test
+ public void testSetTabIndex_onScrolledComposite() {
+ Control control = new ScrolledComposite( shell, SWT.NONE );
+
+ IControlAdapter adapter = ControlUtil.getControlAdapter( control );
+ adapter.setTabIndex( 5 );
+
+ assertEquals( -1, adapter.getTabIndex() );
+ }
+
+ @Test
+ public void testSetTabIndex_onComposite() {
+ Control control = new Composite( shell, SWT.NONE );
+
+ IControlAdapter adapter = ControlUtil.getControlAdapter( control );
+ adapter.setTabIndex( 5 );
+
+ assertEquals( -1, adapter.getTabIndex() );
+ }
+
+ @Test
+ public void testSetTabIndex_onSashForm() {
+ Control control = new SashForm( shell, SWT.NONE );
+
+ IControlAdapter adapter = ControlUtil.getControlAdapter( control );
+ adapter.setTabIndex( 5 );
+
+ assertEquals( -1, adapter.getTabIndex() );
+ }
+
+ @Test
public void testDispose() {
Control control = new Button( shell, SWT.PUSH );

Back to the top