]> gerrit.simantics Code Review - simantics/sysdyn.git/blob
62896598c824e6961bb3fb5dc2aa50e1d21891fe
[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.simulation.ontology.SimulationResource;\r
10 import org.simantics.sysdyn.ui.browser.nodes.SimulationResultNode;\r
11 \r
12 public class SimulationResultDecorator extends LabelDecoratorContributor<SimulationResultNode>{\r
13 \r
14     @Override\r
15     public LabelDecorator getDecorator(ReadGraph graph, SimulationResultNode result) throws DatabaseException {\r
16         if (graph.hasStatement(result.data, SimulationResource.getInstance(graph).IsActive)) {\r
17             return new LabelDecorator.Stub() {\r
18 \r
19                 @SuppressWarnings("unchecked")\r
20                 @Override\r
21                 public <F> F decorateFont(F font, String column, int itemIndex) {\r
22                     return (F) ((FontDescriptor) font).withStyle(SWT.BOLD);\r
23                 }\r
24             };\r
25         }\r
26         return null;\r
27     }\r
28 \r
29 }\r