diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog index cc2c793afbd..95f88a2e9c0 100644 --- a/debug/org.eclipse.cdt.debug.ui/ChangeLog +++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog @@ -1,3 +1,14 @@ +2004-04-08 Mikhail Khodjaiants + Added breakpoint images and implemented the extension points for breakpoint + marker annotations. + * plugin.xml + * BreakpointImageProvider.java: new + * CDebugImages.java + * CDebugModelPresentation.java + * CDTDebugModelPresentation.java + * icons/full/obj16/brkp_obj.gif: new + * icons/full/obj16/brkpd_obj.gif: new + 2004-04-07 Mikhail Khodjaiants Strings externalization fixes and reformatting. * CDebugUIMessages.properties diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/brkpi_obj.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/brkpi_obj.gif deleted file mode 100644 index afcf4b89103..00000000000 Binary files a/debug/org.eclipse.cdt.debug.ui/icons/full/obj16/brkpi_obj.gif and /dev/null differ diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml index 301b7c36edd..570d8bf2a02 100644 --- a/debug/org.eclipse.cdt.debug.ui/plugin.xml +++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml @@ -69,8 +69,8 @@ + id="org.eclipse.cdt.debug.ui.MemoryView" + relationship="stack"> @@ -78,8 +78,8 @@ + id="org.eclipse.cdt.debug.ui.SharedLibrariesView" + relationship="stack"> @@ -87,8 +87,8 @@ + id="org.eclipse.cdt.debug.ui.SignalsView" + relationship="stack"> @@ -294,8 +294,8 @@ @@ -720,8 +720,8 @@ label="%SignalAction.label" icon="icons/full/clcl16/signal_co.gif" helpContextId="signal_action_context" - class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate" tooltip="%SignalAction.tooltip" + class="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate" menubarPath="additions" enablesFor="1" id="org.eclipse.cdt.debug.internal.ui.actions.SignalActionDelegate"> @@ -736,8 +736,8 @@ label="%SignalPropertiesAction.label" style="pulldown" helpContextId="signal_properties_action_context" - class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate" tooltip="%SignalPropertiesAction.tooltip" + class="org.eclipse.cdt.debug.internal.ui.actions.SignalPropertiesActionDelegate" enablesFor="1" id="org.eclipse.cdt.debug.ui.SignalPropertiesAction"> @@ -773,8 +773,8 @@ @@ -789,8 +789,8 @@ label="%CastToTypeAction.label" icon="icons/full/clcl16/casttotype_co.gif" helpContextId="cast_to_type_action_context" - tooltip="%CastToTypeAction.tooltip" class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate" + tooltip="%CastToTypeAction.tooltip" menubarPath="additions" enablesFor="1" id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"> @@ -805,8 +805,8 @@ label="%CastToArrayAction.label" icon="icons/full/clcl16/showasarray_co.gif" helpContextId="cast_to_array_action_context" - tooltip="%CastToArrayAction.tooltip" class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate" + tooltip="%CastToArrayAction.tooltip" menubarPath="additions" enablesFor="1" id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"> @@ -825,8 +825,8 @@ label="%ManageFunctionBreakpointAction.label" icon="icons/full/obj16/funbrkp_obj.gif" helpContextId="manage_function_breakpoint_action_context" - tooltip="%ManageFunctionBreakpointAction.tooltip" class="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate" + tooltip="%ManageFunctionBreakpointAction.tooltip" menubarPath="additions" enablesFor="1" id="org.eclipse.cdt.debug.internal.ui.actions.ManageFunctionBreakpointActionDelegate"> @@ -845,8 +845,8 @@ label="%DisableVariablesAction.label" icon="icons/full/clcl16/disabled_co.gif" helpContextId="disable_variables_action_context" - tooltip="%DisableVariablesAction.tooltip" class="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate" + tooltip="%DisableVariablesAction.tooltip" menubarPath="variableGroup" enablesFor="2+" id="org.eclipse.cdt.debug.internal.ui.actions.DisableVariablesActionDelegate"> @@ -858,8 +858,8 @@ label="%EnableVariablesAction.label" icon="icons/full/clcl16/enabled_co.gif" helpContextId="enable_variables_action_context" - tooltip="%EnableVariablesAction.tooltip" class="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate" + tooltip="%EnableVariablesAction.tooltip" menubarPath="variableGroup" enablesFor="2+" id="org.eclipse.cdt.debug.internal.ui.actions.EnableVariablesActionDelegate"> @@ -882,8 +882,8 @@ disabledIcon="icons/full/dlcl16/restart.gif" enablesFor="1" icon="icons/full/elcl16/restart.gif" - helpContextId="restart_action_context" label="%RestartAction.label" + helpContextId="restart_action_context" tooltip="%RestartAction.tooltip"> @@ -941,11 +941,11 @@ id="org.eclipse.cdt.debug.ui.breakpointView.menu"> @@ -967,8 +967,8 @@ disabledIcon="icons/full/dlcl16/watch_globals.gif" enablesFor="1" icon="icons/full/elcl16/watch_globals.gif" - helpContextId="add_globals_action_context" label="%AddGlobalsAction.label" + helpContextId="add_globals_action_context" tooltip="%AddGlobalsAction.tooltip"> @@ -1019,7 +1019,7 @@ + id="org.eclipse.cdt.debug.ui.CDebugEditor.BreakpointRulerActions"> @@ -1151,16 +1151,16 @@ point="org.eclipse.ui.editors"> @@ -1182,8 +1182,8 @@ + id="org.eclipse.cdt.debug.ui.debugging" + parentId="org.eclipse.debug.ui.debugging"> + + + + + + + + diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java new file mode 100644 index 00000000000..5c8cbaad4ee --- /dev/null +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/BreakpointImageProvider.java @@ -0,0 +1,62 @@ +/********************************************************************** + * Copyright (c) 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation +***********************************************************************/ +package org.eclipse.cdt.debug.internal.ui; + +import org.eclipse.core.resources.IMarker; +import org.eclipse.debug.ui.DebugUITools; +import org.eclipse.debug.ui.IDebugModelPresentation; +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.text.source.Annotation; +import org.eclipse.swt.graphics.Image; +import org.eclipse.ui.texteditor.IAnnotationImageProvider; +import org.eclipse.ui.texteditor.MarkerAnnotation; + + +/** + * Provides breakpoint's image information. + */ +public class BreakpointImageProvider implements IAnnotationImageProvider { + + private IDebugModelPresentation fPresentation; + + /* (non-Javadoc) + * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getManagedImage(org.eclipse.jface.text.source.Annotation) + */ + public Image getManagedImage( Annotation annotation ) { + if ( annotation instanceof MarkerAnnotation ) { + MarkerAnnotation markerAnnotation = (MarkerAnnotation)annotation; + IMarker marker = markerAnnotation.getMarker(); + if ( marker != null && marker.exists() ) + return getPresentation().getImage( marker ); + } + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptorId(org.eclipse.jface.text.source.Annotation) + */ + public String getImageDescriptorId( Annotation annotation ) { + return null; + } + + /* (non-Javadoc) + * @see org.eclipse.ui.texteditor.IAnnotationImageProvider#getImageDescriptor(java.lang.String) + */ + public ImageDescriptor getImageDescriptor( String imageDescritporId ) { + return null; + } + + private IDebugModelPresentation getPresentation() { + if ( fPresentation == null ) + fPresentation = DebugUITools.newDebugModelPresentation(); + return fPresentation; + } +} diff --git a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java index 02cd7a5fc54..c42162d701a 100644 --- a/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java +++ b/debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDTDebugModelPresentation.java @@ -687,11 +687,11 @@ public class CDTDebugModelPresentation extends LabelProvider ImageDescriptor descriptor = null; if ( breakpoint.isEnabled() ) { - descriptor = DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_BREAKPOINT ); + descriptor = CDebugImages.DESC_OBJS_BREAKPOINT_ENABLED; } else { - descriptor = DebugUITools.getImageDescriptor( IDebugUIConstants.IMG_OBJS_BREAKPOINT_DISABLED ); + descriptor = CDebugImages.DESC_OBJS_BREAKPOINT_DISABLED; } return fImageCache.getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeBreakpointOverlays( breakpoint ) ) ); } 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 b933118fc02..28a58761f30 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 @@ -62,6 +62,8 @@ public class CDebugImages public static final String IMG_OVRS_SYMBOLS = NAME_PREFIX + "symbols_ovr.gif"; //$NON-NLS-1$ public static final String IMG_OVRS_VARIABLE_CASTED = NAME_PREFIX + "casttype_ovr.gif"; //$NON-NLS-1$ public static final String IMG_OVRS_ARGUMENT = NAME_PREFIX + "argument_ovr.gif"; //$NON-NLS-1$ + public static final String IMG_OBJS_BREAKPOINT_ENABLED = NAME_PREFIX + "brkp_obj.gif"; //$NON-NLS-1$ + public static final String IMG_OBJS_BREAKPOINT_DISABLED = NAME_PREFIX + "brkpd_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_ADDRESS_BREAKPOINT_ENABLED = NAME_PREFIX + "addrbrkp_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_ADDRESS_BREAKPOINT_DISABLED = NAME_PREFIX + "addrbrkpd_obj.gif"; //$NON-NLS-1$ public static final String IMG_OBJS_FUNCTION_BREAKPOINT_ENABLED = NAME_PREFIX + "funbrkp_obj.gif"; //$NON-NLS-1$ @@ -135,6 +137,8 @@ public class CDebugImages public static final ImageDescriptor DESC_OVRS_SYMBOLS = createManaged( T_OVR, IMG_OVRS_SYMBOLS ); public static final ImageDescriptor DESC_OVRS_VARIABLE_CASTED = createManaged( T_OVR, IMG_OVRS_VARIABLE_CASTED ); public static final ImageDescriptor DESC_OVRS_ARGUMENT = createManaged( T_OVR, IMG_OVRS_ARGUMENT ); + public static final ImageDescriptor DESC_OBJS_BREAKPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_BREAKPOINT_ENABLED ); + public static final ImageDescriptor DESC_OBJS_BREAKPOINT_DISABLED = createManaged( T_OBJ, IMG_OBJS_BREAKPOINT_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_READ_WATCHPOINT_ENABLED = createManaged( T_OBJ, IMG_OBJS_READ_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 abde725ebb6..c3edb6d7fc0 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 @@ -8,9 +8,15 @@ package org.eclipse.cdt.debug.internal.ui; import java.util.HashMap; +import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; +import org.eclipse.cdt.debug.core.model.ICBreakpoint; +import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; +import org.eclipse.cdt.debug.core.model.ICLineBreakpoint; import org.eclipse.cdt.debug.core.model.ICSharedLibrary; import org.eclipse.cdt.debug.core.model.ICSignal; +import org.eclipse.cdt.debug.core.model.ICWatchpoint; import org.eclipse.cdt.debug.ui.CDebugUIPlugin; +import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.debug.core.DebugException; @@ -97,6 +103,8 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode return getRegisterGroupImage( (IRegisterGroup)element ); if ( element instanceof ICSignal ) return getSignalImage( (ICSignal)element ); + if ( element instanceof ICBreakpoint ) + return getBreakpointImage( (ICBreakpoint)element ); return super.getImage( element ); } @@ -116,7 +124,53 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode protected Image getRegisterGroupImage( IRegisterGroup element ) { return fDebugImageRegistry.get( CDebugImages.DESC_OBJS_REGISTER_GROUP ); } - + + protected Image getBreakpointImage( ICBreakpoint breakpoint ) { + try { + if ( breakpoint instanceof ICLineBreakpoint ) { + return getLineBreakpointImage( (ICLineBreakpoint)breakpoint ); + } + if ( breakpoint instanceof ICWatchpoint ) { + return getWatchpointImage( (ICWatchpoint)breakpoint ); + } + } + catch( CoreException e ) { + } + return null; + } + + protected Image getLineBreakpointImage( ICLineBreakpoint breakpoint ) throws CoreException { + ImageDescriptor descriptor = null; + if ( breakpoint.isEnabled() ) { + descriptor = CDebugImages.DESC_OBJS_BREAKPOINT_ENABLED; + } + else { + descriptor = CDebugImages.DESC_OBJS_BREAKPOINT_DISABLED; + } + return getImageCache().getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeBreakpointOverlays( breakpoint ) ) ); + } + + protected Image getWatchpointImage( ICWatchpoint watchpoint ) throws CoreException { + ImageDescriptor descriptor = null; + if ( watchpoint.isEnabled() ) { + if ( watchpoint.isReadType() && !watchpoint.isWriteType() ) + descriptor = CDebugImages.DESC_OBJS_READ_WATCHPOINT_ENABLED; + else if ( !watchpoint.isReadType() && watchpoint.isWriteType() ) + descriptor = CDebugImages.DESC_OBJS_WRITE_WATCHPOINT_ENABLED; + else + descriptor = CDebugImages.DESC_OBJS_WATCHPOINT_ENABLED; + } + else { + if ( watchpoint.isReadType() && !watchpoint.isWriteType() ) + descriptor = CDebugImages.DESC_OBJS_READ_WATCHPOINT_DISABLED; + else if ( !watchpoint.isReadType() && watchpoint.isWriteType() ) + descriptor = CDebugImages.DESC_OBJS_WRITE_WATCHPOINT_DISABLED; + else + descriptor = CDebugImages.DESC_OBJS_WATCHPOINT_DISABLED; + } + return fImageCache.getImageFor( new OverlayImageDescriptor( fDebugImageRegistry.get( descriptor ), computeBreakpointOverlays( watchpoint ) ) ); + } + public String getText( Object element ) { StringBuffer baseText = new StringBuffer( getBaseText( element ) ); return baseText.toString(); @@ -202,4 +256,26 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode protected Image getDefaultImage(Object element) { return DebugUIPlugin.getDefaultLabelProvider().getImage( element ); } + + private ImageDescriptor[] computeBreakpointOverlays( ICBreakpoint breakpoint ) { + ImageDescriptor[] overlays = new ImageDescriptor[]{ null, null, null, null }; + try { + if ( breakpoint.isConditional() ) { + overlays[OverlayImageDescriptor.TOP_LEFT] = (breakpoint.isEnabled()) ? CDebugImages.DESC_OVRS_BREAKPOINT_CONDITIONAL : CDebugImages.DESC_OVRS_BREAKPOINT_CONDITIONAL_DISABLED; + } + if ( breakpoint.isInstalled() ) { + overlays[OverlayImageDescriptor.BOTTOM_LEFT] = (breakpoint.isEnabled()) ? CDebugImages.DESC_OVRS_BREAKPOINT_INSTALLED : CDebugImages.DESC_OVRS_BREAKPOINT_INSTALLED_DISABLED; + } + if ( breakpoint instanceof ICAddressBreakpoint ) { + overlays[OverlayImageDescriptor.TOP_RIGHT] = (breakpoint.isEnabled()) ? CDebugImages.DESC_OVRS_ADDRESS_BREAKPOINT : CDebugImages.DESC_OVRS_ADDRESS_BREAKPOINT_DISABLED; + } + if ( breakpoint instanceof ICFunctionBreakpoint ) { + overlays[OverlayImageDescriptor.TOP_RIGHT] = (breakpoint.isEnabled()) ? CDebugImages.DESC_OVRS_FUNCTION_BREAKPOINT : CDebugImages.DESC_OVRS_FUNCTION_BREAKPOINT_DISABLED; + } + } + catch( CoreException e ) { + CDebugUIPlugin.log( e ); + } + return overlays; + } }