]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
b38c9f6828f8b0b272990d2e7a97fd13f3f6f1da
[simantics/sysdyn.git] /
1 package org.simantics.sysdyn.ui.browser.contributions;\r
2 \r
3 import org.eclipse.jface.resource.FontDescriptor;\r
4 import org.eclipse.swt.SWT;\r
5 import org.simantics.browsing.ui.content.LabelDecorator;\r
6 import org.simantics.browsing.ui.graph.contributor.labeler.LabelDecoratorContributor;\r
7 import org.simantics.db.ReadGraph;\r
8 import org.simantics.db.exception.DatabaseException;\r
9 import org.simantics.sysdyn.ui.browser.nodes.ExperimentNode;\r
10 \r
11 public class ExperimentLabelDecorator extends LabelDecoratorContributor<ExperimentNode> {\r
12 \r
13     @Override\r
14     public LabelDecorator getDecorator(ReadGraph graph, ExperimentNode experimentNode) throws DatabaseException {\r
15         if (graph.hasStatement(experimentNode.resource, graph.getBuiltins().IsActive)) {\r
16             return new LabelDecorator.Stub() {\r
17                 @Override\r
18                 public String decorateLabel(String label, String column, int itemIndex) {\r
19                     return label + " [ACTIVE]";\r
20                 }\r
21 \r
22                 @SuppressWarnings("unchecked")\r
23                 @Override\r
24                 public <F> F decorateFont(F font, String column, int itemIndex) {\r
25                     return (F) ((FontDescriptor) font).withStyle(SWT.BOLD);\r
26                 }\r
27             };\r
28         }\r
29         return null;\r
30     }\r
31 \r
32 }\r