Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Loskutov2018-10-17 08:19:13 -0400
committerAndrey Loskutov2018-10-17 08:19:13 -0400
commitbed03cffc0cc47fd681d9c57b5c04a95df805273 (patch)
treebb0d1d8237194918cb38d101ec4335ddff3808cb
parent54b7aafa25e7fb5108b528cb39c9f920dac23330 (diff)
downloadeclipse.platform.text-I20181022-1800.tar.gz
eclipse.platform.text-I20181022-1800.tar.xz
eclipse.platform.text-I20181022-1800.zip
Change-Id: I6dc63724761f94353dc12be8c594e3664f55f42f Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
-rw-r--r--org.eclipse.jface.text/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java39
2 files changed, 4 insertions, 37 deletions
diff --git a/org.eclipse.jface.text/META-INF/MANIFEST.MF b/org.eclipse.jface.text/META-INF/MANIFEST.MF
index c8674bab5..50aad0342 100644
--- a/org.eclipse.jface.text/META-INF/MANIFEST.MF
+++ b/org.eclipse.jface.text/META-INF/MANIFEST.MF
@@ -36,7 +36,7 @@ Require-Bundle:
org.eclipse.core.runtime;bundle-version="[3.5.0,4.0.0)",
org.eclipse.text;bundle-version="[3.8.0,4.0.0)";visibility:=reexport,
org.eclipse.swt;bundle-version="[3.107.0,4.0.0)",
- org.eclipse.jface;bundle-version="[3.5.0,4.0.0)"
+ org.eclipse.jface;bundle-version="[3.15.0,4.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: com.ibm.icu.text
Automatic-Module-Name: org.eclipse.jface.text
diff --git a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
index 70d2b3b1d..689e13852 100644
--- a/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
+++ b/org.eclipse.jface.text/src/org/eclipse/jface/text/AbstractInformationControlManager.java
@@ -32,6 +32,7 @@ import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.internal.text.InformationControlReplacer;
import org.eclipse.jface.internal.text.InternalAccessor;
import org.eclipse.jface.util.Geometry;
+import org.eclipse.jface.util.Util;
import org.eclipse.jface.text.ITextViewerExtension8.EnrichMode;
@@ -1077,41 +1078,7 @@ abstract public class AbstractInformationControlManager {
center= Geometry.centerPoint(area);
else
center= Geometry.centerPoint(Geometry.getExtrudedEdge(area, 0, anchor.getSWTFlag()));
- return getClosestMonitor(fSubjectControl.getDisplay(), Geometry.createRectangle(center, new Point(0, 0)));
- }
-
- /**
- * Copied from org.eclipse.jface.window.Window. 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. If this is ever made public, it should be moved into a separate utility class.
- *
- * @param display the display to search for monitors
- * @param rectangle the rectangle to find the closest monitor for (display coordinates)
- * @return the monitor closest to the given point
- * @since 3.3
- */
- private Monitor getClosestMonitor(Display display, Rectangle rectangle) {
- int closest = Integer.MAX_VALUE;
-
- Point toFind= Geometry.centerPoint(rectangle);
- Monitor[] monitors = display.getMonitors();
- Monitor result = monitors[0];
-
- for (Monitor current : monitors) {
- Rectangle clientArea = current.getClientArea();
-
- if (clientArea.contains(toFind)) {
- return current;
- }
-
- int distance = Geometry.distanceSquared(Geometry.centerPoint(clientArea), toFind);
- if (distance < closest) {
- closest = distance;
- result = current;
- }
- }
-
- return result;
+ return Util.getClosestMonitor(fSubjectControl.getDisplay(), center);
}
/**
@@ -1232,7 +1199,7 @@ abstract public class AbstractInformationControlManager {
* @since 3.4
*/
void cropToClosestMonitor(Rectangle bounds) {
- Rectangle monitorBounds= getClosestMonitor(fSubjectControl.getDisplay(), bounds).getClientArea();
+ Rectangle monitorBounds= Util.getClosestMonitor(fSubjectControl.getDisplay(), Geometry.centerPoint(bounds)).getClientArea();
bounds.intersect(monitorBounds);
}

Back to the top