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
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
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