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