diff options
author | Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> | 2012-11-26 16:15:02 -0500 |
---|---|---|
committer | Carolyn MacLeod <Carolyn_MacLeod@ca.ibm.com> | 2012-11-26 16:15:02 -0500 |
commit | b31a2c4fef115f61f56aab574a9b54fe849df0f4 (patch) | |
tree | 9327f82f8220381b0949774510e8367878d7a1c6 /bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java | |
parent | e2eff04a9d010d2f0bb36a6d475a23fe8421fbf8 (diff) | |
download | eclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.tar.gz eclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.tar.xz eclipse.platform.swt-b31a2c4fef115f61f56aab574a9b54fe849df0f4.zip |
Bug 394016 - Ctrl+PageDown doesn't work multiple times in Classic theme
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java')
-rw-r--r-- | bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java index 0907b1b651..7d91d1ddaa 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java +++ b/bundles/org.eclipse.swt/Eclipse SWT Custom Widgets/common/org/eclipse/swt/custom/CTabFolder.java @@ -760,7 +760,7 @@ public boolean getBorderVisible() { } ToolBar getChevron() { if (chevronTb == null) { - chevronTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS); + chevronTb = new ToolBar(this, SWT.FLAT); initAccessibleChevronTb(); addTabControl(chevronTb, SWT.TRAIL, -1, false); } @@ -2366,7 +2366,7 @@ void setButtonBounds(GC gc) { Display display = getDisplay(); if (showMax) { if (minMaxTb == null) { - minMaxTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS); + minMaxTb = new ToolBar(this, SWT.FLAT); initAccessibleMinMaxTb(); addTabControl(minMaxTb, SWT.TRAIL, 0, false); } @@ -2389,7 +2389,7 @@ void setButtonBounds(GC gc) { // min button if (showMin) { if (minMaxTb == null) { - minMaxTb = new ToolBar(this, SWT.FLAT | SWT.NO_FOCUS); + minMaxTb = new ToolBar(this, SWT.FLAT); initAccessibleMinMaxTb(); addTabControl(minMaxTb, SWT.TRAIL, 0, false); } @@ -2481,6 +2481,35 @@ void setButtonBounds(GC gc) { controlRects = rects; if (changed || hovering) updateBkImages(); } +public boolean setFocus () { + checkWidget (); + + /* + * Feature in SWT. When a new tab item is selected + * and the previous tab item had focus, removing focus + * from the previous tab item causes fixFocus() to give + * focus to the first child, which is usually one of the + * toolbars. This is unexpected. + * The fix is to try to set focus on the first tab item + * if fixFocus() is called. + */ + Control focusControl = getDisplay().getFocusControl (); + boolean fixFocus = isAncestor (focusControl); + if (fixFocus) { + CTabItem item = getSelection(); + if (item != null) { + if (item.setFocus ()) return true; + } + } + return super.setFocus (); +} +/* Copy of isFocusAncestor from Control. */ +boolean isAncestor (Control control) { + while (control != null && control != this && !(control instanceof Shell)) { + control = control.getParent(); + } + return control == this; +} public void setFont(Font font) { checkWidget(); if (font != null && font.equals(getFont())) return; |