Implemented drag and drop for description elements as well as the functionality to...
[taxeditor.git] / taxeditor-editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / DescriptionElementTransfer.java
1 // $Id$
2 /**
3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
6 *
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
9 */
10
11 package eu.etaxonomy.taxeditor.editor.view.descriptive;
12
13 import java.util.UUID;
14
15 import eu.etaxonomy.cdm.api.service.IDescriptionService;
16 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
17 import eu.etaxonomy.taxeditor.model.CdmObjectTransfer;
18 import eu.etaxonomy.taxeditor.store.CdmStore;
19
20 /**
21 * @author n.hoffmann
22 * @created Feb 8, 2011
23 * @version 1.0
24 */
25 public class DescriptionElementTransfer extends CdmObjectTransfer<DescriptionElementBase> {
26
27 private static DescriptionElementTransfer instance = new DescriptionElementTransfer();
28 private static final String TYPE_NAME = "descriptionElement-transfer-format";
29 private static final int TYPEID = registerType(TYPE_NAME);
30
31 public static synchronized DescriptionElementTransfer getInstance(){
32 return instance;
33 }
34
35 private DescriptionElementTransfer(){}
36
37 /* (non-Javadoc)
38 * @see org.eclipse.swt.dnd.Transfer#getTypeIds()
39 */
40 @Override
41 protected int[] getTypeIds() {
42 return new int[] { TYPEID };
43 }
44
45 /* (non-Javadoc)
46 * @see org.eclipse.swt.dnd.Transfer#getTypeNames()
47 */
48 @Override
49 protected String[] getTypeNames() {
50 return new String[] { TYPE_NAME };
51 }
52
53 /* (non-Javadoc)
54 * @see eu.etaxonomy.taxeditor.model.CdmObjectTransfer#loadElement(java.util.UUID)
55 */
56 @Override
57 public DescriptionElementBase loadElement(UUID uuid) {
58 return CdmStore.getService(IDescriptionService.class).loadDescriptionElement(uuid, null);
59 }
60 }