]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.diagram/src/org/simantics/diagram/adapter/ElementFactoryAdapter.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / adapter / ElementFactoryAdapter.java
index 0d1eb82353608f3f71c608ea4b0c8aef7fd444aa..d5ba8d0aa2ed4dc3b9949becb469a45595d37119 100644 (file)
@@ -1,73 +1,73 @@
-/*******************************************************************************\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.diagram.adapter;\r
-\r
-import org.simantics.db.AsyncReadGraph;\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;\r
-import org.simantics.db.procedure.AsyncProcedure;\r
-import org.simantics.diagram.stubs.DiagramResource;\r
-import org.simantics.g2d.canvas.ICanvasContext;\r
-import org.simantics.g2d.diagram.IDiagram;\r
-import org.simantics.g2d.element.ElementClass;\r
-import org.simantics.g2d.element.IElement;\r
-\r
-/**\r
- * @author Tuukka Lehtonen\r
- */\r
-public class ElementFactoryAdapter implements ElementFactory {\r
-\r
-    @Override\r
-    public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType,\r
-            AsyncProcedure<ElementClass> procedure) {\r
-        procedure.exception(graph, new UnsupportedOperationException(getClass().getName() + " does not support ElementFactory.create"));\r
-    }\r
-\r
-    protected Resource getElementClassBaseType(AsyncReadGraph graph) {\r
-        return graph.getService(DiagramResource.class).Element;\r
-    }\r
-\r
-    @Override\r
-    public void getClass(AsyncReadGraph graph, final ICanvasContext canvas, final IDiagram diagram,\r
-            Resource elementResource, final AsyncProcedure<ElementClass> procedure) {\r
-        // A most usual default implementation.\r
-        graph.forSingleType(elementResource, getElementClassBaseType(graph), new AsyncProcedure<Resource>() {\r
-            @Override\r
-            public void exception(AsyncReadGraph graph, Throwable throwable) {\r
-                procedure.exception(graph, throwable);\r
-            }\r
-            @Override\r
-            public void execute(AsyncReadGraph graph, Resource elementType) {\r
-                // Implements caching of element class requests.\r
-                graph.asyncRequest(new CreateElementClassRequest(ElementFactoryAdapter.this, elementType, canvas, diagram),\r
-                        new TransientCacheAsyncListener<ElementClass>() {\r
-                    @Override\r
-                    public void exception(AsyncReadGraph graph, Throwable t) {\r
-                        procedure.exception(graph, t);\r
-                    }\r
-                    @Override\r
-                    public void execute(AsyncReadGraph graph, ElementClass result) {\r
-                        //System.out.println("RESULT ELEMENTCLASS: " + System.identityHashCode(result) + ": " + result);\r
-                        procedure.execute(graph, result);\r
-                    }\r
-                });\r
-            }\r
-        });\r
-    }\r
-\r
-    @Override\r
-    public void load(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource,\r
-            IElement element, AsyncProcedure<IElement> procedure) {\r
-        procedure.exception(graph, new UnsupportedOperationException(getClass().getName() + " does not support ElementFactory.load"));\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.diagram.adapter;
+
+import org.simantics.db.AsyncReadGraph;
+import org.simantics.db.Resource;
+import org.simantics.db.common.procedure.adapter.TransientCacheAsyncListener;
+import org.simantics.db.procedure.AsyncProcedure;
+import org.simantics.diagram.stubs.DiagramResource;
+import org.simantics.g2d.canvas.ICanvasContext;
+import org.simantics.g2d.diagram.IDiagram;
+import org.simantics.g2d.element.ElementClass;
+import org.simantics.g2d.element.IElement;
+
+/**
+ * @author Tuukka Lehtonen
+ */
+public class ElementFactoryAdapter implements ElementFactory {
+
+    @Override
+    public void create(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementType,
+            AsyncProcedure<ElementClass> procedure) {
+        procedure.exception(graph, new UnsupportedOperationException(getClass().getName() + " does not support ElementFactory.create"));
+    }
+
+    protected Resource getElementClassBaseType(AsyncReadGraph graph) {
+        return graph.getService(DiagramResource.class).Element;
+    }
+
+    @Override
+    public void getClass(AsyncReadGraph graph, final ICanvasContext canvas, final IDiagram diagram,
+            Resource elementResource, final AsyncProcedure<ElementClass> procedure) {
+        // A most usual default implementation.
+        graph.forSingleType(elementResource, getElementClassBaseType(graph), new AsyncProcedure<Resource>() {
+            @Override
+            public void exception(AsyncReadGraph graph, Throwable throwable) {
+                procedure.exception(graph, throwable);
+            }
+            @Override
+            public void execute(AsyncReadGraph graph, Resource elementType) {
+                // Implements caching of element class requests.
+                graph.asyncRequest(new CreateElementClassRequest(ElementFactoryAdapter.this, elementType, canvas, diagram),
+                        new TransientCacheAsyncListener<ElementClass>() {
+                    @Override
+                    public void exception(AsyncReadGraph graph, Throwable t) {
+                        procedure.exception(graph, t);
+                    }
+                    @Override
+                    public void execute(AsyncReadGraph graph, ElementClass result) {
+                        //System.out.println("RESULT ELEMENTCLASS: " + System.identityHashCode(result) + ": " + result);
+                        procedure.execute(graph, result);
+                    }
+                });
+            }
+        });
+    }
+
+    @Override
+    public void load(AsyncReadGraph graph, ICanvasContext canvas, IDiagram diagram, Resource elementResource,
+            IElement element, AsyncProcedure<IElement> procedure) {
+        procedure.exception(graph, new UnsupportedOperationException(getClass().getName() + " does not support ElementFactory.load"));
+    }
+
+}