Decorators

Identifier:
org.eclipse.ui.decorators

Since:
2.0

Description:
This extension point is used to add decorators to views that subscribe to a decorator manager. As of 2.1 there is the concept of a lightweight decorator that will handle the image management for the decorator. It is also possible to declare a lightweight decorator that simply overlays an icon when enabled that requires no implementation from the plug-in.

Configuration Markup:

<!ELEMENT extension (decorator*)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT decorator (description? , enablement?)>

<!ATTLIST decorator

id          CDATA #REQUIRED

label       CDATA #REQUIRED

class       CDATA #IMPLIED

objectClass CDATA #IMPLIED

adaptable   (true | false)

state       (true | false)

lightweight (true|false)

icon        CDATA #IMPLIED

location    (TOP_LEFT|TOP_RIGHT|BOTTOM_LEFT|BOTTOM_RIGHT|UNDERLAY|REPLACE) >


<!ELEMENT description (#PCDATA)>

an optional subelement whose body should contain text providing a short description of the decorator. This will be shown in the Decorators preference page so it is recommended that this is included. Default value is an empty String.



Examples:
The following are example of decorators:

A full decorator. The plug-in developer must handle their own image support.


 <extension point="org.eclipse.ui.decorators"> 
        <decorator
            id="com.xyz.decorator" 
            label="XYZ Decorator" 
            state="true" 
            class="com.xyz.DecoratorContributor">
            <enablement>
                <objectClass name="org.eclipse.core.resources.IResource"/> 
            </enablement>
        </decorator>
    </extension> 

A lightweight decorator. There is a concrete class but as it is an ILightweightLabelDecorator it only needs to supply text and an ImageDescriptor and therefore needs no resource handling.


 <extension point="org.eclipse.ui.decorators"> 
        <decorator
            id="com.xyz.lightweight.decorator" 
            label="XYZ Lightweight Decorator"                 
            state="false" 
            class="com.xyz.LightweightDecoratorContributor" 
            lightweight="true" >
            <enablement>
                <objectClass name="org.eclipse.core.resources.IResource"/> 
            </enablement>
        </decorator>
    </extension> 

A declarative lightweight decorator. There is no concrete class so it supplies an icon and a quadrant to apply that icon.


 <extension point="org.eclipse.ui.decorators"> 
        <decorator
            id="com.xyz.lightweight.declarative.decorator" 
            label="XYZ Lightweight Declarative Decorator" 
            state="false" 
            lightweight="true" 
            icon="icons/full/declarative.png"
            location="TOP_LEFT"> 
            <enablement>
                <objectClass name="org.eclipse.core.resources.IResource"/> 
            </enablement>
        </decorator>
    </extension>

API Information:
The value of the class attribute must be the fully qualified name of a class that implements org.eclipse.jface.viewers.ILabelDecorator (if lightweight is false) or org.eclipse.jface.viewers.ILightweightLabelDecorator. This class is loaded as late as possible to avoid loading the entire plug-in before it is really needed. Declarative decorators do not entail any plug-in activation and should be used whenever possible. Non-lightweight decorators will eventually be deprecated.

Supplied Implementation:
Plug-ins may use this extension point to add new decorators to be applied to views that use the decorator manager as their label decorator. To use the decorator manager, use the result of IViewPart.getDecoratorManager() as the decorator for an instance of DecoratingLabelProvider. This is currently in use by the Resource Navigator.


Copyright (c) 2002, 2014 IBM Corporation and others.
This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-v20.html/ SPDX-License-Identifier: EPL-2.0