org.eclipse.jface.util.TransferDropTargetListener Maven / Gradle / Ivy
The newest version!
/*******************************************************************************
* Copyright (c) 2000, 2015 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.jface.util;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import org.eclipse.swt.dnd.Transfer;
/**
* A TransferDropTargetListener
is a DropTragetListener
* that handles one type of SWT {@link Transfer}.
* The purpose of a TransferDropTargetListener
is to:
*
* - Determine enablement for a drop operation. A
TransferDropTargetListener
* will not be used if isEnabled
returns false.
* - When enabled, optionally show feedback on the
DropTarget
.
* - Perform the actual drop
*
* A DelegatingDropAdapter
allows these functions to be implemented
* separately for unrelated types of drags. DelegatingDropAdapter
then
* combines the function of each TransferDropTargetListener
, while
* allowing them to be implemented as if they were the only DragSourceListener
.
* @since 3.0
*/
public interface TransferDropTargetListener extends DropTargetListener {
/**
* Returns the Transfer
type that this listener can
* accept a drop operation for.
*
* @return the Transfer
for this listener
*/
Transfer getTransfer();
/**
* Returns true
if this listener can handle the drop
* based on the given DropTargetEvent
.
*
* This method is called by the DelegatingDropAdapter
only
* if the DropTargetEvent
contains a transfer data type
* supported by this listener. The Transfer
returned by the
* #getTransfer()
method is used for this purpose.
*
*
* @param event the drop target event
* @return true
if the listener is enabled for the given
* drop target event.
*/
boolean isEnabled(DropTargetEvent event);
}