diff --git a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java index 22dba3a1a59..77e12699cea 100644 --- a/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java +++ b/debug/org.eclipse.debug.tests/src/org/eclipse/debug/tests/breakpoint/BreakpointOrderingTests.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -23,6 +23,8 @@ import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.core.model.IValue; +import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.debug.internal.ui.views.breakpoints.BreakpointsComparator; import org.eclipse.debug.tests.DebugTestExtension; import org.eclipse.debug.ui.IDebugModelPresentation; @@ -283,6 +285,8 @@ public void testBreakpointOrdering3() throws CoreException { * Expecting the same ordering as in which the BP's are returned by createTestBreakpoints. */ void executeTest(TestBreakpoint[] testBps) throws CoreException { + int origSort = DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER); + DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER, IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_NAME); BreakpointsComparator bpCompare = new BreakpointsComparator(); try { boolean failed = false; @@ -305,6 +309,7 @@ void executeTest(TestBreakpoint[] testBps) throws CoreException { } assertFalse(failed); } finally { + DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER, origSort); for (TestBreakpoint testBp : testBps) { testBp.delete(); } diff --git a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java index e70528ce8ed..2d8de341f94 100644 --- a/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java +++ b/debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/BreakpointsComparator.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2026 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -24,6 +24,7 @@ import org.eclipse.debug.core.model.ILineBreakpoint; import org.eclipse.debug.internal.core.IInternalDebugCoreConstants; import org.eclipse.debug.internal.ui.DebugUIPlugin; +import org.eclipse.debug.internal.ui.IInternalDebugUIConstants; import org.eclipse.jface.viewers.IBasicPropertyConstants; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.StructuredViewer; @@ -64,6 +65,27 @@ public int compare(Viewer viewer, Object e1, Object e2) { } IBreakpoint b2= (IBreakpoint)e2; + IMarker marker1= b1.getMarker(); + IMarker marker2= b2.getMarker(); + if (!marker1.exists() || !marker2.exists()) { + return 0; + } + + int sortingOrder= DebugUIPlugin.getDefault().getPreferenceStore().getInt(IInternalDebugUIConstants.PREF_BREAKPOINT_SORTING_ORDER); + if (sortingOrder == IInternalDebugUIConstants.BREAKPOINT_SORTING_ORDER_CREATION_TIME) { + try { + long b1CreationTime = marker1.getCreationTime(); + long b2CreationTime = marker2.getCreationTime(); + if (b1CreationTime > b2CreationTime) { + return -1; + } else if (b1CreationTime < b2CreationTime) { + return 1; + } + } catch (CoreException e) { + DebugUIPlugin.log(e); + } + } + String modelId1= b1.getModelIdentifier(); String modelId2= b2.getModelIdentifier(); int result= modelId1.compareTo(modelId2); @@ -72,20 +94,12 @@ public int compare(Viewer viewer, Object e1, Object e2) { } String type1= IInternalDebugCoreConstants.EMPTY_STRING; String type2= IInternalDebugCoreConstants.EMPTY_STRING; - IMarker marker1= b1.getMarker(); - if (!marker1.exists()) { - return 0; - } try { type1= marker1.getType(); } catch (CoreException ce) { DebugUIPlugin.log(ce); } try { - IMarker marker2= b2.getMarker(); - if (!marker2.exists()) { - return 0; - } type2= marker2.getType(); } catch (CoreException e) { DebugUIPlugin.log(e);