]> gerrit.simantics Code Review - simantics/sysdyn.git/commitdiff
Merged /sysdyn/trunk/org.simantics.sysdyn.ui:r31610 to /sysdyn/branches/1.9 1.9
authorlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 24 Aug 2015 12:54:49 +0000 (12:54 +0000)
committerlehtonen <lehtonen@ac1ea38d-2e2b-0410-8846-a27921b304fc>
Mon, 24 Aug 2015 12:54:49 +0000 (12:54 +0000)
refs #6001

git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/1.9@31631 ac1ea38d-2e2b-0410-8846-a27921b304fc

org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/PasteSpecialHandler.java

index 9ed9bde5af005655fab528805e4ae2e45a146a0f..9a5e87b5f28a3758f01901e637553ca8fb5a2ba2 100644 (file)
@@ -10,6 +10,7 @@ import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IEditorPart;\r
 import org.eclipse.ui.handlers.HandlerUtil;\r
 import org.simantics.Simantics;\r
+import org.simantics.db.exception.DatabaseException;\r
 import org.simantics.db.layer0.util.ClipboardUtils;\r
 import org.simantics.db.layer0.util.SimanticsClipboard.Representation;\r
 import org.simantics.diagram.handler.CopyPasteHandler;\r
@@ -65,7 +66,11 @@ public class PasteSpecialHandler extends AbstractHandler {
                 ICanvasContext ctx = (ICanvasContext) v;\r
                 CopyPasteHandler handler = ctx.getAtMostOneItemOfClass(CopyPasteHandler.class);\r
                 if(handler != null) {\r
-                    handler.paste(Commands.PASTE, getClipboardDiagramSelection());\r
+                    try {\r
+                        handler.paste(Commands.PASTE, getClipboardDiagramSelection());\r
+                    } catch (DatabaseException e) {\r
+                        throw new ExecutionException("Failed to get diagram selection from clipboard", e);\r
+                    }\r
                 }\r
             }\r
 \r
@@ -75,7 +80,7 @@ public class PasteSpecialHandler extends AbstractHandler {
         return null;\r
     }\r
     \r
-    public DiagramSelection getClipboardDiagramSelection() {\r
+    public DiagramSelection getClipboardDiagramSelection() throws DatabaseException {\r
         for (Set<Representation> content : Simantics.getClipboard().getContents()) {\r
             DiagramSelection sel = ClipboardUtils.accept(content, DiagramSelectionRepresentation.KEY_DIAGRAM_SELECTION);\r
             if (sel != null)\r