diff options
author | Benjamin Saint-Cyr | 2019-05-16 14:31:45 +0000 |
---|---|---|
committer | Matthew Khouzam | 2019-05-17 19:27:12 +0000 |
commit | ed1b6a732d0cd5321bd963592442b8c6641df481 (patch) | |
tree | 112f36b376f93d051d5dd1f24dbc3912d039b23b | |
parent | f13be681293d1c5780254f70f848d296de193d09 (diff) | |
download | org.eclipse.tracecompass-ed1b6a732d0cd5321bd963592442b8c6641df481.tar.gz org.eclipse.tracecompass-ed1b6a732d0cd5321bd963592442b8c6641df481.tar.xz org.eclipse.tracecompass-ed1b6a732d0cd5321bd963592442b8c6641df481.zip |
xml: fix bug 543741 integer entries are sorted numerically
Change-Id: Ia687f5dc48781c63a1e671e4b8dd19ef9f5aa070
Signed-off-by: Benjamin Saint-Cyr <benjamin.saint-cyr@polymtl.ca>
Reviewed-on: https://git.eclipse.org/r/142265
Tested-by: CI Bot
Reviewed-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Tested-by: Genevieve Bastien <gbastien+lttng@versatic.net>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
Tested-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
-rw-r--r-- | tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java index 167abcfb2a..37798db481 100644 --- a/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java +++ b/tmf/org.eclipse.tracecompass.tmf.analysis.xml.ui/src/org/eclipse/tracecompass/internal/tmf/analysis/xml/ui/views/timegraph/XmlTimeGraphView.java @@ -25,9 +25,9 @@ import org.eclipse.jdt.annotation.NonNull; import org.eclipse.jdt.annotation.Nullable; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.DataDrivenOutputEntryModel; import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.DataDrivenTimeGraphDataProvider; import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.XmlDataProviderManager; -import org.eclipse.tracecompass.internal.tmf.analysis.xml.core.output.DataDrivenOutputEntryModel; import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.Activator; import org.eclipse.tracecompass.internal.tmf.analysis.xml.ui.views.XmlViewInfo; import org.eclipse.tracecompass.tmf.analysis.xml.core.module.TmfXmlStrings; @@ -81,9 +81,19 @@ public class XmlTimeGraphView extends BaseDataProviderTimeGraphView { private static final String EMPTY_STRING = ""; //$NON-NLS-1$ - private static final Comparator<DataDrivenOutputEntryModel> XML_ENTRY_COMPARATOR = Comparator - .comparing(DataDrivenOutputEntryModel::getName).thenComparingLong(DataDrivenOutputEntryModel::getStartTime); - + private static final Comparator<DataDrivenOutputEntryModel> XML_ENTRY_COMPARATOR = ((DataDrivenOutputEntryModel obj1, DataDrivenOutputEntryModel obj2) -> { + try { + return Comparator + .comparing((DataDrivenOutputEntryModel obj) -> Long.decode(obj.getName())) + .thenComparingLong(DataDrivenOutputEntryModel::getStartTime) + .compare(obj1, obj2); + } catch (NumberFormatException nfe) { + return Comparator + .comparing(DataDrivenOutputEntryModel::getName) + .thenComparingLong(DataDrivenOutputEntryModel::getStartTime) + .compare(obj1, obj2); + } + }); private static final Comparator<ITimeGraphEntry> ENTRY_COMPARATOR = Comparator.comparing(x -> (DataDrivenOutputEntryModel) ((TimeGraphEntry) x).getModel(), XML_ENTRY_COMPARATOR); private final @NonNull XmlViewInfo fViewInfo = new XmlViewInfo(ID); |