tmf: Support marker event categories
authorPatrick Tasse <patrick.tasse@gmail.com>
Tue, 27 Oct 2015 15:21:54 +0000 (11:21 -0400)
committerPatrick Tasse <patrick.tasse@gmail.com>
Thu, 29 Oct 2015 21:05:59 +0000 (17:05 -0400)
Change-Id: Ic60590932a23e21d39b800a7e3893ea0661d16d9
Signed-off-by: Patrick Tasse <patrick.tasse@gmail.com>
Reviewed-on: https://git.eclipse.org/r/59063
Reviewed-by: Hudson CI
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/timegraph/AbstractTimeGraphView.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/TimeGraphViewer.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEvent.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/IMarkerEventSource.java
tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/model/MarkerEvent.java

index 41b51148b7d3f3401721f74b6c7de0fe58362565..40aeed346ed01f6276dc662f37d79222816a9321 100644 (file)
@@ -38,6 +38,8 @@ public class Messages extends NLS {
     public static String ManageCustomParsersDialog_NewButtonLabel;
     public static String ManageCustomParsersDialog_TextButtonLabel;
 
+    public static String MarkerEvent_Bookmark;
+
     public static String TmfEventsTable_AddBookmarkActionText;
     public static String TmfEventsTable_ApplyPresetFilterMenuName;
     public static String TmfEventsTable_ClearFiltersActionText;
index eeb718daa338f06816daf9533a70b9c6f1e4c0b8..539f88c5c052b4f3d56949b0f72ccdec594738d1 100644 (file)
@@ -64,7 +64,7 @@ TmfMarker_LocationRank=rank {0}
 TmfMarker_LocationTime=timestamp [{0}]
 TmfMarker_LocationTimeRange=timestamp [{0}, {1}]
 
-# org.eclipse.tracecompass.tmf.ui.viewers.timegraph.dialogs
+# org.eclipse.tracecompass.tmf.ui.widgets.timegraph.dialogs
 TmfTimeFilterDialog_EDIT_PROFILING_OPTIONS=Edit Profiling Options
 TmfTimeFilterDialog_TRACE_FILTER=Trace Filter
 TmfTimeFilterDialog_TRACE_FILTER_DESC=Define the filter set
@@ -84,7 +84,10 @@ TmfTimeFilterDialog_UNCHECK_SELECTED=Uncheck selected
 TmfTimeFilterDialog_CHECK_SUBTREE=Check subtree
 TmfTimeFilterDialog_UNCHECK_SUBTREE=Uncheck subtree
 
-# org.eclipse.tracecompass.tmf.ui.viewers.timegraph.widgets
+# org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model
+MarkerEvent_Bookmark=Bookmark
+
+# org.eclipse.tracecompass.tmf.ui.widgets.timegraph.widgets
 TmfTimeTipHandler_DURATION=Duration
 TmfTimeTipHandler_LINK_SOURCE=Source
 TmfTimeTipHandler_LINK_SOURCE_TIME=Source Time
@@ -148,7 +151,7 @@ ColorsView_MoveUpActionToolTipText=Increase priority
 ColorsView_TickButtonText=Tick
 TickColorDialog_TickColorDialogTitle=Choose tick color
 
-# org.eclipse.tracecompass.tmf.ui.wizards
+# org.eclipse.tracecompass.tmf.ui.parsers.wizards
 CustomTxtParserInputWizardPage_addChildLine=Add child line
 CustomTxtParserInputWizardPage_addGroup=Add group
 CustomTxtParserInputWizardPage_addNextLine=Add next line
@@ -293,7 +296,7 @@ TmfView_PinActionToolTipText=Pin View
 TmfView_AlignViewsActionNameText=Align Views
 TmfView_AlignViewsActionToolTipText=Align Views
 
-# Call Stack View
+# org.eclipse.tracecompass.tmf.ui.views.callstack
 CallStackPresentationProvider_Thread=Thread
 CallStackView_FunctionColumn=Function
 CallStackView_DepthColumn=Depth
index f78f241a8e37c57558365fb5c1bf410b864efb1f..85fba903b8f75414609395e81f165748146d1f8d 100644 (file)
@@ -1185,7 +1185,7 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
                             int alpha = Integer.valueOf(matcher.group(4));
                             Color color = new Color(Display.getDefault(), red, green, blue, alpha);
                             fColors.add(color);
-                            bookmarks.add(new MarkerEvent(null, Long.valueOf(time), Long.valueOf(duration), color, label, true));
+                            bookmarks.add(new MarkerEvent(null, Long.valueOf(time), Long.valueOf(duration), IMarkerEvent.BOOKMARK, color, label, true));
                         } catch (NumberFormatException e) {
                             Activator.getDefault().logError(e.getMessage());
                         }
@@ -1497,10 +1497,12 @@ public abstract class AbstractTimeGraphView extends TmfView implements ITmfTimeA
             long resolution, @NonNull IProgressMonitor monitor) {
         List<IMarkerEvent> markers = new ArrayList<>();
         for (IMarkerEventSource markerEventSource : getMarkerEventSources(getTrace())) {
-            if (monitor.isCanceled()) {
-                break;
+            for (String category : markerEventSource.getMarkerCategories()) {
+                if (monitor.isCanceled()) {
+                    break;
+                }
+                markers.addAll(markerEventSource.getMarkerList(checkNotNull(category), startTime, endTime, resolution, monitor));
             }
-            markers.addAll(markerEventSource.getMarkerList(startTime, endTime, resolution, monitor));
         }
         return markers;
     }
index 2b31d7d7307def1ccdeae54c1b131f32d0ae42a1..8d8e2a3923022ca93867194ac795290d34e96b14 100644 (file)
@@ -2010,7 +2010,7 @@ public class TimeGraphViewer implements ITimeDataProvider, SelectionListener {
                             final RGBA rgba = dialog.getColorValue();
                             Color color = new Color(Display.getDefault(), rgba.rgb.red, rgba.rgb.green, rgba.rgb.blue, rgba.alpha);
                             fColors.add(color);
-                            IMarkerEvent bookmark = new MarkerEvent(null, time, duration, color, label, true);
+                            IMarkerEvent bookmark = new MarkerEvent(null, time, duration, IMarkerEvent.BOOKMARK, color, label, true);
                             fBookmarks.add(bookmark);
                             Collections.sort(fBookmarks, new BookmarkComparator());
                             getTimeGraphControl().setBookmarks(fBookmarks);
index b8f363fbabd37a8b677dcab7e65d1ace57e94410..e34610ee6061f1167f6297588b86faa96df14e34 100644 (file)
 
 package org.eclipse.tracecompass.tmf.ui.widgets.timegraph.model;
 
+import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
+
+import org.eclipse.jdt.annotation.NonNull;
 import org.eclipse.swt.graphics.Color;
+import org.eclipse.tracecompass.internal.tmf.ui.Messages;
 
 /**
- * Interface for a marker time event that includes a color and optional label.
+ * Interface for a marker time event that includes a category, a color and
+ * an optional label.
  *
  * @since 2.0
  */
 public interface IMarkerEvent extends ITimeEvent {
 
+    /** Bookmark marker category */
+    @NonNull String BOOKMARK = checkNotNull(Messages.MarkerEvent_Bookmark);
+
+    /**
+     * Get this marker's category.
+     *
+     * @return The category
+     */
+    String getCategory();
+
     /**
      * Get this marker's label.
      *
index 8cb9302338cd3327dedfb6b28ccff8eb972038df..d2bd15df2d84d250da34a24c4de79560f6c29d9c 100644 (file)
@@ -25,8 +25,18 @@ import org.eclipse.jdt.annotation.NonNull;
 public interface IMarkerEventSource {
 
     /**
-     * Gets the list of marker events in a given time range.
+     * Gets the list of marker categories that this object provides.
      *
+     * @return The list of marker categories
+     */
+    @NonNull List<String> getMarkerCategories();
+
+    /**
+     * Gets the list of marker events of a specific category in a given time
+     * range.
+     *
+     * @param category
+     *            The marker category
      * @param startTime
      *            Start of the time range
      * @param endTime
@@ -36,8 +46,7 @@ public interface IMarkerEventSource {
      * @param monitor
      *            The progress monitor object
      * @return The list of marker events
-     * @since 2.0
      */
-    @NonNull List<IMarkerEvent> getMarkerList(long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor);
+    @NonNull List<IMarkerEvent> getMarkerList(@NonNull String category, long startTime, long endTime, long resolution, @NonNull IProgressMonitor monitor);
 
 }
index a4238a6e2d2284f19d4579e57b8b5e1109ee337d..0490c48d9dfe1e1290af74bb4ee4b210db5ea37e 100644 (file)
@@ -21,6 +21,7 @@ import org.eclipse.swt.graphics.Color;
  */
 public class MarkerEvent extends TimeEvent implements IMarkerEvent {
 
+    private final String fCategory;
     private final Color fColor;
     private final String fLabel;
     private final boolean fForeground;
@@ -34,6 +35,8 @@ public class MarkerEvent extends TimeEvent implements IMarkerEvent {
      *            The timestamp of this marker
      * @param duration
      *            The duration of the marker
+     * @param category
+     *            The category of the marker
      * @param color
      *            The marker color
      * @param label
@@ -41,8 +44,9 @@ public class MarkerEvent extends TimeEvent implements IMarkerEvent {
      * @param foreground
      *            true if the marker is drawn in foreground, and false otherwise
      */
-    public MarkerEvent(ITimeGraphEntry entry, long time, long duration, Color color, String label, boolean foreground) {
+    public MarkerEvent(ITimeGraphEntry entry, long time, long duration, String category, Color color, String label, boolean foreground) {
         super(entry, time, duration);
+        fCategory = category;
         fColor = color;
         fLabel = label;
         fForeground = foreground;
@@ -57,6 +61,8 @@ public class MarkerEvent extends TimeEvent implements IMarkerEvent {
      *            The timestamp of this marker
      * @param duration
      *            The duration of the marker
+     * @param category
+     *            The category of the marker
      * @param color
      *            The marker color
      * @param label
@@ -66,13 +72,19 @@ public class MarkerEvent extends TimeEvent implements IMarkerEvent {
      * @param value
      *            The value of the marker
      */
-    public MarkerEvent(ITimeGraphEntry entry, long time, long duration, Color color, String label, boolean foreground, int value) {
+    public MarkerEvent(ITimeGraphEntry entry, long time, long duration, String category, Color color, String label, boolean foreground, int value) {
         super(entry, time, duration, value);
+        fCategory = category;
         fColor = color;
         fLabel = label;
         fForeground = foreground;
     }
 
+    @Override
+    public String getCategory() {
+        return fCategory;
+    }
+
     @Override
     public Color getColor() {
         return fColor;
This page took 0.02929 seconds and 5 git commands to generate.