Runtime

org.eclipse.gmf.runtime.diagram.ui.services.decorator
Interface IDecoratorProvider

All Superinterfaces:
IProvider

public interface IDecoratorProvider
extends IProvider

Clients providing an extension to the DecoratorService need to create a decorator provider class that implements the IDecoratorProvider interface.

IDecoratorProvider is the interface for providers of the decorator service. A decorator provider is responsible for installing its decorators on the decorator targets that it wishes to decorate.

The provides method determines whether this decorator provider supports adding decorations to a given decoration target. The operation in the provides method will be of type CreateDecoratorsOperation from which the decorator target can be extracted.

Here is an example:

 
  
    public boolean provides(IOperation operation) {
  		if (!(operation instanceof CreateDecoratorsOperation)) {
  			return false;
  		}
  
  		IAdaptable adapter = ((CreateDecoratorsOperation) operation)
  			.getDecoratorTarget();
  		Object element = adapter.getAdapter(org.eclipse.uml2.Element.class);
  		
  		return CHECK CONDITION ON ELEMENT;
  	}
  
    public void createDecorators(IDecoratorTarget decoratorTarget) {
  		Object element = decoratorTarget.getAdapter(org.eclipse.uml2.Element.class));
       if (CHECK CONDITION ON ELEMENT) {
   		decoratorTarget.installDecorator(MY_DECORATOR_ID,
  			new MyDecorator(decoratorTarget));
       }
   }
   
  
 

See Also:
IDecoratorTarget, IDecorator

Method Summary
 void createDecorators(IDecoratorTarget decoratorTarget)
          Creates the decorators and installs them on the decorator target.
 
Methods inherited from interface org.eclipse.gmf.runtime.common.core.service.IProvider
addProviderChangeListener, provides, removeProviderChangeListener
 

Method Detail

createDecorators

public void createDecorators(IDecoratorTarget decoratorTarget)
Creates the decorators and installs them on the decorator target. See example above.

Parameters:
decoratorTarget - the object to be decorated

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.