Skip to content

Package: DNDProvider

DNDProvider

Coverage

1: /*******************************************************************************
2: * Copyright (c) 2011-2015 EclipseSource Muenchen GmbH and others.
3: *
4: * All rights reserved. This program and the accompanying materials
5: * are made available under the terms of the Eclipse Public License 2.0
6: * which accompanies this distribution, and is available at
7: * https://www.eclipse.org/legal/epl-2.0/
8: *
9: * SPDX-License-Identifier: EPL-2.0
10: *
11: * Contributors:
12: * Johannes Faltermeier - initial API and implementation
13: ******************************************************************************/
14: package org.eclipse.emfforms.spi.swt.treemasterdetail;
15:
16: import org.eclipse.emf.edit.domain.EditingDomain;
17: import org.eclipse.jface.viewers.TreeViewer;
18: import org.eclipse.swt.dnd.DragSourceListener;
19: import org.eclipse.swt.dnd.DropTargetListener;
20: import org.eclipse.swt.dnd.Transfer;
21:
22: /**
23: * Interface to influence the D&D support which is added to the tree master detail.
24: *
25: * @author Johannes Faltermeier
26: *
27: */
28: public interface DNDProvider {
29:
30:         /**
31:          * Whether DND support should be added to the tree.
32:          *
33:          * @return <code>true</code> if DND will be added, based on the other methods of this interface, or
34:          * <code>false</code> if DND should not be added
35:          */
36:         boolean hasDND();
37:
38:         /**
39:          * Returns the drag operations bits used to setup the
40:          * {@link TreeViewer#addDragSupport(int, Transfer[], DragSourceListener) drag support} for the viewer.
41:          *
42:          * @return the drag operations
43:          */
44:         int getDragOperations();
45:
46:         /**
47:          * Returns the drag transfer types used to setup the
48:          * {@link TreeViewer#addDragSupport(int, Transfer[], DragSourceListener) drag support} for the viewer.
49:          *
50:          * @return the drag {@link Transfer transfer types}
51:          */
52:         Transfer[] getDragTransferTypes();
53:
54:         /**
55:          * Returns the {@link DragSourceListener} used to setup the
56:          * {@link TreeViewer#addDragSupport(int, Transfer[], DragSourceListener) drag support} for the viewer.
57:          *
58:          * @param treeViewer the treeviewer
59:          * @return the listener
60:          */
61:         DragSourceListener getDragListener(TreeViewer treeViewer);
62:
63:         /**
64:          * Returns the drag operations bits used to setup the
65:          * {@link TreeViewer#addDropSupport(int, Transfer[], DropTargetListener) drop support} for the viewer.
66:          *
67:          * @return the drop operations
68:          */
69:         int getDropOperations();
70:
71:         /**
72:          * Returns the drag transfer types used to setup the
73:          * {@link TreeViewer#addDropSupport(int, Transfer[], DropTargetListener) drop support} for the viewer.
74:          *
75:          * @return the drop {@link Transfer transfer types}
76:          */
77:         Transfer[] getDropTransferTypes();
78:
79:         /**
80:          * Returns the {@link DragSourceListener} used to setup the
81:          * {@link TreeViewer#addDropSupport(int, Transfer[], DropTargetListener) drop support} for the viewer.
82:          *
83:          * @param editingDomain the editing domain
84:          * @param treeViewer the treeviewer
85:          * @return the listener
86:          */
87:         DropTargetListener getDropListener(EditingDomain editingDomain, TreeViewer treeViewer);
88:
89: }