Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorAnton Backstrom2020-02-20 12:21:08 +0000
committerJonah Graham2020-03-02 11:59:30 +0000
commita41ea21383d122e71c138a503549c4d39789598c (patch)
treea40b9087054e8ae3e04f4fc1286a42240a46bcd0 /debug
parent5a6b9b4bf4b2d2ee60f2bc3f520abd01e7527dda (diff)
downloadorg.eclipse.cdt-a41ea21383d122e71c138a503549c4d39789598c.tar.gz
org.eclipse.cdt-a41ea21383d122e71c138a503549c4d39789598c.tar.xz
org.eclipse.cdt-a41ea21383d122e71c138a503549c4d39789598c.zip
bug 560275 - Move watchpoint type check into labelprovider adapter
This makes it possible for a user to subclass CBreakpointPropertyPage and use their own adapter to decide the breakpoint label for watchpoints. Change-Id: I086179c6b5561b77410fd2a6f7d77bb6084d94d4 Signed-off-by: Anton Backstrom <anton.backstrom@gaisler.com>
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java21
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java14
2 files changed, 18 insertions, 17 deletions
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
index 65dfd80d2c3..ca1b5e13df1 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointContext.java
@@ -184,8 +184,8 @@ class CBreakpointContextWorkbenchAdapter implements IWorkbenchAdapter {
@Override
public String getLabel(Object o) {
if (o instanceof ICBreakpointContext) {
- ICBreakpoint bp = ((ICBreakpointContext) o).getBreakpoint();
- return getBreakpointMainLabel(bp);
+ ICBreakpointContext context = (ICBreakpointContext) o;
+ return getBreakpointMainLabel(context.getBreakpoint(), context);
}
return ""; //$NON-NLS-1$
}
@@ -205,7 +205,7 @@ class CBreakpointContextWorkbenchAdapter implements IWorkbenchAdapter {
return null;
}
- private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
+ private String getBreakpointMainLabel(ICBreakpoint breakpoint, ICBreakpointContext o) {
if (breakpoint instanceof ICFunctionBreakpoint) {
if (breakpoint instanceof ICTracepoint) {
return BreakpointsMessages.getString("TracepointPropertyPage.tracepointType_function_label"); //$NON-NLS-1$
@@ -233,6 +233,21 @@ class CBreakpointContextWorkbenchAdapter implements IWorkbenchAdapter {
} else if (breakpoint instanceof ICEventBreakpoint) {
return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_event_label"); //$NON-NLS-1$
} else if (breakpoint instanceof ICWatchpoint) {
+ if (breakpoint.getMarker() != null) {
+ // For an existing breakpoint, calculate watchpoint label based
+ // on read/write type.
+ boolean isReadType = o.getPreferenceStore().getBoolean(ICWatchpoint.READ);
+ boolean isWriteType = o.getPreferenceStore().getBoolean(ICWatchpoint.WRITE);
+ if (isReadType && !isWriteType) {
+ return BreakpointsMessages
+ .getString("CBreakpointPropertyPage.breakpointType_watchpoint_read_label"); //$NON-NLS-1$
+ } else if (!isReadType && isWriteType) {
+ return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
+ } else {
+ return BreakpointsMessages
+ .getString("CBreakpointPropertyPage.breakpointType_watchpoint_access_label"); //$NON-NLS-1$
+ }
+ }
return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
}
// default main label is the label of marker type for the breakpoint
diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
index 7a4591690db..ec2ef128755 100644
--- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
+++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/breakpoints/CBreakpointPropertyPage.java
@@ -650,20 +650,6 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
}
private String getBreakpointMainLabel(ICBreakpoint breakpoint) {
- if (breakpoint instanceof ICWatchpoint && breakpoint.getMarker() != null) {
- // For an existing breakpoint, calculate watchpoint label based
- // on read/write type.
- boolean isReadType = getPreferenceStore().getBoolean(ICWatchpoint.READ);
- boolean isWriteType = getPreferenceStore().getBoolean(ICWatchpoint.WRITE);
- if (isReadType && !isWriteType) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_read_label"); //$NON-NLS-1$
- } else if (!isReadType && isWriteType) {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_label"); //$NON-NLS-1$
- } else {
- return BreakpointsMessages.getString("CBreakpointPropertyPage.breakpointType_watchpoint_access_label"); //$NON-NLS-1$
- }
- }
-
IWorkbenchAdapter labelProvider = getElement().getAdapter(IWorkbenchAdapter.class);
if (labelProvider != null) {
return labelProvider.getLabel(getElement());

Back to the top