Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemy Suen2011-05-25 18:42:01 +0000
committerRemy Suen2011-05-25 18:42:01 +0000
commit3b1e6a69bb2c963d9fe90b6683c8aaaac37a0f2a (patch)
treef2ee43d0dffd67d94fd9e2a5653b9f8777e03722 /bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess
parent34141783f1fb2ecf40fbb2c78534974cda7af294 (diff)
downloadeclipse.platform.ui-3b1e6a69bb2c963d9fe90b6683c8aaaac37a0f2a.tar.gz
eclipse.platform.ui-3b1e6a69bb2c963d9fe90b6683c8aaaac37a0f2a.tar.xz
eclipse.platform.ui-3b1e6a69bb2c963d9fe90b6683c8aaaac37a0f2a.zip
Bug 343273 Quick Access dialog opens on wrong monitor
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
index 2f715bf4f01..4270cac8afa 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/quickaccess/SearchField.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2010 IBM Corporation and others.
+ * Copyright (c) 2010, 2011 IBM Corporation 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
@@ -36,6 +36,8 @@ import org.eclipse.swt.events.ShellEvent;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.Text;
@@ -163,7 +165,28 @@ public class SearchField {
private void layoutShell() {
Composite parent = text.getParent();
Rectangle tempBounds = parent.getBounds();
- Rectangle compBounds = text.getDisplay().map(parent, null, tempBounds);
+ Display display = text.getDisplay();
+ Rectangle compBounds = display.map(parent, null, tempBounds);
+ for (Monitor monitor : display.getMonitors()) {
+ if (monitor.getBounds().contains(compBounds.x, compBounds.y)) {
+ Rectangle monitorBounds = monitor.getBounds();
+ int width = Math.max(350, compBounds.width);
+ int height = 250;
+
+ if (compBounds.x + width > monitorBounds.width) {
+ compBounds.x = monitorBounds.width - width;
+ }
+
+ if (compBounds.y + height > monitorBounds.height) {
+ compBounds.y = compBounds.y - tempBounds.height - height;
+ }
+
+ shell.setBounds(compBounds.x, compBounds.y + compBounds.height, width, height);
+ shell.layout();
+ return;
+ }
+ }
+
Rectangle monitorBounds = text.getMonitor().getBounds();
int width = Math.max(350, compBounds.width);
int height = 250;

Back to the top