From bedfbbb5a5d2225bbc21354f74f19f5b6c072bc2 Mon Sep 17 00:00:00 2001 From: Xavier Raynaud Date: Fri, 28 Mar 2014 12:34:52 +0100 Subject: [PATCH] [TMF] Increase visibility of some package protected methods Therefore, these methods can be used in subclasses and/or from other packages. Change-Id: Ie5ef3408dfc8add0d4da8279c18a7c6391381250 Signed-off-by: Xavier Raynaud Reviewed-on: https://git.eclipse.org/r/24057 Reviewed-by: Alexandre Montplaisir IP-Clean: Alexandre Montplaisir Tested-by: Hudson CI --- .../timegraph/widgets/TimeGraphControl.java | 21 +++++++++++++++++-- .../ui/widgets/timegraph/widgets/Utils.java | 16 +++++++++----- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java index c8f6afdd1d..e38fd420e4 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/TimeGraphControl.java @@ -1001,7 +1001,15 @@ public class TimeGraphControl extends TimeGraphBaseControl return toggled; } - int getItemIndexAtY(int y) { + /** + * Gets the index of the item at the given location. + * + * @param y + * the y coordinate + * @return the index of the item at the given location, of -1 if none. + * @since 3.0 + */ + protected int getItemIndexAtY(int y) { if (y < 0) { return -1; } @@ -1023,7 +1031,16 @@ public class TimeGraphControl extends TimeGraphBaseControl return Math.abs(x - nameWidth) < SNAP_WIDTH; } - ITimeGraphEntry getEntry(Point pt) { + /** + * Gets the {@link ITimeGraphEntry} at the given location. + * + * @param pt + * a point in the widget + * @return the {@link ITimeGraphEntry} at this point, or null + * if none. + * @since 3.0 + */ + protected ITimeGraphEntry getEntry(Point pt) { int idx = getItemIndexAtY(pt.y); return idx >= 0 ? fItemData.fExpandedItems[idx].fEntry : null; } diff --git a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java index 005c1c4135..a75c5d9fe3 100644 --- a/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java +++ b/org.eclipse.linuxtools.tmf.ui/src/org/eclipse/linuxtools/tmf/ui/widgets/timegraph/widgets/Utils.java @@ -463,16 +463,22 @@ public class Utils { } /** - * N means:
  • -1: Previous Event
  • 0: Current Event
  • - * 1: Next Event
  • 2: Previous Event when located in a non Event Area - * + * Gets the {@link ITimeEvent} at the given time from the given + * {@link ITimeGraphEntry}. * * @param entry + * a {@link ITimeGraphEntry} * @param time + * a timestamp * @param n - * @return + * this parameter means:
  • -1: Previous Event
  • + * 0: Current Event
  • + * 1: Next Event
  • 2: Previous Event when located in a non + * Event Area + * @return a {@link ITimeEvent}, or null. + * @since 3.0 */ - static ITimeEvent findEvent(ITimeGraphEntry entry, long time, int n) { + public static ITimeEvent findEvent(ITimeGraphEntry entry, long time, int n) { if (null == entry || ! entry.hasTimeEvents()) { return null; } -- 2.34.1