Skip to main content
summaryrefslogtreecommitdiffstats
path: root/debug
diff options
context:
space:
mode:
authorRandy Rohrbach2013-01-25 14:25:26 -0500
committerRandy Rohrbach2013-01-28 15:48:37 -0500
commit1c88eba5239c31cdc5ae94a3f11e894227bf0689 (patch)
tree19664e28595f377a0a88d1e5617ef944867f7f3c /debug
parentf0b7098f0098427e5ce2e42ecd8f8d54173328aa (diff)
downloadorg.eclipse.cdt-1c88eba5239c31cdc5ae94a3f11e894227bf0689.tar.gz
org.eclipse.cdt-1c88eba5239c31cdc5ae94a3f11e894227bf0689.tar.xz
org.eclipse.cdt-1c88eba5239c31cdc5ae94a3f11e894227bf0689.zip
Bug 399119 - The CDT Model presentation does not support editor and color
customization for breakpoints.
Diffstat (limited to 'debug')
-rw-r--r--debug/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/internal/ui/CDebugModelPresentation.java45
1 files changed, 43 insertions, 2 deletions
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 e75c80e840..b9904b6cd3 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
@@ -89,10 +89,13 @@ import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.debug.ui.DebugUITools;
import org.eclipse.debug.ui.IDebugModelPresentation;
import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.debug.ui.ISourcePresentation;
import org.eclipse.debug.ui.IValueDetailListener;
import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.IColorProvider;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
@@ -105,7 +108,7 @@ import com.ibm.icu.text.MessageFormat;
/**
* @see IDebugModelPresentation
*/
-public class CDebugModelPresentation extends LabelProvider implements IDebugModelPresentation {
+public class CDebugModelPresentation extends LabelProvider implements IDebugModelPresentation, IColorProvider {
public final static String DISPLAY_FULL_PATHS = "DISPLAY_FULL_PATHS"; //$NON-NLS-1$
@@ -194,6 +197,14 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
}
if ( file != null )
return new FileEditorInput( file );
+ // There is no file associated with this breakpoint. See if another editor is available from an adapter
+ ISourcePresentation srcPres = (ISourcePresentation) Platform.getAdapterManager().getAdapter(b, ISourcePresentation.class);
+ if ( srcPres != null ) {
+ IEditorInput editor = srcPres.getEditorInput(b);
+ if ( editor != null ) {
+ return editor;
+ }
+ }
}
if ( element instanceof FileStorage || element instanceof LocalFileStorage ) {
return new ExternalEditorInput( ((IStorage) element).getFullPath() );
@@ -220,7 +231,20 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
if ( input != null ) {
IEditorRegistry registry = PlatformUI.getWorkbench().getEditorRegistry();
IEditorDescriptor descriptor = registry.getDefaultEditor( input.getName() );
- id = (descriptor != null) ? descriptor.getId() : CUIPlugin.EDITOR_ID;
+ id = CUIPlugin.EDITOR_ID;
+ if ( descriptor != null ) {
+ id = descriptor.getId();
+ }
+ else if ( element instanceof ICBreakpoint ) {
+ // There is no associated editor ID for this breakpoint, see if an alternative can be supplied from an adapter.
+ ISourcePresentation sourcePres = (ISourcePresentation) Platform.getAdapterManager().getAdapter(element, ISourcePresentation.class);
+ if ( sourcePres != null ) {
+ String lid = sourcePres.getEditorId(input, element);
+ if ( lid != null ) {
+ id = lid;
+ }
+ }
+ }
}
return id;
}
@@ -797,4 +821,21 @@ public class CDebugModelPresentation extends LabelProvider implements IDebugMode
return MessageFormat.format( string, (Object[]) args );
}
+ @Override
+ public Color getForeground(Object element) {
+ IColorProvider colorProv = (IColorProvider) Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
+ if ( colorProv != null ) {
+ return colorProv.getForeground(element);
+ }
+ return null;
+ }
+
+ @Override
+ public Color getBackground(Object element) {
+ IColorProvider colorProv = (IColorProvider) Platform.getAdapterManager().getAdapter(element, IColorProvider.class);
+ if ( colorProv != null ) {
+ return colorProv.getBackground(element);
+ }
+ return null;
+ }
}

Back to the top