ITransferDriver Interface

com.bea.ide.core.datatransfer
ITransferDriver Interface

public interface ITransferDriver

Methods for handling transfer of data to and from a view's data model.

The shell's Cut, Copy, Paste, and Delete actions uses this interface to move Transferables to and from the clipboard. To participate in cut/copy/paste, an IDocumentView must have an ITransferDriver implementation added as a driver. It is also must set the IDocumentView.PROP_SelectedElement property with an IElement when a selection change occurs.

Non-document views need to implement IDriverSupport and IPropertySupport


All Known Implementing Classes
DefaultTransferDriver

Method Summary

public boolean
canImport(DataFlavor[] rgFlavors)
Indicates whether the view would accept an import of a transferable with the given DataFlavors
public boolean
canImport(Transferable t)
Indicates whether the view would accept an import of the given Transferable prior to actually attempting to import it.
public Transferable
createTransferable(IElement el, int action)
Creates a Transferable to use as the source for a data transfer.
public boolean
delete(IElement el)
Called to delete the currently selected elements in the data model.
public boolean
importData(Transferable t)
Causes a transfer to the view of a Transferable.
public boolean
isDeleteable(IElement el)
Indicates whether the given IElement can be deleted.
public boolean
isTransferable(IElement el, int actions)
Indicates whether a Transferable for the given IElement can be created.
public boolean
transferComplete(Transferable t, boolean success, int action)
Called on the source of a drag and drop or cut/copy when the drop/paste operation is completed.

Method Detail

canImport(DataFlavor[]) Method

public boolean canImport(DataFlavor[] rgFlavors)
Indicates whether the view would accept an import of a transferable with the given DataFlavors

Parameters

rgFlavors
Array of data flavors for the current transferable

Returns

true if the data can be inserted, false otherwise

canImport(Transferable) Method

public boolean canImport(Transferable t)
Indicates whether the view would accept an import of the given Transferable prior to actually attempting to import it. Generally the view will only need to check the Transferable's set of data flavors. The shell's Paste action will call this method to determine if the current clipboard content may be inserted.

Parameters

t
Transferable to test for import

Returns

true if the data can be inserted, false otherwise

createTransferable(IElement, int) Method

public Transferable createTransferable(IElement el, 
                                       int action)
Creates a Transferable to use as the source for a data transfer. Returns the representation of the data to be transferred. The shell's Cut and Copy actions will use this method to get the Transferable to place in the clipboard.

Parameters

el
IElement that is the current Application selected element, may be null.

Returns

Transferable representation of the data to be transferred, may be null.

delete(IElement) Method

public boolean delete(IElement el)
Called to delete the currently selected elements in the data model. The shell's Cut and Delete actions will call this method.

Parameters

el
IElement that is the current Application selected element, may be null.

Returns

true if the data was deleted, false otherwise

importData(Transferable) Method

public boolean importData(Transferable t)
Causes a transfer to the view of a Transferable. The Transferable represents the data to be imported into the component. The shell Paste action will call this method.

Parameters

t
the data to import

Returns

true if the data was inserted into the view, false otherwise

isDeleteable(IElement) Method

public boolean isDeleteable(IElement el)
Indicates whether the given IElement can be deleted. The shell's Cut and Delete action will use this method to determine enabling.

Parameters

el
IElement that is the current Application selected element, may be null.

Returns

true if the data may be deleted, false otherwise

isTransferable(IElement, int) Method

public boolean isTransferable(IElement el, 
                              int actions)
Indicates whether a Transferable for the given IElement can be created. The shell's Cut and Copy actions will use this method to determine enabling.

Parameters

el
IElement that is the current Application selected element, may be null.
actions
Actions that should be checked for transferability

transferComplete(Transferable, boolean, int) Method

public boolean transferComplete(Transferable t, 
                                boolean success, 
                                int action)
Called on the source of a drag and drop or cut/copy when the drop/paste operation is completed. This should be used to handle any results based on the type of action, or cleanup any visual changes due to the start of a drag and drop.

Parameters

t
Transferable that was used in the transfer
success
Boolean value indicating whether or not the drop completed successfully
action
DnDConstants integer value indicating the type of action the drop represented

Returns

boolean value indicating whether the given transferable is still valid. This is used for example, to clear the clipboard, if the transferable isn't valid anymore