1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 01:36:01 +02:00

- allow custom breakpoints use ILabelProvider since IElementLabelProvider does not work for breakpoints

This commit is contained in:
Alena Laskavaia 2008-04-25 15:59:57 +00:00
parent 12af9151f7
commit b0e84b146c

View file

@ -63,6 +63,7 @@ import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path; import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint; import org.eclipse.debug.core.model.IBreakpoint;
@ -83,6 +84,7 @@ import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IValueDetailListener; import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image; import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorDescriptor; import org.eclipse.ui.IEditorDescriptor;
@ -293,6 +295,12 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
} }
protected Image getBreakpointImage( ICBreakpoint breakpoint ) { protected Image getBreakpointImage( ICBreakpoint breakpoint ) {
// if adapter installed for breakpoint, call the adapter
ILabelProvider adapter = (ILabelProvider) Platform.getAdapterManager().getAdapter(breakpoint, ILabelProvider.class);
if (adapter!=null) {
Image image = adapter.getImage(breakpoint);
if (image!=null) return image;
}
try { try {
if ( breakpoint instanceof ICLineBreakpoint ) { if ( breakpoint instanceof ICLineBreakpoint ) {
return getLineBreakpointImage( (ICLineBreakpoint)breakpoint ); return getLineBreakpointImage( (ICLineBreakpoint)breakpoint );
@ -387,6 +395,12 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
return null; return null;
} }
if ( element instanceof IBreakpoint ) { if ( element instanceof IBreakpoint ) {
// if adapter installed for breakpoint, call adapter
ILabelProvider adapter = (ILabelProvider) Platform.getAdapterManager().getAdapter(element, ILabelProvider.class);
if (adapter!=null) {
String text = adapter.getText(element);
if (text!=null) return text;
}
return CDebugUtils.getBreakpointText( (IBreakpoint)element, showQualified ); return CDebugUtils.getBreakpointText( (IBreakpoint)element, showQualified );
} }
if ( element instanceof IDebugTarget ) if ( element instanceof IDebugTarget )