-package org.simantics.selectionview;\r
-\r
-import org.eclipse.jface.resource.ColorDescriptor;\r
-import org.eclipse.swt.graphics.RGB;\r
-import org.simantics.browsing.ui.common.ColumnKeys;\r
-import org.simantics.browsing.ui.content.LabelDecorator;\r
-import org.simantics.browsing.ui.model.labeldecorators.LabelDecorationRule;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.variable.Variable;\r
-import org.simantics.db.layer0.variable.Variables;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class VariableColoringDecorationRule implements LabelDecorationRule {\r
-\r
- private final static ColorDescriptor READONLY_GRAY = ColorDescriptor.createFrom(new RGB(240, 240, 240));\r
-\r
- @Override\r
- public boolean isCompatible(Class<?> contentType) {\r
- return contentType.equals(Variable.class);\r
- }\r
-\r
- @Override\r
- public LabelDecorator getLabelDecorator(ReadGraph graph, Object content)\r
- throws DatabaseException {\r
- Variable variable = (Variable)content;\r
- Object o = variable.getPossiblePropertyValue(graph, Variables.READONLY);\r
- if (!Boolean.TRUE.equals(o))\r
- return null;\r
- return ReadOnlyDecorator.INSTANCE;\r
- }\r
-\r
- private static class ReadOnlyDecorator extends LabelDecorator.Stub {\r
- public static ReadOnlyDecorator INSTANCE = new ReadOnlyDecorator();\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public <C> C decorateBackground(C color, String column, int itemIndex) {\r
- if (ColumnKeys.DISPLAY_VALUE.equals(column) || ColumnKeys.DISPLAY_UNIT.equals(column))\r
- return (C) READONLY_GRAY;\r
- return null;\r
- }\r
- }\r
-\r
-}\r
+package org.simantics.selectionview;
+
+import org.eclipse.jface.resource.ColorDescriptor;
+import org.eclipse.swt.graphics.RGB;
+import org.simantics.browsing.ui.common.ColumnKeys;
+import org.simantics.browsing.ui.content.LabelDecorator;
+import org.simantics.browsing.ui.model.labeldecorators.LabelDecorationRule;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.variable.Variable;
+import org.simantics.db.layer0.variable.Variables;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class VariableColoringDecorationRule implements LabelDecorationRule {
+
+ private final static ColorDescriptor READONLY_GRAY = ColorDescriptor.createFrom(new RGB(240, 240, 240));
+
+ @Override
+ public boolean isCompatible(Class<?> contentType) {
+ return contentType.equals(Variable.class);
+ }
+
+ @Override
+ public LabelDecorator getLabelDecorator(ReadGraph graph, Object content)
+ throws DatabaseException {
+ Variable variable = (Variable)content;
+ Object o = variable.getPossiblePropertyValue(graph, Variables.READONLY);
+ if (!Boolean.TRUE.equals(o))
+ return null;
+ return ReadOnlyDecorator.INSTANCE;
+ }
+
+ private static class ReadOnlyDecorator extends LabelDecorator.Stub {
+ public static ReadOnlyDecorator INSTANCE = new ReadOnlyDecorator();
+ @SuppressWarnings("unchecked")
+ @Override
+ public <C> C decorateBackground(C color, String column, int itemIndex) {
+ if (ColumnKeys.DISPLAY_VALUE.equals(column) || ColumnKeys.DISPLAY_UNIT.equals(column))
+ return (C) READONLY_GRAY;
+ return null;
+ }
+ }
+
+}