Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGeneviève Bastien2019-07-03 13:13:39 -0400
committerGenevieve Bastien2019-07-08 10:02:48 -0400
commita43df20e648db8a35a4a2d6c196d400e19dc7217 (patch)
treeca7c75d15948dd6c5f67988fe736abd8c0123ad9
parentf96689fd4c6400c2502fa43d45a93597c18fb3e1 (diff)
downloadorg.eclipse.tracecompass-a43df20e648db8a35a4a2d6c196d400e19dc7217.tar.gz
org.eclipse.tracecompass-a43df20e648db8a35a4a2d6c196d400e19dc7217.tar.xz
org.eclipse.tracecompass-a43df20e648db8a35a4a2d6c196d400e19dc7217.zip
tmf: Add a class to get common externalized time strings
Start Time/End Time/Time/Duration are common concepts used throughout Trace Compass and that users can use as filtering strings. A common messages for all those usages will prevent various syntaxes, like "Start Time"/"StartTime"/"Start time", etc. [Deprecated] Deprecate start/end time messages in state system explorer [Added] TmfStrings class for commonly used externalized strings Change-Id: Ifa150797aa7da413df6a710152b3f0d762c56d8e Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net> Reviewed-on: https://git.eclipse.org/r/145419 Reviewed-by: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: Patrick Tasse <patrick.tasse@gmail.com> Tested-by: CI Bot
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java7
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java15
-rw-r--r--analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties3
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/Messages.java18
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/messages.properties4
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/TmfStrings.java72
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java4
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties2
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/Messages.java7
-rw-r--r--tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java5
10 files changed, 106 insertions, 31 deletions
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
index 61e00b99f8..1c72adfa78 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/analysis/timing/ui/views/segmentstore/table/AbstractSegmentStoreTableViewer.java
@@ -54,6 +54,7 @@ import org.eclipse.tracecompass.internal.segmentstore.core.arraylist.ArrayListSt
import org.eclipse.tracecompass.segmentstore.core.ISegment;
import org.eclipse.tracecompass.segmentstore.core.ISegmentStore;
import org.eclipse.tracecompass.segmentstore.core.SegmentComparators;
+import org.eclipse.tracecompass.tmf.core.TmfStrings;
import org.eclipse.tracecompass.tmf.core.analysis.IAnalysisModule;
import org.eclipse.tracecompass.tmf.core.model.timegraph.IFilterProperty;
import org.eclipse.tracecompass.tmf.core.segment.ISegmentAspect;
@@ -229,21 +230,21 @@ public abstract class AbstractSegmentStoreTableViewer extends TmfSimpleTableView
* Create default columns for start time, end time and duration
*/
private void createColumns() {
- createColumn(Messages.SegmentStoreTableViewer_startTime, new SegmentStoreTableColumnLabelProvider() {
+ createColumn(TmfStrings.startTime(), new SegmentStoreTableColumnLabelProvider() {
@Override
public String getTextForSegment(ISegment input) {
return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getStart()));
}
}, SegmentComparators.INTERVAL_START_COMPARATOR);
- createColumn(Messages.SegmentStoreTableViewer_endTime, new SegmentStoreTableColumnLabelProvider() {
+ createColumn(TmfStrings.endTime(), new SegmentStoreTableColumnLabelProvider() {
@Override
public String getTextForSegment(ISegment input) {
return NonNullUtils.nullToEmptyString(TmfTimestampFormat.getDefaulTimeFormat().format(input.getEnd()));
}
}, SegmentComparators.INTERVAL_END_COMPARATOR);
- createColumn(Messages.SegmentStoreTableViewer_duration, new SegmentStoreTableColumnLabelProvider() {
+ createColumn(TmfStrings.duration(), new SegmentStoreTableColumnLabelProvider() {
@Override
public String getTextForSegment(ISegment input) {
return NonNullUtils.nullToEmptyString(FORMATTER.format(input.getLength()));
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java
index c7e8d8a827..825613d3e1 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/Messages.java
@@ -23,21 +23,6 @@ public class Messages extends NLS {
private static final String BUNDLE_NAME = Messages.class.getPackage().getName() + ".messages"; //$NON-NLS-1$
/**
- * Name of the duration column
- */
- public static String SegmentStoreTableViewer_duration;
-
- /**
- * Name of the end time column
- */
- public static String SegmentStoreTableViewer_endTime;
-
- /**
- * Name of the start time column
- */
- public static String SegmentStoreTableViewer_startTime;
-
- /**
* Title of action to goto start time time
*/
public static String SegmentStoreTableViewer_goToStartEvent;
diff --git a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties
index ae8a2fb4e1..2031d75602 100644
--- a/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties
+++ b/analysis/org.eclipse.tracecompass.analysis.timing.ui/src/org/eclipse/tracecompass/internal/analysis/timing/ui/views/segmentstore/table/messages.properties
@@ -6,9 +6,6 @@
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
###############################################################################
-SegmentStoreTableViewer_duration=Duration
-SegmentStoreTableViewer_endTime=End Time
-SegmentStoreTableViewer_startTime=Start Time
SegmentStoreTableViewer_goToStartEvent=Go to start time
SegmentStoreTableViewer_goToEndEvent=Go to end time
SegmentStoreTableViewer_genericTitle=Table
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/Messages.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/Messages.java
index eed71083c4..2bbb78cd75 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/Messages.java
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/Messages.java
@@ -9,6 +9,7 @@
package org.eclipse.tracecompass.internal.tmf.core;
+import org.eclipse.jdt.annotation.Nullable;
import org.eclipse.osgi.util.NLS;
/**
@@ -20,6 +21,23 @@ public class Messages extends NLS {
public static String TmfCheckpointIndexer_EventsPerSecond;
public static String TmfCheckpointIndexer_Indexing;
+ /**
+ * String to refer to the start time
+ */
+ public static @Nullable String TmfStrings_StartTime;
+ /**
+ * String to refer to the end time
+ */
+ public static @Nullable String TmfStrings_EndTime;
+ /**
+ * String to refer to the time
+ */
+ public static @Nullable String TmfStrings_Time;
+ /**
+ * String to refer to the duration
+ */
+ public static @Nullable String TmfStrings_Duration;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/messages.properties b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/messages.properties
index 3bf5c0ec4e..dbc46edc17 100644
--- a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/messages.properties
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/internal/tmf/core/messages.properties
@@ -12,3 +12,7 @@
TmfCheckpointIndexer_EventsPerSecond=events/s
TmfCheckpointIndexer_Indexing=Indexing
+TmfStrings_StartTime=Start Time
+TmfStrings_EndTime=End Time
+TmfStrings_Time=Time
+TmfStrings_Duration=Duration
diff --git a/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/TmfStrings.java b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/TmfStrings.java
new file mode 100644
index 0000000000..47b98a8b5a
--- /dev/null
+++ b/tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/TmfStrings.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2019 École Polytechnique de Montréal
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+
+package org.eclipse.tracecompass.tmf.core;
+
+import java.util.Objects;
+
+import org.eclipse.jdt.annotation.NonNull;
+import org.eclipse.tracecompass.internal.tmf.core.Messages;
+
+/**
+ * Get externalized strings to identify various core TMF concepts. These strings
+ * can be used in views and analyses to have a common term to identify often
+ * used concepts, or as keys for searches and filters by the user.
+ * <p>
+ * These strings are meant to be used and viewed by the user. Example: views
+ * will display Time in English, Poh in Klingon, searches for a time would be
+ * written Time < 'formatted time' in English, Poh < 'formatted time' in
+ * Klingon.
+ *
+ * @author Geneviève Bastien
+ * @since 5.1
+ */
+public final class TmfStrings {
+
+ private TmfStrings() {
+ // Do nothing
+ }
+
+ /**
+ * Get the string for the start time
+ *
+ * @return The externalized label for start time
+ */
+ public static @NonNull String startTime() {
+ return Objects.requireNonNull(Messages.TmfStrings_StartTime);
+ }
+
+ /**
+ * Get the string for the end time
+ *
+ * @return The externalized label for end time
+ */
+ public static @NonNull String endTime() {
+ return Objects.requireNonNull(Messages.TmfStrings_EndTime);
+ }
+
+ /**
+ * Get the string for the time
+ *
+ * @return The externalized label for time
+ */
+ public static @NonNull String time() {
+ return Objects.requireNonNull(Messages.TmfStrings_Time);
+ }
+
+ /**
+ * Get the string for the duration
+ *
+ * @return The externalized label for duration
+ */
+ public static @NonNull String duration() {
+ return Objects.requireNonNull(Messages.TmfStrings_Duration);
+ }
+
+}
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java
index c34f59f0c0..3c24268e51 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/Messages.java
@@ -185,10 +185,6 @@ public class Messages extends NLS {
public static String TimeGraphTooltipHandler_DefaultMarkerName;
- public static String TimeGraphTooltipHandler_EndTime;
-
- public static String TimeGraphTooltipHandler_StartTime;
-
public static String TimeGraphTooltipHandler_Timestamp;
public static String CustomTxtParserInputWizardPage_addChildLine;
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties
index deb31e966d..6d56b79edc 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/internal/tmf/ui/messages.properties
@@ -183,8 +183,6 @@ TimeGraphLegend_resetTooltip=Reset to default values
TimeGraphLegend_swatchClick=Click to change color.
TimeGraphLegend_widthTooltip=The width of an state with this value.
TimeGraphTooltipHandler_DefaultMarkerName=Marker
-TimeGraphTooltipHandler_EndTime=End Time
-TimeGraphTooltipHandler_StartTime=Start Time
TimeGraphTooltipHandler_Timestamp=Timestamp
# org.eclipse.tracecompass.tmf.ui.parsers.wizards
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/Messages.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/Messages.java
index 01780f9b3a..48426e1eb7 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/Messages.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/statesystem/Messages.java
@@ -13,6 +13,7 @@
package org.eclipse.tracecompass.tmf.ui.views.statesystem;
import org.eclipse.osgi.util.NLS;
+import org.eclipse.tracecompass.tmf.core.TmfStrings;
/**
* Localizable strings in the State System Visualizer.
@@ -47,10 +48,12 @@ public class Messages extends NLS {
/** Label for the "type" column */
public static String TypeColumnLabel;
- /** Label for the "start time" column */
+ /** Label for the "start time" column
+ * @Deprecated Use {@link TmfStrings#startTime()} instead */
public static String StartTimeColumLabel;
- /** Label for the "end time" column */
+ /** Label for the "end time" column
+ * @Deprecated Use {@link TmfStrings#endTime()} instead*/
public static String EndTimeColumLabel;
/** Label for the "attribute path" column */
diff --git a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
index 8b37f7ae3f..5d442da127 100644
--- a/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
+++ b/tmf/org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/widgets/timegraph/widgets/TimeGraphTooltipHandler.java
@@ -25,6 +25,7 @@ import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.tracecompass.internal.tmf.ui.Messages;
+import org.eclipse.tracecompass.tmf.core.TmfStrings;
import org.eclipse.tracecompass.tmf.core.timestamp.TmfTimestamp;
import org.eclipse.tracecompass.tmf.ui.viewers.TmfAbstractToolTipHandler;
import org.eclipse.tracecompass.tmf.ui.views.FormatTimeUtils;
@@ -156,8 +157,8 @@ public class TimeGraphTooltipHandler extends TmfAbstractToolTipHandler {
if (duration == 0) {
addItem(ToolTipString.fromString(itemName), ToolTipString.fromString(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_Timestamp), ToolTipString.fromTimestamp(TmfTimestamp.fromNanos(timestamp).toString(), timestamp));
} else {
- addItem(ToolTipString.fromString(itemName), ToolTipString.fromString(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_StartTime), ToolTipString.fromTimestamp(TmfTimestamp.fromNanos(timestamp).toString(), timestamp));
- addItem(ToolTipString.fromString(itemName), ToolTipString.fromString(MARKER_OFFSET + Messages.TimeGraphTooltipHandler_EndTime), ToolTipString.fromTimestamp(TmfTimestamp.fromNanos(timestamp + duration).toString(), timestamp + duration));
+ addItem(ToolTipString.fromString(itemName), ToolTipString.fromString(MARKER_OFFSET + TmfStrings.startTime()), ToolTipString.fromTimestamp(TmfTimestamp.fromNanos(timestamp).toString(), timestamp));
+ addItem(ToolTipString.fromString(itemName), ToolTipString.fromString(MARKER_OFFSET + TmfStrings.endTime()), ToolTipString.fromTimestamp(TmfTimestamp.fromNanos(timestamp + duration).toString(), timestamp + duration));
}
if (toolTips != null) {
for (Entry<String, String> tooltip : toolTips.entrySet()) {

Back to the top