From ee59465e0062d5da37773c8ac4038cacfad7245c Mon Sep 17 00:00:00 2001 From: lehtonen Date: Mon, 24 Aug 2015 12:54:49 +0000 Subject: [PATCH] Merged /sysdyn/trunk/org.simantics.sysdyn.ui:r31610 to /sysdyn/branches/1.9 refs #6001 git-svn-id: https://www.simantics.org/svn/simantics/sysdyn/branches/1.9@31631 ac1ea38d-2e2b-0410-8846-a27921b304fc --- .../sysdyn/ui/handlers/PasteSpecialHandler.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/PasteSpecialHandler.java b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/PasteSpecialHandler.java index 9ed9bde5..9a5e87b5 100644 --- a/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/PasteSpecialHandler.java +++ b/org.simantics.sysdyn.ui/src/org/simantics/sysdyn/ui/handlers/PasteSpecialHandler.java @@ -10,6 +10,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.handlers.HandlerUtil; import org.simantics.Simantics; +import org.simantics.db.exception.DatabaseException; import org.simantics.db.layer0.util.ClipboardUtils; import org.simantics.db.layer0.util.SimanticsClipboard.Representation; import org.simantics.diagram.handler.CopyPasteHandler; @@ -65,7 +66,11 @@ public class PasteSpecialHandler extends AbstractHandler { ICanvasContext ctx = (ICanvasContext) v; CopyPasteHandler handler = ctx.getAtMostOneItemOfClass(CopyPasteHandler.class); if(handler != null) { - handler.paste(Commands.PASTE, getClipboardDiagramSelection()); + try { + handler.paste(Commands.PASTE, getClipboardDiagramSelection()); + } catch (DatabaseException e) { + throw new ExecutionException("Failed to get diagram selection from clipboard", e); + } } } @@ -75,7 +80,7 @@ public class PasteSpecialHandler extends AbstractHandler { return null; } - public DiagramSelection getClipboardDiagramSelection() { + public DiagramSelection getClipboardDiagramSelection() throws DatabaseException { for (Set content : Simantics.getClipboard().getContents()) { DiagramSelection sel = ClipboardUtils.accept(content, DiagramSelectionRepresentation.KEY_DIAGRAM_SELECTION); if (sel != null) -- 2.47.1