Bug 220546 [Decorators] performance problem with resource manager in decoaration context
20080217 I'm afraid the solution to use the IDecorationContext to provide a resource manager introduces a performance degregation. The DecoratorManager, who manages the light weight label decorations, stores decorations by context DecorationScheduler.resultCache<IDecorationContext, Map<DecorationResult>> Most label providers used the default context (DecorationContext.DEFAULT_CONTEXT). If there were several requests for the same image, all the requests were bundled and the result was only computed once before the result was broadcasted to all viewer. Now, with the new code, each label provider has its own instance of a decoration context. There will be separate computations per context. Even if two viewers want to decorate the same image, each of them will have to compute a DecorationResult The broadcast, however, still goes to all viewers.
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingStyledCellLabelProvider.java
import org.eclipse.jface.viewers.StyledStringBuilder.Styler;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;
/**
 * A {@link DecoratingStyledCellLabelProvider} is a
 * {@link DelegatingStyledCellLabelProvider} that uses a nested
 * {@link DecoratingStyledCellLabelProvider.IStyledLabelProvider} to compute
 * styled text label and image and takes a {@link ILabelDecorator} to decorate
 * the label.
 * 
 * <p>
 * Use this label provider as a replacement for the
 * {@link DecoratingLabelProvider} when decorating styled text labels.
 * </p>
 * 
 * <p>
 * The {@link DecoratingStyledCellLabelProvider} will try to evaluate the text
 * decoration added by the {@link ILabelDecorator} and will apply the style
 * returned by {@link #getDecorationStyle(Object)}
 * </p>
 * <p>
 * The {@link ILabelDecorator} can optionally implement {@link IColorDecorator}
 * and {@link IFontDecorator} to provide foreground and background color and
 * font decoration.
 * </p>
 * 
 * @since 3.4
 */
public class DecoratingStyledCellLabelProvider extends