1 /*******************************************************************************
2 * Copyright (c) 2000, 2011 IBM Corporation and others.
4 * 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/
9 * SPDX-License-Identifier: EPL-2.0
12 * IBM Corporation - initial API and implementation
13 *******************************************************************************/
14 package org.eclipse.swt.dnd;
16 import org.eclipse.swt.internal.*;
19 * The <code>DragSourceListener</code> class provides event notification to the application for DragSource events.
21 * <p>When the user drops data on a <code>DropTarget</code>, the application which defines the <code>DragSource</code>
22 * must provide the dropped data by implementing <code>dragSetData</code>. In the dragSetData, the application
23 * must support all the data types that were specified in the DragSource#setTransfer method.</p>
25 * <p>After the drop has completed successfully or has been aborted, the application which defines the
26 * <code>DragSource</code> is required to take the appropriate cleanup action. In the case of a successful
27 * <b>move</b> operation, the application must remove the data that was transferred.</p>
30 public interface DragSourceListener extends SWTEventListener {
33 * The user has begun the actions required to drag the widget. This event gives the application
34 * the chance to decide if a drag should be started.
36 * <p>The following fields in the DragSourceEvent apply:</p>
43 * @param event the information associated with the drag start event
45 * @see DragSourceEvent
47 public void dragStart(DragSourceEvent event);
50 * The data is required from the drag source.
52 * <p>The following fields in the DragSourceEvent apply:</p>
56 * <li>(in)dataType - the type of data requested.
57 * <li>(out)data - the application inserts the actual data here (must match the dataType)
58 * <li>(out)doit - set this to cancel the drag
61 * @param event the information associated with the drag set data event
63 * @see DragSourceEvent
65 public void dragSetData(DragSourceEvent event);
68 * The drop has successfully completed(mouse up over a valid target) or has been terminated (such as hitting
69 * the ESC key). Perform cleanup such as removing data from the source side on a successful move operation.
71 * <p>The following fields in the DragSourceEvent apply:</p>
79 * @param event the information associated with the drag finished event
81 * @see DragSourceEvent
83 public void dragFinished(DragSourceEvent event);