diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java')
-rw-r--r-- | org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java | 228 |
1 files changed, 114 insertions, 114 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java index 8bf88af20..cdc78ef3b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/LazyModelPresentation.java @@ -127,17 +127,17 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi public Image getImage(Object element) { initImageRegistry(); Image image = getPresentation().getImage(element); - if (image == null) { - image = getDefaultImage(element); - } - if (image != null) { - int flags= computeAdornmentFlags(element); - if (flags > 0) { - CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags); - return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor); - } - } - return image; + if (image == null) { + image = getDefaultImage(element); + } + if (image != null) { + int flags= computeAdornmentFlags(element); + if (flags > 0) { + CompositeDebugImageDescriptor descriptor= new CompositeDebugImageDescriptor(image, flags); + return DebugUIPlugin.getImageDescriptorRegistry().get(descriptor); + } + } + return image; } /** @@ -150,81 +150,81 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi } /** - * Computes and return common adornment flags for the given element. - * - * @param element - * @return adornment flags defined in CompositeDebugImageDescriptor - */ - private int computeAdornmentFlags(Object element) { - if (element instanceof IBreakpoint) { - if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) { - return CompositeDebugImageDescriptor.SKIP_BREAKPOINT; - } - } - return 0; - } - - /** - * Returns a default text label for the debug element - */ - protected String getDefaultText(Object element) { - return DebugUIPlugin.getDefaultLabelProvider().getText(element); - } - - /** - * Returns a default image for the debug element - */ - protected Image getDefaultImage(Object element) { - return DebugUIPlugin.getDefaultLabelProvider().getImage(element); - } - - /** + * Computes and return common adornment flags for the given element. + * + * @param element + * @return adornment flags defined in CompositeDebugImageDescriptor + */ + private int computeAdornmentFlags(Object element) { + if (element instanceof IBreakpoint) { + if (!DebugPlugin.getDefault().getBreakpointManager().isEnabled()) { + return CompositeDebugImageDescriptor.SKIP_BREAKPOINT; + } + } + return 0; + } + + /** + * Returns a default text label for the debug element + */ + protected String getDefaultText(Object element) { + return DebugUIPlugin.getDefaultLabelProvider().getText(element); + } + + /** + * Returns a default image for the debug element + */ + protected Image getDefaultImage(Object element) { + return DebugUIPlugin.getDefaultLabelProvider().getImage(element); + } + + /** * @see IDebugModelPresentation#getText(Object) */ @Override public String getText(Object element) { - if (!(element instanceof IndexedVariablePartition)) { - // Attempt to delegate - String text = getPresentation().getText(element); - if (text != null) { - return text; - } - } - // If no delegate returned a text label, use the default - if (showVariableTypeNames()) { - try { - if (element instanceof IExpression) { - StringBuilder buf = new StringBuilder(); - IValue value = ((IExpression)element).getValue(); - if (value != null) { - String type = value.getReferenceTypeName(); - if (type != null && type.length() > 0) { - buf.append(type); - buf.append(' '); - } - } - buf.append(getDefaultText(element)); - return buf.toString(); - } else if (element instanceof IVariable) { - return new StringBuffer(((IVariable)element).getValue().getReferenceTypeName()).append(' ').append(getDefaultText(element)).toString(); - } - } catch (DebugException de) { - DebugUIPlugin.log(de); - } - } - return getDefaultText(element); - } - - /** - * Whether or not to show variable type names. - * This option is configured per model presentation. - * This allows this option to be set per view, for example. - */ - protected boolean showVariableTypeNames() { + if (!(element instanceof IndexedVariablePartition)) { + // Attempt to delegate + String text = getPresentation().getText(element); + if (text != null) { + return text; + } + } + // If no delegate returned a text label, use the default + if (showVariableTypeNames()) { + try { + if (element instanceof IExpression) { + StringBuilder buf = new StringBuilder(); + IValue value = ((IExpression)element).getValue(); + if (value != null) { + String type = value.getReferenceTypeName(); + if (type != null && type.length() > 0) { + buf.append(type); + buf.append(' '); + } + } + buf.append(getDefaultText(element)); + return buf.toString(); + } else if (element instanceof IVariable) { + return new StringBuffer(((IVariable)element).getValue().getReferenceTypeName()).append(' ').append(getDefaultText(element)).toString(); + } + } catch (DebugException de) { + DebugUIPlugin.log(de); + } + } + return getDefaultText(element); + } + + /** + * Whether or not to show variable type names. + * This option is configured per model presentation. + * This allows this option to be set per view, for example. + */ + protected boolean showVariableTypeNames() { Boolean show = (Boolean) fAttributes.get(DISPLAY_VARIABLE_TYPE_NAMES); show = show == null ? Boolean.FALSE : show; - return show.booleanValue(); - } + return show.booleanValue(); + } /** * @see IDebugModelPresentation#computeDetail(IValue, IValueDetailListener) @@ -293,7 +293,7 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi } ListenerList<ILabelProviderListener> listeners = fListeners; if (listeners != null) { - listeners.remove(listener); + listeners.remove(listener); } } @@ -302,12 +302,12 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi */ protected IDebugModelPresentation getPresentation() { if (fPresentation == null) { - synchronized (this) { - if (fPresentation != null) { - // In the case that the synchronization is enforced, the "blocked" thread - // should return the presentation configured by the "owning" thread. - return fPresentation; - } + synchronized (this) { + if (fPresentation != null) { + // In the case that the synchronization is enforced, the "blocked" thread + // should return the presentation configured by the "owning" thread. + return fPresentation; + } try { IDebugModelPresentation tempPresentation= (IDebugModelPresentation) DebugUIPlugin.createExtension(fConfig, "class"); //$NON-NLS-1$ // configure it @@ -326,7 +326,7 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi } catch (CoreException e) { DebugUIPlugin.log(e); } - } + } } return fPresentation; } @@ -394,35 +394,35 @@ public class LazyModelPresentation implements IDebugModelPresentation, IDebugEdi return fAttributes; } - @Override + @Override public Color getForeground(Object element) { - IDebugModelPresentation presentation = getPresentation(); - if (presentation instanceof IColorProvider) { - IColorProvider colorProvider = (IColorProvider) presentation; - return colorProvider.getForeground(element); - } - return null; - } - - @Override + IDebugModelPresentation presentation = getPresentation(); + if (presentation instanceof IColorProvider) { + IColorProvider colorProvider = (IColorProvider) presentation; + return colorProvider.getForeground(element); + } + return null; + } + + @Override public Color getBackground(Object element) { - IDebugModelPresentation presentation = getPresentation(); - if (presentation instanceof IColorProvider) { - IColorProvider colorProvider = (IColorProvider) presentation; - return colorProvider.getBackground(element); - } - return null; - } - - @Override + IDebugModelPresentation presentation = getPresentation(); + if (presentation instanceof IColorProvider) { + IColorProvider colorProvider = (IColorProvider) presentation; + return colorProvider.getBackground(element); + } + return null; + } + + @Override public Font getFont(Object element) { - IDebugModelPresentation presentation = getPresentation(); - if (presentation instanceof IFontProvider) { - IFontProvider fontProvider = (IFontProvider) presentation; - return fontProvider.getFont(element); - } - return null; - } + IDebugModelPresentation presentation = getPresentation(); + if (presentation instanceof IFontProvider) { + IFontProvider fontProvider = (IFontProvider) presentation; + return fontProvider.getFont(element); + } + return null; + } @Override public Annotation getInstructionPointerAnnotation(IEditorPart editorPart, IStackFrame frame) { |