From ec7145b34a4871436b7433acf5b0bbd56066caa9 Mon Sep 17 00:00:00 2001 From: chris.poon Date: Thu, 3 Sep 2015 18:23:57 -0700 Subject: 476588: on a small screen, the comment navigation buttons open the comment popup with a scrollbar Change-Id: Ifa2d3f00239b52b69247a5ea569f5b9192905356 Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=476588 Signed-off-by: chris.poon --- .../internal/reviews/ui/annotations/CommentPopupDialog.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'org.eclipse.mylyn.reviews.ui/src') 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 f31940976..d6332f9b6 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 @@ -283,6 +283,10 @@ public class CommentPopupDialog extends PopupDialog implements IReviewActionList return getShell().getBounds(); } + public Rectangle getMonitorArea() { + return getShell().getMonitor().getClientArea(); + } + public Rectangle computeTrim() { return getShell().computeTrim(0, 0, 0, 0); } @@ -299,7 +303,7 @@ public class CommentPopupDialog extends PopupDialog implements IReviewActionList */ public void setLocation(Point location) { Rectangle bounds = getShell().getBounds(); - Rectangle monitorBounds = getShell().getMonitor().getClientArea(); + Rectangle monitorBounds = getMonitorArea(); // ensure the popup fits on the shell's monitor bounds.x = constrain(location.x, monitorBounds.x, monitorBounds.x + monitorBounds.width - bounds.width); bounds.y = constrain(location.y, monitorBounds.y, monitorBounds.y + monitorBounds.height - bounds.height); @@ -319,7 +323,7 @@ public class CommentPopupDialog extends PopupDialog implements IReviewActionList Point size = composite.computeSize(SWT.DEFAULT, SWT.DEFAULT); scrolledComposite.setMinSize(size); - int height = constrain(size.y, MIN_HEIGHT, getShell().getMonitor().getClientArea().height); + int height = constrain(size.y, MIN_HEIGHT, getMonitorArea().height); getShell().setSize(size.x, height); scrolledComposite.setSize(size.x, height); setLocation(new Point(bounds.x, bounds.y)); @@ -340,7 +344,7 @@ public class CommentPopupDialog extends PopupDialog implements IReviewActionList } public void setHeightBasedOnMouse(int mouseY) { - int mouseYFromBottom = getShell().getMonitor().getClientArea().height - mouseY; + int mouseYFromBottom = getMonitorArea().height + getMonitorArea().y - mouseY; // Coordinates are based on the primary monitor recomputeSize(); setSize(MAX_WIDTH, constrain(mouseYFromBottom - ICON_BUFFER, MIN_HEIGHT, getShell().getSize().y)); } -- cgit v1.2.3