Skip to content

Commit 647048f

Browse files
SougandhSiloveeclipse
authored andcommitted
Add grouping for breakpoints by Enablement
This commit adds a new grouping option in the Debug view to organize breakpoints based on whether they are enabled or disabled. Enabled breakpoints are shown at the top, followed by disabled ones. This helps users quickly find and manage breakpoints without excessive scrolling.
1 parent cac5175 commit 647048f

File tree

7 files changed

+138
-4
lines changed

7 files changed

+138
-4
lines changed

debug/org.eclipse.debug.ui/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.debug.ui; singleton:=true
5-
Bundle-Version: 3.18.900.qualifier
5+
Bundle-Version: 3.19.0.qualifier
66
Bundle-Activator: org.eclipse.debug.internal.ui.DebugUIPlugin
77
Bundle-Vendor: %providerName
88
Bundle-Localization: plugin
Lines changed: 15 additions & 0 deletions
Loading

debug/org.eclipse.debug.ui/plugin.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ BreakpointWorkingSet.name=Breakpoint
356356
BreakpointWorkingSet.description=Breakpoint workingsets contain listings of workspace breakpoints
357357
memoryRenderingsExtensionPointName = Memory Renderings
358358
TableRenderingPrefActionName = &Table Renderings Preferences...
359-
359+
BreakpointEnablement.label=Enablement
360360

361361
NewMemoryViewAction.label=&New Memory View
362362
NewMemoryViewAction.tooltip=New Memory View

debug/org.eclipse.debug.ui/plugin.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,11 @@ M4 = Platform-specific fourth key
30443044
class="org.eclipse.debug.internal.ui.views.breakpoints.WorkingSetBreakpointOrganizer"
30453045
icon="$nl$/icons/full/obj16/fldr_obj.svg"
30463046
id="org.eclipse.debug.ui.workingSetOrganizer"/>
3047+
<breakpointOrganizer
3048+
label="%BreakpointEnablement.label"
3049+
class="org.eclipse.debug.internal.ui.views.breakpoints.BreakpointEnablement"
3050+
icon="$nl$/icons/full/obj16/brkp_grp4.svg"
3051+
id="org.eclipse.debug.ui.breakpointEnablement"/>
30473052
<breakpointOrganizer
30483053
othersLabel="%BreakpointType.others"
30493054
label="%BreakpointType.label"
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 IBM Corporation and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
* Contributors:
12+
* IBM Corporation - initial API and implementation
13+
*******************************************************************************/
14+
package org.eclipse.debug.internal.ui.views.breakpoints;
15+
16+
import org.eclipse.core.resources.IMarkerDelta;
17+
import org.eclipse.core.runtime.CoreException;
18+
import org.eclipse.core.runtime.IAdaptable;
19+
import org.eclipse.debug.core.DebugPlugin;
20+
import org.eclipse.debug.core.IBreakpointListener;
21+
import org.eclipse.debug.core.model.IBreakpoint;
22+
import org.eclipse.debug.ui.AbstractBreakpointOrganizerDelegate;
23+
import org.eclipse.debug.ui.BreakpointTypeCategory;
24+
25+
/**
26+
* Breakpoint organizers for breakpoint types.
27+
*
28+
* @since 3.1
29+
*/
30+
public class BreakpointEnablement extends AbstractBreakpointOrganizerDelegate implements IBreakpointListener {
31+
private final BreakpointTypeCategory ENABLED = new BreakpointTypeCategory("Enabled", true, 0); //$NON-NLS-1$
32+
private final BreakpointTypeCategory DISABLED = new BreakpointTypeCategory("Disabled", true, 1); //$NON-NLS-1$
33+
34+
public BreakpointEnablement() {
35+
DebugPlugin.getDefault().getBreakpointManager().addBreakpointListener(this);
36+
}
37+
38+
@Override
39+
public IAdaptable[] getCategories(IBreakpoint breakpoint) {
40+
try {
41+
IAdaptable[] categories;
42+
if (breakpoint.isEnabled()) {
43+
categories = new IAdaptable[] { ENABLED };
44+
} else {
45+
categories = new IAdaptable[] { DISABLED };
46+
}
47+
return categories;
48+
} catch (CoreException e) {
49+
DebugPlugin.log(e);
50+
}
51+
return null;
52+
}
53+
54+
@Override
55+
public void dispose() {
56+
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this);
57+
}
58+
59+
60+
@Override
61+
public void breakpointAdded(IBreakpoint breakpoint) {
62+
}
63+
64+
@Override
65+
public void breakpointRemoved(IBreakpoint breakpoint, IMarkerDelta delta) {
66+
}
67+
68+
@Override
69+
public void breakpointChanged(IBreakpoint breakpoint, IMarkerDelta delta) {
70+
fireCategoryChanged(ENABLED);
71+
}
72+
}

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/breakpoints/ElementComparator.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*****************************************************************
2-
* Copyright (c) 2009, 2016 Texas Instruments and others
2+
* Copyright (c) 2009, 2025 Texas Instruments and others
33
*
44
* This program and the accompanying materials
55
* are made available under the terms of the Eclipse Public License 2.0
@@ -29,6 +29,7 @@
2929
import org.eclipse.debug.internal.ui.breakpoints.provisional.OtherBreakpointCategory;
3030
import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
3131
import org.eclipse.debug.internal.ui.views.DebugModelPresentationContext;
32+
import org.eclipse.debug.ui.BreakpointTypeCategory;
3233

3334
/**
3435
* Breakpoint element comparator.
@@ -74,6 +75,12 @@ private int doCompare(IBreakpointContainer c1, IBreakpointContainer c2) {
7475
return -1;
7576
}
7677

78+
if (c1.getCategory() instanceof BreakpointTypeCategory breakType1 && breakType1.hasSortOrder()) {
79+
if (c2.getCategory() instanceof BreakpointTypeCategory breakType2 && breakType2.hasSortOrder() ) {
80+
return Integer.compare(breakType1.getOrder(), breakType2.getOrder());
81+
}
82+
}
83+
7784
// Rest of categories should be listed alphabetically.
7885
if (fContext != null) {
7986
String name1 = fContext.getModelPresentation().getText(c1);

debug/org.eclipse.debug.ui/ui/org/eclipse/debug/ui/BreakpointTypeCategory.java

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public class BreakpointTypeCategory extends PlatformObject implements IBreakpoin
3131

3232
private final String fName;
3333
private ImageDescriptor fImageDescriptor = DebugPluginImages.getImageDescriptor(IInternalDebugUIConstants.IMG_OBJS_BREAKPOINT_TYPE);
34-
34+
private boolean fSortOrder;
35+
private int fOrder;
3536
/**
3637
* Constructs a type category for the given type name.
3738
*
@@ -55,6 +56,21 @@ public BreakpointTypeCategory(String name, ImageDescriptor descriptor) {
5556
}
5657
}
5758

59+
/**
60+
* Constructs a type category for the given type name with the given attributes
61+
* for sorting order.
62+
*
63+
* @param name breakpoint type name
64+
* @param sortOrder to sort order or not
65+
* @param order order of the group
66+
* @since 3.19
67+
*/
68+
public BreakpointTypeCategory(String name, boolean sortOrder, int order) {
69+
fName = name;
70+
fSortOrder = sortOrder;
71+
fOrder = order;
72+
}
73+
5874
/**
5975
* Returns the name of this category's breakpoint type.
6076
*
@@ -64,6 +80,15 @@ protected String getName() {
6480
return fName;
6581
}
6682

83+
/**
84+
* Returns the order of this category's placement.
85+
*
86+
* @return the order of this category's placement.
87+
* @since 3.19
88+
*/
89+
public int getOrder() {
90+
return fOrder;
91+
}
6792
@Override
6893
public boolean equals(Object object) {
6994
if (object instanceof BreakpointTypeCategory type) {
@@ -72,6 +97,16 @@ public boolean equals(Object object) {
7297
return false;
7398
}
7499

100+
/**
101+
* Returns whether category should follow a sorting order or not.
102+
*
103+
* @return whether category should be sorted or not.
104+
* @since 3.19
105+
*/
106+
public boolean hasSortOrder() {
107+
return fSortOrder;
108+
}
109+
75110
@Override
76111
public int hashCode() {
77112
return getName().hashCode();

0 commit comments

Comments
 (0)