1 /******************************************************************************* 2 * Copyright (c) 2000, 2006 IBM Corporation and others. 3 * All rights reserved. This program and the accompanying materials 4 * are made available under the terms of the Eclipse Public License v1.0 5 * which accompanies this distribution, and is available at 6 * http://www.eclipse.org/legal/epl-v10.html 7 * 8 * Contributors: 9 * IBM Corporation - initial API and implementation 10 *******************************************************************************/ 11 package org.eclipse.jface.viewers; 12 13 import org.eclipse.swt.graphics.Image; 14 15 /** 16 * A label decorator decorates the label text and image for some element. 17 * The original label text and image are obtained by some other means, 18 * for example by a label provider. 19 * 20 * @see ILabelProvider 21 */ 22 public interface ILabelDecorator extends IBaseLabelProvider { 23 /** 24 * Returns an image that is based on the given image, 25 * but decorated with additional information relating to the state 26 * of the provided element. 27 * 28 * Text and image decoration updates can occur as a result of other updates 29 * within the workbench including deferred decoration by background processes. 30 * Clients should handle labelProviderChangedEvents for the given element to get 31 * the complete decoration. 32 * @see LabelProviderChangedEvent 33 * @see IBaseLabelProvider#addListener 34 * 35 * @param image the input image to decorate, or <code>null</code> if the element has no image 36 * @param element the element whose image is being decorated 37 * @return the decorated image, or <code>null</code> if no decoration is to be applied 38 * 39 * @see org.eclipse.jface.resource.CompositeImageDescriptor 40 */ 41 public Image decorateImage(Image image, Object element); 42 43 /** 44 * Returns a text label that is based on the given text label, 45 * but decorated with additional information relating to the state 46 * of the provided element. 47 * 48 * Text and image decoration updates can occur as a result of other updates 49 * within the workbench including deferred decoration by background processes. 50 * Clients should handle labelProviderChangedEvents for the given element to get 51 * the complete decoration. 52 * @see LabelProviderChangedEvent 53 * @see IBaseLabelProvider#addListener 54 * 55 * @param text the input text label to decorate 56 * @param element the element whose image is being decorated 57 * @return the decorated text label, or <code>null</code> if no decoration is to be applied 58 */ 59 public String decorateText(String text, Object element); 60 } 61