View Javadoc

1   /*
2    * This file is a part of CAST project.
3    * (c) Copyright 2007, AGH University of Science & Technology
4    * https://caribou.iisg.agh.edu.pl/trac/cast
5    *
6    * Licensed under the Eclipse Public License, Version 1.0 (the "License").
7    * You may not use this file except in compliance with the License.
8    * You may obtain a copy of the License at
9    * http://www.eclipse.org/legal/epl-v10.html
10   */
11  /*
12   * File: ModelElementTransfer.java
13   * Created: 2007-00-00
14   * Author: fox
15   * $Id: ModelElementTransfer.java 2309 2009-01-12 22:37:58Z tmilos $
16   */
17  
18  package pl.edu.agh.cast.ui.outline.dnd;
19  
20  import org.eclipse.swt.dnd.Transfer;
21  import org.eclipse.swt.dnd.TransferData;
22  
23  /**
24   * Drag'n'drop {@link Transfer} for diagram outline view.
25   *
26   * @author AGH CAST Team
27   */
28  public final class ModelElementTransfer extends Transfer {
29  
30  	private static ModelElementTransfer instance;
31  
32  	private static final String TYPE_NAME = ModelElementTransfer.class.getName();
33  
34  	private static final int TYPEID = registerType(TYPE_NAME);
35  
36  	/**
37  	 * Returns single, shared instance of {@link ModelElementTransfer}.
38  	 *
39  	 * @return single, shared instance of {@link ModelElementTransfer}
40  	 */
41  	public static synchronized ModelElementTransfer getInstance() {
42  		if (instance == null) {
43  			instance = new ModelElementTransfer();
44  		}
45  		return instance;
46  	}
47  
48  	/**
49  	 * {@inheritDoc}
50  	 *
51  	 * @see org.eclipse.swt.dnd.Transfer#getSupportedTypes()
52  	 */
53  	@Override
54  	public TransferData[] getSupportedTypes() {
55  		return new TransferData[0];
56  	}
57  
58  	/**
59  	 * {@inheritDoc}
60  	 *
61  	 * @see org.eclipse.swt.dnd.Transfer#getTypeIds()
62  	 */
63  	@Override
64  	protected int[] getTypeIds() {
65  		return new int[] { TYPEID };
66  	}
67  
68  	/**
69  	 * {@inheritDoc}
70  	 *
71  	 * @see org.eclipse.swt.dnd.Transfer#getTypeNames()
72  	 */
73  	@Override
74  	protected String[] getTypeNames() {
75  		return new String[] { TYPE_NAME };
76  	}
77  
78  	/**
79  	 * {@inheritDoc}
80  	 *
81  	 * @see org.eclipse.swt.dnd.Transfer#isSupportedType(org.eclipse.swt.dnd.TransferData)
82  	 */
83  	@Override
84  	public boolean isSupportedType(TransferData transferData) {
85  		return true;
86  	}
87  
88  	/**
89  	 * {@inheritDoc}
90  	 *
91  	 * @see org.eclipse.swt.dnd.Transfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
92  	 */
93  	@Override
94  	protected void javaToNative(Object object, TransferData transferData) {
95  		throw new UnsupportedOperationException("NYI"); //$NON-NLS-1$
96  	}
97  
98  	/**
99  	 * {@inheritDoc}
100 	 *
101 	 * @see org.eclipse.swt.dnd.Transfer#nativeToJava(org.eclipse.swt.dnd.TransferData)
102 	 */
103 	@Override
104 	protected Object nativeToJava(TransferData transferData) {
105 		throw new UnsupportedOperationException("NYI"); //$NON-NLS-1$
106 	}
107 
108 }