Time for action – styling label providers
The IStyledLabelProvider
is used to style the representation of the tree viewer, as used by the Java outline viewer to display the return type of the method, and by the team's decorator when showing when changes have occurred.
- Add the
IStyledLabelProvider
interface to theTimeZoneLabelProvider
class, and create thegetStyledText
method. If the selected element is aMap.Entry
that contains aZoneId
, add the offset afterwards in brackets:public class TimeZoneLabelProvider extends LabelProvider implements IStyledLabelProvider { public StyledString getStyledText(Object element) { String text = getText(element); StyledString styledString = new StyledString(text); if (element instanceof ZoneId) { ZoneId zone ...
Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.