|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
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)); } }
IDecoratorTarget
,
IDecorator
Method Summary | |
void |
createDecorators(IDecoratorTarget decoratorTarget)
Creates the decorators and installs them on the decorator target. |
Methods inherited from interface com.ibm.xtools.common.core.service.IProvider |
addProviderChangeListener, provides, removeProviderChangeListener |
Method Detail |
public void createDecorators(IDecoratorTarget decoratorTarget)
decoratorTarget
- the object to be decorated
|
IBM Rational Software Modeler Release 6.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2004. All rights reserved.