Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "FAQ How do I add label decorations to my viewer?"
m |
|||
Line 1: | Line 1: | ||
− | |||
− | |||
Suppose that your viewer contains model elements for which other plug-ins | Suppose that your viewer contains model elements for which other plug-ins | ||
have defined label decorators. To make those decorations appear in your | have defined label decorators. To make those decorations appear in your | ||
Line 7: | Line 5: | ||
add declarative decorations from other plug-ins: | add declarative decorations from other plug-ins: | ||
<pre> | <pre> | ||
− | ILabelProvider lp = ... your basic label provider | + | ILabelProvider lp = ... // your basic label provider |
− | ILabelDecorator decorator = PlatformUI.getWorkbench(). | + | ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); |
− | + | viewer.setLabelProvider(new DecoratingLabelProvider(lp, decorator)); | |
− | viewer.setLabelProvider( | + | |
− | + | ||
</pre> | </pre> | ||
− | |||
== See Also: == | == See Also: == | ||
+ | *[[FAQ What is a label decorator?]] | ||
+ | *[[FAQ How do I create a label decorator declaratively?]] | ||
− | + | {{Template:FAQ_Tagline}} | |
− | + | ||
− | + | ||
− | + | ||
− | + |
Revision as of 01:10, 16 June 2006
Suppose that your viewer contains model elements for which other plug-ins have defined label decorators. To make those decorations appear in your viewer, you need to install a decorating label provider. Assuming that you have already written your own basic label provider, simply do the following to add declarative decorations from other plug-ins:
ILabelProvider lp = ... // your basic label provider ILabelDecorator decorator = PlatformUI.getWorkbench().getDecoratorManager().getLabelDecorator(); viewer.setLabelProvider(new DecoratingLabelProvider(lp, decorator));
See Also:
This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.