From f223513d5f51e12361b18c5b645a483064d16599 Mon Sep 17 00:00:00 2001 From: John Cortell Date: Mon, 12 Apr 2010 21:09:46 +0000 Subject: [PATCH] [308933] Event breakpoints icons lack decorators --- .../icons/obj16/eventbreakpointd_obj.gif | Bin 226 -> 923 bytes .../cdt/debug/internal/ui/CDebugImages.java | 4 +++ .../internal/ui/CDebugModelPresentation.java | 10 +++++++ ...CEventBreakpointsLabelProviderFactory.java | 25 +++++++++--------- 4 files changed, 26 insertions(+), 13 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.ui/icons/obj16/eventbreakpointd_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/obj16/eventbreakpointd_obj.gif index 4a04deca138d692281e0604575e955d6c0c954d1..351c43e5658233fdbaf68ab97fc68cae7f5afcd1 100644 GIT binary patch literal 923 zcmah|Ur1A76hFKBcPBFDSJO>IHjoes8{&iI7)w#-gE1*;4?g5d)F3y?+MEj0)QQyG z6_nmVqt15~w z)X6{wE`agz7o(%k=I0k@XXkA8wwYJ{-oF0F?t$>9&+`k5`DSm8bF$g{CiEpbzznXl z?8@ruq|X5ROXk$V}@Pb82I4e6i(qKFg5Ppnb#-fN%~@px{+;OSp))k&whDix+W97H2?`@iCk|Ggj9CZ15^v={XuZ(MVh^%C$^f z$cTK2;UUJvQ0Hm;{WtVb@&`fnMZ5q2 delta 138 zcmbQu{)mys-P6s&GEsm*fT2ZnB2Qwe;y*#>qSVBa)D(sC%#sWRcTe8{2F0H&j0_C& z3_1)z08-1q>h(aqFU8Z$YuAkBU0s(9Jl=YVT@JaDI>p^a=z$~S7Lo4j#}z#+yfmhs p2+)v-P<2sgI53TaWqkyXrHsPk^AA5-EaANRL4wI`xwj&NH2_HmEqMR{ diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java index b5c48949486..028775f5885 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugImages.java @@ -79,6 +79,8 @@ public class CDebugImages { public static final String IMG_OBJS_TRACEPOINT_DISABLED = NAME_PREFIX + "trcpd_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_WATCHPOINT_ENABLED = NAME_PREFIX + "readwrite_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_WATCHPOINT_DISABLED = NAME_PREFIX + "readwrite_obj_disabled.gif"; //$NON-NLS-1$ + public static final String IMG_OBJS_EVENTBREAKPOINT_ENABLED = NAME_PREFIX + "eventbreakpoint_obj.gif"; //$NON-NLS-1$ + public static final String IMG_OBJS_EVENTBREAKPOINT_DISABLED = NAME_PREFIX + "eventbreakpointd_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_READ_WATCHPOINT_ENABLED = NAME_PREFIX + "read_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_READ_WATCHPOINT_DISABLED = NAME_PREFIX + "read_obj_disabled.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_WRITE_WATCHPOINT_ENABLED = NAME_PREFIX + "write_obj.gif"; //$NON-NLS-1$ @@ -161,6 +163,8 @@ public class CDebugImages { public static final ImageDescriptor DESC_OBJS_TRACEPOINT_DISABLED = createManaged( T_DLCL, IMG_OBJS_TRACEPOINT_DISABLED ); public static final ImageDescriptor DESC_OBJS_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_WATCHPOINT_ENABLED ); public static final ImageDescriptor DESC_OBJS_WATCHPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_WATCHPOINT_DISABLED ); + public static final ImageDescriptor DESC_OBJS_EVENTBREAKPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_EVENTBREAKPOINT_ENABLED ); + public static final ImageDescriptor DESC_OBJS_EVENTBREAKPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_EVENTBREAKPOINT_DISABLED ); public static final ImageDescriptor DESC_OBJS_READ_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_READ_WATCHPOINT_ENABLED ); public static final ImageDescriptor DESC_OBJS_READ_WATCHPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_READ_WATCHPOINT_DISABLED ); public static final ImageDescriptor DESC_OBJS_WRITE_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_WRITE_WATCHPOINT_ENABLED ); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java index 5dfdf61c217..5355ae3e700 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java @@ -38,6 +38,7 @@ import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICDebugElement; import org.eclipse.cdt.debug.core.model.ICDebugElementStatus; import org.eclipse.cdt.debug.core.model.ICDebugTarget; +import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICGlobalVariable; import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; @@ -332,6 +333,10 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode if ( breakpoint instanceof ICWatchpoint ) { return getWatchpointImage( (ICWatchpoint)breakpoint ); } + if ( breakpoint instanceof ICEventBreakpoint ) { + return getEventBreakpointImage( (ICEventBreakpoint)breakpoint ); + } + } catch( CoreException e ) { } @@ -381,6 +386,11 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeOverlays( watchpoint ) ) ); } + protected Image getEventBreakpointImage( ICEventBreakpoint evtBreakpoint ) throws CoreException { + ImageDescriptor descriptor = evtBreakpoint.isEnabled() ? CDebugImages.DESC_OBJS_EVENTBREAKPOINT_ENABLED : CDebugImages.DESC_OBJS_EVENTBREAKPOINT_DISABLED; + return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeOverlays( evtBreakpoint ) ) ); + } + @Override public String getText( Object element ) { String bt = getBaseText( element ); diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java index b8b1db1b245..f3f58b10c41 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/breakpoints/CEventBreakpointsLabelProviderFactory.java @@ -15,6 +15,7 @@ package org.eclipse.cdt.debug.ui.breakpoints; import org.eclipse.cdt.debug.core.DebugCoreMessages; import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICEventBreakpoint; +import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IAdapterFactory; @@ -30,8 +31,6 @@ import com.ibm.icu.text.MessageFormat; * Factory for event breakpoint label provider */ public class CEventBreakpointsLabelProviderFactory implements IAdapterFactory { - public static final String IMG_OBJS_EVENTBREAKPOINT_ENABLED = "icons/obj16/eventbreakpoint_obj.gif"; //$NON-NLS-1$ - public static final String IMG_OBJS_EVENTBREAKPOINT_DISABLED = "icons/obj16/eventbreakpointd_obj.gif"; //$NON-NLS-1$ private static ILabelProvider fLabelProvider = new LabelProvider() { @Override public String getText(Object element) { @@ -75,19 +74,19 @@ public class CEventBreakpointsLabelProviderFactory implements IAdapterFactory { return null; } + /** + * Returns null. We do not provide the image because it would require + * duplicating centralized code in {@link CDebugModelPresentation}, + * particularly the code that determines the proper overlays. This + * adapter is actually only called from within CDebugModelPresentation + * and we know it will do the right thing for an event breakpoint if we + * return null here. + * + * @see org.eclipse.jface.viewers.LabelProvider#getImage(java.lang.Object) + */ @Override public Image getImage(Object element) { - try { - if (element instanceof ICEventBreakpoint) { - ICEventBreakpoint eventBkpt = (ICEventBreakpoint) element; - if (eventBkpt.isEnabled()) - return CDebugUIPlugin.getDefault().getImage(IMG_OBJS_EVENTBREAKPOINT_ENABLED); - else - return CDebugUIPlugin.getDefault().getImage(IMG_OBJS_EVENTBREAKPOINT_DISABLED); - } - } catch (CoreException e) { - CDebugUIPlugin.log(e); - } + return null; } };