本文整理汇总了Java中org.eclipse.swt.dnd.DND.error方法的典型用法代码示例。如果您正苦于以下问题:Java DND.error方法的具体用法?Java DND.error怎么用?Java DND.error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.swt.dnd.DND
的用法示例。
在下文中一共展示了DND.error方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative (Object object, TransferData transferData) {
if (!checkCustom(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
byte [] bytes = null;
if (object instanceof ByteBuffer) {
bytes = ((ByteBuffer)object).array();
} else {
if (object instanceof byte []) {
bytes = (byte []) object;
}
}
if (bytes == null) {
DND.error(DND.ERROR_INVALID_DATA);
}
super.javaToNative(bytes, transferData);
}
示例2: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative(Object object, TransferData transferData) {
if (!checkMyType(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
MyDummyType2 myTypes = (MyDummyType2) object;
try {
// write data to a byte array and then ask super to convert to
// pMedium
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream writeOut = new DataOutputStream(out);
writeOut.writeInt(myTypes.dummy);
byte[] buffer2 = out.toByteArray();
writeOut.close();
super.javaToNative(buffer2, transferData);
} catch (IOException e) {
}
}
示例3: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative(Object object, TransferData transferData) {
if (!checkMyType(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
MyDummyType myTypes = (MyDummyType) object;
try {
// write data to a byte array and then ask super to convert to
// pMedium
ByteArrayOutputStream out = new ByteArrayOutputStream();
DataOutputStream writeOut = new DataOutputStream(out);
writeOut.writeInt(myTypes.dummy);
byte[] buffer2 = out.toByteArray();
writeOut.close();
super.javaToNative(buffer2, transferData);
} catch (IOException e) {
}
}
示例4: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative(Object object, TransferData transferData) {
try {
if (!checkMyType(object) || !isSupportedType(transferData)) {
MessageDialog.openError(Application.getShell(), "Error", "You cannot drop this item here!");
DND.error(DND.ERROR_INVALID_DATA);
}
Server server = (Server) object;
// write data to a byte array and then ask super to convert to pMedium
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream writeOut = new ObjectOutputStream(out);
writeOut.writeObject(server);
byte[] buffer = out.toByteArray();
writeOut.close();
super.javaToNative(buffer, transferData);
} catch (IOException e) {
}
}
示例5: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative(Object object, TransferData transferData) {
try {
if (!checkMyType(object) || !isSupportedType(transferData)) {
MessageDialog.openError(Application.getShell(), "Error", "You cannot drop this item here!");
DND.error(DND.ERROR_INVALID_DATA);
}
I2b2Project server = (I2b2Project) object;
// write data to a byte array and then ask super to convert to pMedium
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream writeOut = new ObjectOutputStream(out);
writeOut.writeObject(server);
byte[] buffer = out.toByteArray();
writeOut.close();
super.javaToNative(buffer, transferData);
} catch (IOException e) {
}
}
示例6: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
public void javaToNative(Object object, TransferData transferData)
{
if (!checkColumnModel(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
ColumnModel[] cols = (ColumnModel[]) object;
try {
ByteArrayOutputStream out = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(out);
DataOutputStream writeOut = new DataOutputStream(out);
oos.writeObject(cols);
byte[] buffer = out.toByteArray();
writeOut.close();
super.javaToNative(buffer, transferData);
} catch (IOException e) {
e.printStackTrace();
}
}
示例7: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
@Override
public void javaToNative(final Object object, final TransferData transferData) {
if (!validate(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
super.javaToNative(Serializer.serialize(object), transferData);
}
示例8: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
public void javaToNative(Object object, TransferData transferData) {
if (!checkMyType(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
String string = (String) object;
byte[] bytes = string.getBytes();
if (bytes != null) {
super.javaToNative(bytes, transferData);
}
}
示例9: javaToNative
import org.eclipse.swt.dnd.DND; //导入方法依赖的package包/类
public void javaToNative(Object object, TransferData transferData) {
if (!checkMyType(object) || !isSupportedType(transferData)) {
DND.error(DND.ERROR_INVALID_DATA);
}
String string = (String)object;
byte[] bytes = string.getBytes();
if (bytes != null) {
super.javaToNative(bytes, transferData);
}
}