Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2018-10-17 08:25:14 -0400
committerAndrey Loskutov2018-10-18 01:13:41 -0400
commit8145992a4908a842ad58791594bbd8b5811dbc4f (patch)
treeec6fdd5b9744f49e774ef2c5cb7e0f39c3a5bd07
parentfb5b817008012540fb111acd48a7d128c65bd6b9 (diff)
downloadeclipse.platform.debug-8145992a4908a842ad58791594bbd8b5811dbc4f.tar.gz
eclipse.platform.debug-8145992a4908a842ad58791594bbd8b5811dbc4f.tar.xz
eclipse.platform.debug-8145992a4908a842ad58791594bbd8b5811dbc4f.zip
Bug 491273 - remove copy/pasted getClosestMonitor() implementation
Change-Id: I66ec9cdcde9ea31977ae5b5f77282edcdd22a684 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java41
2 files changed, 3 insertions, 40 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index ba80c4c5a..a6f49a4db 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -78,7 +78,7 @@ Export-Package: org.eclipse.debug.internal.ui;
org.eclipse.debug.ui.stringsubstitution
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
- org.eclipse.ui;bundle-version="[3.110.0,4.0.0)",
+ org.eclipse.ui;bundle-version="[3.111.0,4.0.0)",
org.eclipse.ui.console;bundle-version="[3.5.300,4.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
index 450ff17b4..a31365c9c 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/viewers/breadcrumb/BreadcrumbItemDropDown.java
@@ -20,7 +20,7 @@ import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.util.Geometry;
+import org.eclipse.jface.util.Util;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.TreePath;
import org.eclipse.swt.SWT;
@@ -50,7 +50,6 @@ import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Monitor;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.swt.widgets.Widget;
@@ -487,7 +486,7 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
Point pt= new Point(x, y);
pt= fParentComposite.toDisplay(pt);
- Rectangle monitor= getClosestMonitor(shell.getDisplay(), pt).getClientArea();
+ Rectangle monitor = Util.getClosestMonitor(shell.getDisplay(), pt).getClientArea();
int overlap= (pt.x + width) - (monitor.x + monitor.width);
if (overlap > 0) {
pt.x-= overlap;
@@ -508,42 +507,6 @@ class BreadcrumbItemDropDown implements IBreadcrumbDropDownSite {
}
/**
- * Returns the monitor whose client area contains the given point. If no monitor contains the
- * point, returns the monitor that is closest to the point.
- * <p>
- * Copied from <code>org.eclipse.jface.window.Window.getClosestMonitor(Display, Point)</code>
- * </p>
- *
- * @param display the display showing the monitors
- * @param point point to find (display coordinates)
- * @return the monitor closest to the given point
- */
- private static Monitor getClosestMonitor(Display display, Point point) {
- int closest= Integer.MAX_VALUE;
-
- Monitor[] monitors= display.getMonitors();
- Monitor result= monitors[0];
-
- for (int i= 0; i < monitors.length; i++) {
- Monitor current= monitors[i];
-
- Rectangle clientArea= current.getClientArea();
-
- if (clientArea.contains(point)) {
- return current;
- }
-
- int distance= Geometry.distanceSquared(Geometry.centerPoint(clientArea), point);
- if (distance < closest) {
- closest= distance;
- result= current;
- }
- }
-
- return result;
- }
-
- /**
* Set the size of the given shell such that more content can be shown. The shell size does not
* exceed a user-configurable maximum.
*

Back to the top