1 package org.simantics.sysdyn.ui.browser.contributions;
\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
11 public class ExperimentLabelDecorator extends LabelDecoratorContributor<ExperimentNode> {
\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
18 public String decorateLabel(String label, String column, int itemIndex) {
\r
19 return label + " [ACTIVE]";
\r
22 @SuppressWarnings("unchecked")
\r
24 public <F> F decorateFont(F font, String column, int itemIndex) {
\r
25 return (F) ((FontDescriptor) font).withStyle(SWT.BOLD);
\r