+ private static final Decorator[] DECORATORS = {
+ null,
+ new Decorator(true, false, false),
+ new Decorator(false, true, false),
+ new Decorator(true, true, false),
+ new Decorator(false, false, true),
+ new Decorator(true, false, true),
+ new Decorator(false, true, true),
+ new Decorator(true, true, true),
+ };
+
+ private static class Decorator extends LabelDecorator.Stub {
+ private boolean hidden;
+ private boolean user;
+ private boolean resolved;
+
+ public Decorator(boolean hidden, boolean user, boolean resolved) {
+ this.hidden = hidden;
+ this.user = user;
+ this.resolved = resolved;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <F> F decorateFont(F font, String column, int itemIndex) {
+ int style = 0;
+ style |= resolved ? SWT.ITALIC : 0;
+ //style |= hidden ? SWT.BOLD : 0;
+ return style != 0 ? (F) ((FontDescriptor) font).setStyle(style) : font;
+ }
+ @SuppressWarnings("unchecked")
+ @Override
+ public <C> C decorateForeground(C color, String column, int itemIndex) {
+ if (hidden)
+ return (C) Constants.HIDDEN_FG;
+ return color;
+ }
+ @SuppressWarnings("unchecked")
+ @Override
+ public <C> C decorateBackground(C color, String column, int itemIndex) {
+ if (user)
+ return (C) Constants.USER_BG;
+ return color;
+ }
+ };
+