tmf: Fix bad width value when timegraph views are smaller than time axis offset
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 7 May 2015 19:32:50 +0000 (15:32 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Fri, 8 May 2015 01:40:17 +0000 (21:40 -0400)
Change-Id: I2e2a4361e0ce1fb1857e4f0be7e781c56ead438c
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/47485
Reviewed-by: Hudson CI
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphCombo.java
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java

index 7a4907cf1b560a4fa644e4c34a6e5b4889b2804c..fa813bd3ed4fa813782edc762153d5754fc69c35 100644 (file)
@@ -1203,8 +1203,7 @@ public class TimeGraphCombo extends Composite {
      */
     public int getAvailableWidth(int requestedOffset) {
         int totalWidth = fSashForm.getBounds().width;
-        int timeWidth = totalWidth - requestedOffset;
-        return timeWidth;
+        return Math.min(totalWidth, Math.max(0, totalWidth - requestedOffset));
     }
 
     /**
index 8fadb7a30cc78e0bbed45e6ebf593dd35f3a9871..b1f3586e34f335ff27de4b1b195e2bc284dbaab3 100644 (file)
@@ -1857,7 +1857,8 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
      * @since 1.0
      */
     public int getAvailableWidth(int requestedOffset) {
-        return fTimeAlignedComposite.getSize().x - requestedOffset;
+        int totalWidth = fTimeAlignedComposite.getSize().x;
+        return Math.min(totalWidth, Math.max(0, totalWidth - requestedOffset));
     }
 
     /**
This page took 0.039085 seconds and 5 git commands to generate.