Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam Davis2014-08-22 10:52:55 -0400
committerSam Davis2014-08-29 18:54:35 -0400
commit62220a5aa3c4101fb0eda1e97ae494f54efb5006 (patch)
treedc613d241f45bce1c9360c7a6479bbf77d557eeb /org.eclipse.mylyn.reviews.ui/src
parent8050751f933053c0bbb3a3f8012d3bede5fd442f (diff)
downloadorg.eclipse.mylyn.reviews-62220a5aa3c4101fb0eda1e97ae494f54efb5006.tar.gz
org.eclipse.mylyn.reviews-62220a5aa3c4101fb0eda1e97ae494f54efb5006.tar.xz
org.eclipse.mylyn.reviews-62220a5aa3c4101fb0eda1e97ae494f54efb5006.zip
442115: comment popup shown on wrong screen
Change-Id: If58e10226ae86afaa7c1d976ceb0b3bdf5e54cf4 Task-Url:https://bugs.eclipse.org/bugs/show_bug.cgi?id=442115
Diffstat (limited to 'org.eclipse.mylyn.reviews.ui/src')
-rw-r--r--org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
index d2096ed1..77bf6c1d 100644
--- a/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
+++ b/org.eclipse.mylyn.reviews.ui/src/org/eclipse/mylyn/internal/reviews/ui/annotations/CommentPopupDialog.java
@@ -175,7 +175,17 @@ public class CommentPopupDialog extends PopupDialog implements IReviewActionList
}
public void setLocation(Point location) {
- getShell().setLocation(location);
+ Rectangle bounds = getShell().getBounds();
+ Rectangle monitorBounds = getShell().getMonitor().getClientArea();
+ // ensure the popup fits on the shell's monitor
+ bounds.x = contrain(location.x, monitorBounds.x, monitorBounds.x + monitorBounds.width - bounds.width);
+ bounds.y = contrain(location.y, monitorBounds.y, monitorBounds.y + monitorBounds.height - bounds.height);
+
+ getShell().setLocation(new Point(bounds.x, bounds.y));
+ }
+
+ private int contrain(int value, int min, int max) {
+ return Math.max(min, Math.min(max, value));
}
public void setSize(int width, int height) {

Back to the top