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