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.ui; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.jface.viewers.IBaseLabelProvider; 15 import org.eclipse.jface.viewers.IDelayedLabelDecorator; 16 import org.eclipse.jface.viewers.ILabelDecorator; 17 import org.eclipse.jface.viewers.ILightweightLabelDecorator; 18 19 /** 20 * Manages the decorators contributed via the decorators extension point. 21 * Views which allow decoration of their elements should use the label 22 * decorator returned by <code>getLabelDecorator()</code>. 23 * <p> 24 * This class is not intended to be implemented by clients. 25 * </p> 26 */ 27 public interface IDecoratorManager extends IDelayedLabelDecorator{ 28 29 /** 30 * Returns the label decorator which applies the decorations from all 31 * enabled decorators. 32 * Views which allow decoration of their elements should use this 33 * label decorator. 34 * 35 * @return the label decorator 36 * @see org.eclipse.jface.viewers.DecoratingLabelProvider 37 */ 38 ILabelDecorator getLabelDecorator(); 39 40 /** 41 * Return the IBaseLabelProvider that corresponds to the 42 * decoratorId. This can handle both lightweight and full 43 * decorators. 44 * 45 * @param decoratorId the decorator id 46 * @return the label provider 47 */ 48 IBaseLabelProvider getBaseLabelProvider(String decoratorId); 49 50 /** 51 * Returns the full label decorator instance for the specified decorator id 52 * if it is enabled. Otherwise returns <code>null</code>. Returns 53 * <code>null</code> for lightweight decorators. It is recommended that 54 * getBaseLabelProvider is used instead so that lightweight decorators are 55 * also checked. 56 * 57 * @param decoratorId the decorator id 58 * @return the label decorator 59 */ 60 ILabelDecorator getLabelDecorator(String decoratorId); 61 62 /** 63 * Returns the lightweight label decorator instance for the specified 64 * decorator id if it is enabled. Otherwise returns <code>null</code>. 65 * Returns <code>null</code> for heavyweight decorators. 66 * Use <code>getLabelDecorator</code> instead for heavyweight 67 * decorators. 68 * 69 * @param decoratorId the decorator id 70 * @return the lightweight label decorator 71 * @deprecated use getBaseLabelProvider(String) instead. 72 */ 73 ILightweightLabelDecorator getLightweightLabelDecorator(String decoratorId); 74 75 /** 76 * Returns whether the specified decorator is enabled. 77 * 78 * @param decoratorId the decorator id 79 * @return <code>true</code> if the decorator is enabled, or 80 * <code>false</code> if not 81 */ 82 boolean getEnabled(String decoratorId); 83 84 /** 85 * Sets whether the specified decorator is enabled. 86 * 87 * @param decoratorId the decorator id 88 * @param enabled <code>true</code> to enable the decorator, or 89 * <code>false</code> to disable it 90 * @throws CoreException if the decorator cannot be instantiated 91 */ 92 void setEnabled(String decoratorId, boolean enabled) throws CoreException; 93 94 /** 95 * Fire a LabelProviderChangedEvent for the decorator that corresponds to 96 * decoratorID if it exists and is enabled using the IBaseLabelProvider 97 * as the argument to the event. Otherwise do nothing. 98 * <p> This method must be called from the user interface thread as widget 99 * updates may result. </p> 100 * 101 * @param decoratorId the decorator id 102 */ 103 void update(String decoratorId); 104 105 } 106