]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.diagram/src/org/simantics/diagram/handler/DiagramSelectionRepresentation.java
Migrated source code from Simantics SVN
[simantics/platform.git] / bundles / org.simantics.diagram / src / org / simantics / diagram / handler / DiagramSelectionRepresentation.java
1 /*******************************************************************************\r
2  * Copyright (c) 2012 Association for Decentralized Information Management in\r
3  * Industry THTH ry.\r
4  * All rights reserved. This program and the accompanying materials\r
5  * are made available under the terms of the Eclipse Public License v1.0\r
6  * which accompanies this distribution, and is available at\r
7  * http://www.eclipse.org/legal/epl-v10.html\r
8  *\r
9  * Contributors:\r
10  *     VTT Technical Research Centre of Finland - initial API and implementation\r
11  *******************************************************************************/\r
12 package org.simantics.diagram.handler;\r
13 \r
14 import java.util.Map;\r
15 \r
16 import org.simantics.db.RequestProcessor;\r
17 import org.simantics.db.layer0.util.SimanticsClipboard.Representation;\r
18 import org.simantics.utils.datastructures.hints.IHintContext.Key;\r
19 import org.simantics.utils.datastructures.hints.IHintContext.KeyOf;\r
20 \r
21 /**\r
22  * @author Tuukka Lehtonen\r
23  */\r
24 public class DiagramSelectionRepresentation implements Representation {\r
25 \r
26     /**\r
27      * A key for describing a DiagramSelection representation for the Simantics\r
28      * clipboard.\r
29      */\r
30     public static final Key  KEY_DIAGRAM_SELECTION = new KeyOf(DiagramSelection.class);\r
31 \r
32     private DiagramSelection selection;\r
33 \r
34     public DiagramSelectionRepresentation(DiagramSelection selection) {\r
35         this.selection = selection;\r
36     }\r
37 \r
38     @Override\r
39     public Key getKey() {\r
40         return KEY_DIAGRAM_SELECTION;\r
41     }\r
42 \r
43     @SuppressWarnings("unchecked")\r
44     @Override\r
45     public <T> T getValue(RequestProcessor processor, Map<String,Object> hints) {\r
46         return (T) selection;\r
47     }\r
48 \r
49 }\r