diff --git a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java index 0e593ad..52039b2 100644 --- a/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java +++ b/src/org/ntlab/traceDebugger/analyzerProvider/DeltaMarkerManager.java @@ -2,6 +2,7 @@ import java.util.ArrayList; import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,7 +43,7 @@ public class DeltaMarkerManager { private Map> markerIdToMarkers = new HashMap<>(); - private List markersByOrder = new ArrayList<>(); + private List orderedMarkers = new ArrayList<>(); private MethodExecution coordinator; private TracePoint relatedPoint; private Reference relatedPointReference; @@ -68,7 +69,7 @@ } public List getMarkersByOrder() { - return markersByOrder; + return orderedMarkers; } public TreeNode[] getMarkerTreeNodes() { @@ -104,7 +105,7 @@ public IMarker getCoordinatorDeltaMarker() { List markers = markerIdToMarkers.get(COORDINATOR_DELTA_MARKER); if (markers == null || markers.isEmpty()) return null; - return markers.get(0); + return markers.get(0); } public IMarker getBottomDeltaMarker() { @@ -169,6 +170,31 @@ } msg = TraceDebuggerPlugin.isJapanese() ? "�Q�Ǝ��_" : "RelatedPoint"; markAndOpenJavaFileForCreationPoint(relatedPoint, relatedPointReference, msg, DeltaMarkerManager.BOTTOM_DELTA_MARKER); + createMarkerListOrdered(); + } + + private void createMarkerListOrdered() { + orderedMarkers.clear(); + IMarker coordinatorMarker = getCoordinatorDeltaMarker(); + if (coordinatorMarker != null) orderedMarkers.add(coordinatorMarker); + List aliasMarkers = new ArrayList<>(); + List srcSideMarkers = markerIdToMarkers.get(SRC_SIDE_DELTA_MARKER); + if (srcSideMarkers != null) aliasMarkers.addAll(srcSideMarkers); + List dstSideMarkers = markerIdToMarkers.get(DST_SIDE_DELTA_MARKER); + if (dstSideMarkers != null) aliasMarkers.addAll(dstSideMarkers); + Collections.sort(aliasMarkers, new Comparator() { + @Override + public int compare(IMarker o1, IMarker o2) { + TracePoint tp1 = DeltaMarkerManager.getTracePoint(o1); + TracePoint tp2 = DeltaMarkerManager.getTracePoint(o2); + long time1 = tp1.getMethodExecution().getEntryTime(); + long time2 = tp2.getMethodExecution().getEntryTime(); + return (time1 < time2) ? -1 : 1; + } + }); + orderedMarkers.addAll(aliasMarkers); + IMarker bottomMarker = getBottomDeltaMarker(); + if (bottomMarker != null) orderedMarkers.add(bottomMarker); } private void markAndOpenJavaFileForAlias(Alias alias, String message, String markerId) { @@ -271,7 +297,7 @@ markerIdToMarkers.put(markerId, markerList); } markerList.add(marker); - markersByOrder.add(marker); +// orderedMarkers.add(marker); } private void setAttributesForAlias(final Map attributes, Alias alias, IFile file, String markerId) { @@ -997,6 +1023,6 @@ deleteMarkers(markerList); } markerIdToMarkers.clear(); - markersByOrder.clear(); + orderedMarkers.clear(); } }