-/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
- * in Industry THTH ry.\r
- * All rights reserved. This program and the accompanying materials\r
- * are made available under the terms of the Eclipse Public License v1.0\r
- * which accompanies this distribution, and is available at\r
- * http://www.eclipse.org/legal/epl-v10.html\r
- *\r
- * Contributors:\r
- * VTT Technical Research Centre of Finland - initial API and implementation\r
- *******************************************************************************/\r
-package org.simantics.browsing.ui.graph.impl.contributor.imager;\r
-\r
-import org.simantics.browsing.ui.BuiltinKeys;\r
-import org.simantics.browsing.ui.BuiltinKeys.ImageDecoratorKey;\r
-import org.simantics.browsing.ui.NodeContext;\r
-import org.simantics.browsing.ui.PrimitiveQueryUpdater;\r
-import org.simantics.browsing.ui.Tester;\r
-import org.simantics.browsing.ui.content.Contributor;\r
-import org.simantics.browsing.ui.content.ImageDecorator;\r
-import org.simantics.browsing.ui.content.ImageDecoratorFactory;\r
-import org.simantics.browsing.ui.graph.impl.contribution.ImageDecoratorContributionImpl;\r
-import org.simantics.db.ReadGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.utils.ReflectionUtils;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- *\r
- * @param <T>\r
- */\r
-public abstract class ImageDecoratorContributorImpl<T> implements Contributor<ImageDecoratorFactory> {\r
-\r
- abstract public ImageDecorator getDecorator(ReadGraph graph, T input) throws DatabaseException;\r
-\r
- final private Class<?> clazz;\r
-\r
- @Override\r
- public Tester getNodeContextTester() {\r
- return null;\r
- }\r
-\r
- public ImageDecoratorContributorImpl() {\r
- clazz = ReflectionUtils.getSingleParameterType(getClass());\r
- }\r
-\r
- public ImageDecoratorContributorImpl(Class<?> clazz) {\r
- this.clazz = clazz;\r
- }\r
-\r
- @Override\r
- public ImageDecoratorFactory getFactory() {\r
-\r
- return new ImageDecoratorFactory() {\r
-\r
- @Override\r
- public ImageDecorator create(final PrimitiveQueryUpdater updater, NodeContext context, ImageDecoratorKey key) {\r
-\r
- return new ImageDecoratorContributionImpl(updater, context, key) {\r
-\r
- @SuppressWarnings("unchecked")\r
- @Override\r
- public ImageDecorator getDecorator(ReadGraph graph, NodeContext context) throws DatabaseException {\r
-\r
- T input = (T)context.getConstant(BuiltinKeys.INPUT);\r
-\r
- return ImageDecoratorContributorImpl.this.getDecorator(graph, input);\r
-\r
- }\r
-\r
- };\r
-\r
- }\r
-\r
- };\r
-\r
- }\r
-\r
- @Override\r
- public Class<?> getInputClass() {\r
- return clazz;\r
- }\r
-\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 Association for Decentralized Information Management
+ * in Industry THTH ry.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * VTT Technical Research Centre of Finland - initial API and implementation
+ *******************************************************************************/
+package org.simantics.browsing.ui.graph.impl.contributor.imager;
+
+import org.simantics.browsing.ui.BuiltinKeys;
+import org.simantics.browsing.ui.BuiltinKeys.ImageDecoratorKey;
+import org.simantics.browsing.ui.NodeContext;
+import org.simantics.browsing.ui.PrimitiveQueryUpdater;
+import org.simantics.browsing.ui.Tester;
+import org.simantics.browsing.ui.content.Contributor;
+import org.simantics.browsing.ui.content.ImageDecorator;
+import org.simantics.browsing.ui.content.ImageDecoratorFactory;
+import org.simantics.browsing.ui.graph.impl.contribution.ImageDecoratorContributionImpl;
+import org.simantics.db.ReadGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.utils.ReflectionUtils;
+
+/**
+ * @author Tuukka Lehtonen
+ *
+ * @param <T>
+ */
+public abstract class ImageDecoratorContributorImpl<T> implements Contributor<ImageDecoratorFactory> {
+
+ abstract public ImageDecorator getDecorator(ReadGraph graph, T input) throws DatabaseException;
+
+ final private Class<?> clazz;
+
+ @Override
+ public Tester getNodeContextTester() {
+ return null;
+ }
+
+ public ImageDecoratorContributorImpl() {
+ clazz = ReflectionUtils.getSingleParameterType(getClass());
+ }
+
+ public ImageDecoratorContributorImpl(Class<?> clazz) {
+ this.clazz = clazz;
+ }
+
+ @Override
+ public ImageDecoratorFactory getFactory() {
+
+ return new ImageDecoratorFactory() {
+
+ @Override
+ public ImageDecorator create(final PrimitiveQueryUpdater updater, NodeContext context, ImageDecoratorKey key) {
+
+ return new ImageDecoratorContributionImpl(updater, context, key) {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public ImageDecorator getDecorator(ReadGraph graph, NodeContext context) throws DatabaseException {
+
+ T input = (T)context.getConstant(BuiltinKeys.INPUT);
+
+ return ImageDecoratorContributorImpl.this.getDecorator(graph, input);
+
+ }
+
+ };
+
+ }
+
+ };
+
+ }
+
+ @Override
+ public Class<?> getInputClass() {
+ return clazz;
+ }
+
+}