Top Description Fields Constructors Methods
org.eclipse.swt.dnd

public Class TextTransfer

extends ByteArrayTransfer
Class Inheritance
Imports
org.eclipse.swt.internal.*, org.eclipse.swt.internal.gtk.*

The class TextTransfer provides a platform specific mechanism for converting plain text represented as a java String to a platform specific representation of the data and vice versa.

An example of a java String containing plain text is shown below:


    String textData = "Hello World";

Note the TextTransfer does not change the content of the text data. For a better integration with the platform, the application should convert the line delimiters used in the text data to the standard line delimiter used by the platform.

See Also
Transfer

Field Summary

Modifier and TypeField and Description
private static TextTransfer
private static final String
private static final int
private static final String
private static final int
private static final String
private static final int
private static final String
private static final int

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
pack-priv boolean
checkText(Object object)

public static TextTransfer

Returns:

the singleton instance of the TextTransfer class
getInstance
()

Returns the singleton instance of the TextTransfer class.

protected int[]
getTypeIds()

Implements abstract org.eclipse.swt.dnd.Transfer.getTypeIds.

Returns the platform specific ids of the data types that can be converted using this transfer agent.
protected String[]
getTypeNames()

Implements abstract org.eclipse.swt.dnd.Transfer.getTypeNames.

Returns the platform specific names of the data types that can be converted using this transfer agent.
public void
javaToNative(Object
a java String containing text
object
,
TransferData
an empty TransferData object that will be filled in on return with the platform specific format of the data
transferData
)

Overrides org.eclipse.swt.dnd.ByteArrayTransfer.javaToNative.

This implementation of javaToNative converts plain text represented by a java String to a platform specific representation.
public Object

Returns:

a java String containing text if the conversion was successful; otherwise null
nativeToJava
(TransferData
the platform specific representation of the data to be converted
transferData
)

Overrides org.eclipse.swt.dnd.ByteArrayTransfer.nativeToJava.

This implementation of nativeToJava converts a platform specific representation of plain text to a java String.
protected boolean
validate(Object
a java representation of the data to be converted
object
)

Overrides org.eclipse.swt.dnd.Transfer.validate.

Test that the object is of the correct format for this Transfer class.
Inherited from org.eclipse.swt.dnd.ByteArrayTransfer:
checkByteArraygetSupportedTypesisSupportedType

Field Detail

_instanceback to summary
private static TextTransfer _instance
COMPOUND_TEXTback to summary
private static final String COMPOUND_TEXT
COMPOUND_TEXT_IDback to summary
private static final int COMPOUND_TEXT_ID
STRINGback to summary
private static final String STRING
STRING_IDback to summary
private static final int STRING_ID
TEXT_PLAIN_UTF8back to summary
private static final String TEXT_PLAIN_UTF8
TEXT_PLAIN_UTF8_IDback to summary
private static final int TEXT_PLAIN_UTF8_ID
UTF8_STRINGback to summary
private static final String UTF8_STRING
UTF8_STRING_IDback to summary
private static final int UTF8_STRING_ID

Constructor Detail

TextTransferback to summary
private TextTransfer()

Method Detail

checkTextback to summary
pack-priv boolean checkText(Object object)
getInstanceback to summary
public static TextTransfer getInstance()

Returns the singleton instance of the TextTransfer class.

Returns:TextTransfer

the singleton instance of the TextTransfer class

getTypeIdsback to summary
protected int[] getTypeIds()

Implements abstract org.eclipse.swt.dnd.Transfer.getTypeIds.

Doc from org.eclipse.swt.dnd.Transfer.getTypeIds.

Returns the platform specific ids of the data types that can be converted using this transfer agent.

Returns:int[]

the platform specific ids of the data types that can be converted using this transfer agent

Annotations
@Override
getTypeNamesback to summary
protected String[] getTypeNames()

Implements abstract org.eclipse.swt.dnd.Transfer.getTypeNames.

Doc from org.eclipse.swt.dnd.Transfer.getTypeNames.

Returns the platform specific names of the data types that can be converted using this transfer agent.

Returns:String[]

the platform specific names of the data types that can be converted using this transfer agent.

Annotations
@Override
javaToNativeback to summary
public void javaToNative(Object object, TransferData transferData)

Overrides org.eclipse.swt.dnd.ByteArrayTransfer.javaToNative.

This implementation of javaToNative converts plain text represented by a java String to a platform specific representation.

Parameters
object:Object

a java String containing text

transferData:TransferData

an empty TransferData object that will be filled in on return with the platform specific format of the data

Annotations
@Override
See Also
Transfer#nativeToJava
nativeToJavaback to summary
public Object nativeToJava(TransferData transferData)

Overrides org.eclipse.swt.dnd.ByteArrayTransfer.nativeToJava.

This implementation of nativeToJava converts a platform specific representation of plain text to a java String.

Parameters
transferData:TransferData

the platform specific representation of the data to be converted

Returns:Object

a java String containing text if the conversion was successful; otherwise null

Annotations
@Override
See Also
Transfer#javaToNative
validateback to summary
protected boolean validate(Object object)

Overrides org.eclipse.swt.dnd.Transfer.validate.

Doc from org.eclipse.swt.dnd.Transfer.validate.

Test that the object is of the correct format for this Transfer class.

Parameters
object:Object

a java representation of the data to be converted

Returns:boolean

true if object is of the correct form for this transfer type

Annotations
@Override