summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorCurtis Windatt2012-03-09 12:25:32 (EST)
committer Paul Webster2012-03-09 13:39:19 (EST)
commitb3ee11e1dfadc4a33909d9fdfd014958e6fcf452 (patch)
tree6c4d76fa72d0ab7d190a1126df34ae92f89c5831
parent8a9d29a77d16c65a6ee3654bea7021edc588c64f (diff)
downloadeclipse.platform.ui-b3ee11e1dfadc4a33909d9fdfd014958e6fcf452.zip
eclipse.platform.ui-b3ee11e1dfadc4a33909d9fdfd014958e6fcf452.tar.gz
eclipse.platform.ui-b3ee11e1dfadc4a33909d9fdfd014958e6fcf452.tar.bz2
Bug 348398 - Missing setFocus call on tab selectionv20120309-1839I20120310-2200I20120309-2200
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java38
1 files changed, 30 insertions, 8 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index cf7fca7..0448906 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -824,16 +824,29 @@ public class StackRenderer extends LazyStackRenderer {
@Override
public void mouseUp(MouseEvent e) {
CTabItem item = ctf.getItem(new Point(e.x, e.y));
- if (item == null)
- return;
- if (e.button == 2) {
+ // If the user middle clicks on a tab, close it
+ if (item != null && e.button == 2) {
closePart(item, false);
- } else if (e.button == 1) {
- MUIElement ele = (MUIElement) item.getData(OWNING_ME);
- if (ele.getParent().getSelectedElement() == ele) {
- Control ctrl = (Control) ele.getWidget();
- ctrl.setFocus();
+ }
+
+ // If the user clicks on the tab or empty stack space, call
+ // setFocus()
+ if (e.button == 1) {
+ if (item == null) {
+ Rectangle clientArea = ctf.getClientArea();
+ if (!clientArea.contains(e.x, e.y)) {
+ // User clicked in empty space
+ item = ctf.getSelection();
+ }
+ }
+
+ if (item != null) {
+ MUIElement ele = (MUIElement) item.getData(OWNING_ME);
+ if (ele.getParent().getSelectedElement() == ele) {
+ Control ctrl = (Control) ele.getWidget();
+ ctrl.setFocus();
+ }
}
}
}
@@ -870,6 +883,15 @@ public class StackRenderer extends LazyStackRenderer {
Point relativePoint = ctf.getDisplay().map(null, ctf,
absolutePoint);
CTabItem eventTabItem = ctf.getItem(relativePoint);
+
+ // If click happened in empty area, still show the menu
+ if (eventTabItem == null) {
+ Rectangle clientArea = ctf.getClientArea();
+ if (!clientArea.contains(e.x, e.y)) {
+ eventTabItem = ctf.getSelection();
+ }
+ }
+
if (eventTabItem != null) {
MUIElement uiElement = (MUIElement) eventTabItem
.getData(AbstractPartRenderer.OWNING_ME);