001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.ui;
011:
012: import org.eclipse.core.runtime.CoreException;
013: import org.eclipse.jface.viewers.IBaseLabelProvider;
014: import org.eclipse.jface.viewers.IDelayedLabelDecorator;
015: import org.eclipse.jface.viewers.ILabelDecorator;
016: import org.eclipse.jface.viewers.ILightweightLabelDecorator;
017:
018: /**
019: * Manages the decorators contributed via the decorators extension point.
020: * Views which allow decoration of their elements should use the label
021: * decorator returned by <code>getLabelDecorator()</code>.
022: * <p>
023: * This class is not intended to be implemented by clients.
024: * </p>
025: */
026: public interface IDecoratorManager extends IDelayedLabelDecorator {
027:
028: /**
029: * Returns the label decorator which applies the decorations from all
030: * enabled decorators.
031: * Views which allow decoration of their elements should use this
032: * label decorator.
033: *
034: * @return the label decorator
035: * @see org.eclipse.jface.viewers.DecoratingLabelProvider
036: */
037: ILabelDecorator getLabelDecorator();
038:
039: /**
040: * Return the IBaseLabelProvider that corresponds to the
041: * decoratorId. This can handle both lightweight and full
042: * decorators.
043: *
044: * @param decoratorId the decorator id
045: * @return the label provider
046: */
047: IBaseLabelProvider getBaseLabelProvider(String decoratorId);
048:
049: /**
050: * Returns the full label decorator instance for the specified decorator id
051: * if it is enabled. Otherwise returns <code>null</code>. Returns
052: * <code>null</code> for lightweight decorators. It is recommended that
053: * getBaseLabelProvider is used instead so that lightweight decorators are
054: * also checked.
055: *
056: * @param decoratorId the decorator id
057: * @return the label decorator
058: */
059: ILabelDecorator getLabelDecorator(String decoratorId);
060:
061: /**
062: * Returns the lightweight label decorator instance for the specified
063: * decorator id if it is enabled. Otherwise returns <code>null</code>.
064: * Returns <code>null</code> for heavyweight decorators.
065: * Use <code>getLabelDecorator</code> instead for heavyweight
066: * decorators.
067: *
068: * @param decoratorId the decorator id
069: * @return the lightweight label decorator
070: * @deprecated use getBaseLabelProvider(String) instead.
071: */
072: ILightweightLabelDecorator getLightweightLabelDecorator(
073: String decoratorId);
074:
075: /**
076: * Returns whether the specified decorator is enabled.
077: *
078: * @param decoratorId the decorator id
079: * @return <code>true</code> if the decorator is enabled, or
080: * <code>false</code> if not
081: */
082: boolean getEnabled(String decoratorId);
083:
084: /**
085: * Sets whether the specified decorator is enabled.
086: *
087: * @param decoratorId the decorator id
088: * @param enabled <code>true</code> to enable the decorator, or
089: * <code>false</code> to disable it
090: * @throws CoreException if the decorator cannot be instantiated
091: */
092: void setEnabled(String decoratorId, boolean enabled)
093: throws CoreException;
094:
095: /**
096: * Fire a LabelProviderChangedEvent for the decorator that corresponds to
097: * decoratorID if it exists and is enabled using the IBaseLabelProvider
098: * as the argument to the event. Otherwise do nothing.
099: * <p> This method must be called from the user interface thread as widget
100: * updates may result. </p>
101: *
102: * @param decoratorId the decorator id
103: */
104: void update(String decoratorId);
105:
106: }
|