]> gerrit.simantics Code Review - simantics/platform.git/blobdiff - bundles/org.simantics.modeling.template2d.ui/src/org/simantics/modeling/template2d/ui/adapters/SVGImagePasteHandler.java
Fixed all line endings of the repository
[simantics/platform.git] / bundles / org.simantics.modeling.template2d.ui / src / org / simantics / modeling / template2d / ui / adapters / SVGImagePasteHandler.java
index 03479b2cfff0980a74afeb7db50b0912c5937bf4..b46c5eecb8b40ed6a2a17d0641f8761edf6493a7 100644 (file)
@@ -1,79 +1,79 @@
-/*******************************************************************************\r
- * Copyright (c) 2012 Association for Decentralized Information Management in\r
- * 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.modeling.template2d.ui.adapters;\r
-\r
-import java.util.ArrayList;\r
-import java.util.Collection;\r
-import java.util.Set;\r
-\r
-import org.simantics.db.Resource;\r
-import org.simantics.db.WriteGraph;\r
-import org.simantics.db.exception.DatabaseException;\r
-import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;\r
-import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor;\r
-import org.simantics.db.layer0.util.ClipboardUtils;\r
-import org.simantics.db.layer0.util.PasteEventHandler;\r
-import org.simantics.db.layer0.util.SimanticsClipboard.Representation;\r
-import org.simantics.db.layer0.util.SimanticsKeys;\r
-import org.simantics.graph.db.IImportAdvisor;\r
-import org.simantics.graph.db.IImportAdvisor2;\r
-import org.simantics.graph.representation.TransferableGraph1;\r
-import org.simantics.modeling.template2d.ui.function.LinkSVGImage;\r
-\r
-public class SVGImagePasteHandler extends DefaultPasteHandler {\r
-\r
-       public SVGImagePasteHandler(Resource resource) {\r
-               super(resource);\r
-       }\r
-\r
-       @Override\r
-       public void onPasteBegin(WriteGraph graph) {\r
-               \r
-       }\r
-\r
-       @Override\r
-       public void execute(WriteGraph graph, TransferableGraph1 tg,\r
-               Resource resource, IImportAdvisor advisor) throws DatabaseException {\r
-       }\r
-\r
-       @Override\r
-    public Collection<Resource> pasteObject(WriteGraph graph, Set<Representation> object, PasteEventHandler handler) throws DatabaseException {\r
-               Collection<Resource> result = new ArrayList<Resource>(); \r
-        TransferableGraph1 tg = ClipboardUtils.accept(graph, object, SimanticsKeys.KEY_TRANSFERABLE_GRAPH);\r
-        if (tg != null) {\r
-            DefaultPasteImportAdvisor advisor = new DefaultPasteImportAdvisor((Resource)getAdapter(Resource.class)); \r
-            try {\r
-                onPaste(graph, advisor, object);\r
-            } catch (Throwable e) {\r
-            }\r
-        }\r
-        return result;\r
-    }\r
-\r
-    @Override\r
-       public void onPaste(WriteGraph graph, IImportAdvisor2 advisor, Set<Representation> representations) throws DatabaseException {\r
-               \r
-               final Resource parent = advisor.getTarget();\r
-               final Collection<Resource> child = ClipboardUtils.accept(representations, SimanticsKeys.KEY_COPY_RESOURCES);\r
-               if(child != null) {\r
-                   if(child.size() == 1) {\r
-                       LinkSVGImage.linkSVGImage(graph, parent, child.iterator().next());\r
-                   }\r
-               }\r
-               \r
-    }\r
-\r
-       @Override\r
-       public void onPasteEnd(WriteGraph graph){\r
-               \r
-       }\r
-}\r
+/*******************************************************************************
+ * Copyright (c) 2012 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.modeling.template2d.ui.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import org.simantics.db.Resource;
+import org.simantics.db.WriteGraph;
+import org.simantics.db.exception.DatabaseException;
+import org.simantics.db.layer0.adapter.impl.DefaultPasteHandler;
+import org.simantics.db.layer0.adapter.impl.DefaultPasteImportAdvisor;
+import org.simantics.db.layer0.util.ClipboardUtils;
+import org.simantics.db.layer0.util.PasteEventHandler;
+import org.simantics.db.layer0.util.SimanticsClipboard.Representation;
+import org.simantics.db.layer0.util.SimanticsKeys;
+import org.simantics.graph.db.IImportAdvisor;
+import org.simantics.graph.db.IImportAdvisor2;
+import org.simantics.graph.representation.TransferableGraph1;
+import org.simantics.modeling.template2d.ui.function.LinkSVGImage;
+
+public class SVGImagePasteHandler extends DefaultPasteHandler {
+
+       public SVGImagePasteHandler(Resource resource) {
+               super(resource);
+       }
+
+       @Override
+       public void onPasteBegin(WriteGraph graph) {
+               
+       }
+
+       @Override
+       public void execute(WriteGraph graph, TransferableGraph1 tg,
+               Resource resource, IImportAdvisor advisor) throws DatabaseException {
+       }
+
+       @Override
+    public Collection<Resource> pasteObject(WriteGraph graph, Set<Representation> object, PasteEventHandler handler) throws DatabaseException {
+               Collection<Resource> result = new ArrayList<Resource>(); 
+        TransferableGraph1 tg = ClipboardUtils.accept(graph, object, SimanticsKeys.KEY_TRANSFERABLE_GRAPH);
+        if (tg != null) {
+            DefaultPasteImportAdvisor advisor = new DefaultPasteImportAdvisor((Resource)getAdapter(Resource.class)); 
+            try {
+                onPaste(graph, advisor, object);
+            } catch (Throwable e) {
+            }
+        }
+        return result;
+    }
+
+    @Override
+       public void onPaste(WriteGraph graph, IImportAdvisor2 advisor, Set<Representation> representations) throws DatabaseException {
+               
+               final Resource parent = advisor.getTarget();
+               final Collection<Resource> child = ClipboardUtils.accept(representations, SimanticsKeys.KEY_COPY_RESOURCES);
+               if(child != null) {
+                   if(child.size() == 1) {
+                       LinkSVGImage.linkSVGImage(graph, parent, child.iterator().next());
+                   }
+               }
+               
+    }
+
+       @Override
+       public void onPasteEnd(WriteGraph graph){
+               
+       }
+}