Java 类org.eclipse.swt.dnd.TransferData 实例源码

项目:JavaFX-FrameRateMeter    文件:CustomTransfer.java   
@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);
}
项目:BiglyBT    文件:FixedURLTransfer.java   
@Override
public Object nativeToJava(TransferData transferData) {
    Object result = urlTransfer.nativeToJava(transferData);
    if (DISABLED || result != null) {
        return result;
    }

    if (DEBUG) System.out.println("nativeToJava called");
    try {
        if (isSupportedType(transferData)) {
            byte [] buffer = (byte[]) super.nativeToJava(transferData);
            return bytebufferToJava(buffer);
        }
    } catch (Exception e) {
        Debug.out(e);
    }

    return null;
}
项目:javapasswordsafe    文件:PwsEntryBeanTransfer.java   
@Override
protected void javaToNative(final Object object, final TransferData transferData) {
    if (object instanceof Integer) {
        final byte[] bytes = ByteBuffer.allocate(4).putInt((Integer) object).array();

        if (bytes != null) {
            super.javaToNative(bytes, transferData);
        }
    } else if (object instanceof String) {
        if (! TextTransfer.getInstance().isSupportedType(transferData)) {
            // FIXME this is a hack - works on Linux x64...
            // no danger for now as treegroups are disabled on drag side
            long type =  transferData.type;
            for (final TransferData data : TextTransfer.getInstance().getSupportedTypes()) {
                type = data.type;
            }
            // on 32bit you need int instead of long, to avoid compile errors there use this here
            transferData.type = (int) type;
        }
        TextTransfer.getInstance().javaToNative(object, transferData);
    }
}
项目:mesfavoris    文件:BookmarksViewerDropListener.java   
private IStructuredSelection getStructuredSelection(Object data, TransferData currentDataType) {
    if (LocalSelectionTransfer.getTransfer().isSupportedType(currentDataType)) {
        return (IStructuredSelection) data;
    }
    if (URLTransfer.getInstance().isSupportedType(currentDataType)) {
        try {
            return new StructuredSelection(new URL((String) data));
        } catch (MalformedURLException e) {
            // ignore
        }
    }
    if (FileTransfer.getInstance().isSupportedType(currentDataType)) {
        return new StructuredSelection(Arrays.stream((String[]) data).map(Path::new).collect(Collectors.toList()));
    }
    return new StructuredSelection();
}
项目:cft    文件:ServicesViewerDropListener.java   
@Override
    public boolean validateDrop(Object target, int operation, TransferData type) {
        overrideOperation(DND.DROP_COPY);
//      if (application == null)
//          return false;

        if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
            if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
                IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
                        .getSelection();
                Object[] objects = selection.toArray();
                for (Object obj : objects) {
                    if (obj instanceof CFServiceInstance) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
项目:dockerfoundry    文件:ServicesViewerDropListener.java   
@Override
    public boolean validateDrop(Object target, int operation, TransferData type) {
        overrideOperation(DND.DROP_COPY);
//      if (application == null)
//          return false;

        if (operation == DND.DROP_COPY || operation == DND.DROP_DEFAULT) {
            if (LocalSelectionTransfer.getTransfer().isSupportedType(type)) {
                IStructuredSelection selection = (IStructuredSelection) LocalSelectionTransfer.getTransfer()
                        .getSelection();
                Object[] objects = selection.toArray();
                for (Object obj : objects) {
                    if (obj instanceof CloudService) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
项目:ldparteditor    文件:MyDummyTransfer2.java   
@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) {
    }
}
项目:ldparteditor    文件:MyDummyTransfer2.java   
@Override
public Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        byte[] buffer = (byte[]) super.nativeToJava(transferData);
        if (buffer == null)
            return null;

        MyDummyType2 datum = new MyDummyType2();
        try {
            ByteArrayInputStream in = new ByteArrayInputStream(buffer);
            DataInputStream readIn = new DataInputStream(in);
            datum.dummy = readIn.readInt();
            readIn.close();
        } catch (IOException ex) {
            return null;
        }
        return datum;
    }

    return null;
}
项目:ldparteditor    文件:MyDummyTransfer.java   
@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) {
    }
}
项目:ldparteditor    文件:MyDummyTransfer.java   
@Override
public Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        byte[] buffer = (byte[]) super.nativeToJava(transferData);
        if (buffer == null)
            return null;

        MyDummyType datum = new MyDummyType();
        try {
            ByteArrayInputStream in = new ByteArrayInputStream(buffer);
            DataInputStream readIn = new DataInputStream(in);
            datum.dummy = readIn.readInt();
            readIn.close();
        } catch (IOException ex) {
            return null;
        }
        return datum;
    }

    return null;
}
项目:IDRT-Import-and-Mapping-Tool    文件:ServerTransferType.java   
@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) {

    }
}
项目:IDRT-Import-and-Mapping-Tool    文件:ServerTransferType.java   
@Override
public Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        byte[] buffer = (byte[]) super.nativeToJava(transferData);
        if (buffer == null)
            return null;

        Server server;
        try {
            ByteArrayInputStream in = new ByteArrayInputStream(buffer);
            ObjectInputStream readIn = new ObjectInputStream(in);
            server = (Server) readIn.readObject();

            readIn.close();
        } catch (IOException | ClassNotFoundException ex) {
            return null;
        }
        return server;
    }

    return null;
}
项目:IDRT-Import-and-Mapping-Tool    文件:I2b2ProjectTransferType.java   
@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) {

    }
}
项目:IDRT-Import-and-Mapping-Tool    文件:I2b2ProjectTransferType.java   
@Override
public Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        byte[] buffer = (byte[]) super.nativeToJava(transferData);
        if (buffer == null)
            return null;

        I2b2Project server;
        try {
            ByteArrayInputStream in = new ByteArrayInputStream(buffer);
            ObjectInputStream readIn = new ObjectInputStream(in);
            server = (I2b2Project) readIn.readObject();

            readIn.close();
        } catch (IOException | ClassNotFoundException ex) {
            return null;
        }
        return server;
    }

    return null;
}
项目:APICloud-Studio    文件:SnippetTransfer.java   
@Override
protected void javaToNative(Object object, TransferData transferData)
{
    if (object instanceof SnippetElement)
    {
        SnippetElement snippetElement = (SnippetElement) object;
        byte[] bytes = getBytes(snippetElement);
        if (bytes != null)
        {
            super.javaToNative(bytes, transferData);
        }
    }
    else
    {
        super.javaToNative(object, transferData);
    }
}
项目:mytourbook    文件:CalendarGraph.java   
@Override
protected Object nativeToJava(final TransferData transferData) {

    try {

        final byte[] bytes = (byte[]) super.nativeToJava(transferData);
        final ByteArrayInputStream in = new ByteArrayInputStream(bytes);
        final DataInputStream dataIn = new DataInputStream(in);

        final CalendarTourData calendarTourData = new CalendarTourData();

        final long tourId = dataIn.readLong();
        calendarTourData.typeColorIndex = dataIn.readInt();

        return new CalendarItemTransferData(tourId, calendarTourData);

    } catch (final IOException e) {
        e.printStackTrace();
    }

    //can't get here
    return null;
}
项目:jo-widgets    文件:SwtClipboard.java   
private ITransferableSpi getContents(final Clipboard clipboard) {
    final Map<TransferTypeSpi, Object> transferMap = new LinkedHashMap<TransferTypeSpi, Object>();
    for (final TransferData transferData : clipboard.getAvailableTypes()) {
        if (TEXT_TRANSFER.isSupportedType(transferData)) {
            transferMap.put(new TransferTypeSpi(String.class), clipboard.getContents(TEXT_TRANSFER));
        }
        else if (OBJECT_TRANSFER.isSupportedType(transferData)) {
            final Object data = clipboard.getContents(OBJECT_TRANSFER);
            if (data instanceof TransferContainer) {
                for (final TransferObject transferObject : ((TransferContainer) data).getTransferObjetcs()) {
                    transferMap.put(transferObject.getTransferType(), transferObject.getData());
                }
            }
        }
    }
    if (!transferMap.isEmpty()) {
        return new TransferableSpiAdapter(transferMap);
    }
    else {
        return null;
    }
}
项目:OpenSPIFe    文件:MergeTreeContentProvider.java   
@Override
public IUndoableOperation createDropOperation(Object targetElement, InsertionSemantics semantics, TransferData currentDataType, int detail, Object data) {
    ITransferable transferable = TransferRegistry.getInstance().getDroppedObjects(data, currentDataType);
    if (!(transferable instanceof IPlanElementTransferable)) {
        return null;
    }
    StructuredSelection targetSelection = new StructuredSelection(targetElement);
    if (detail == DND.DROP_COPY) {
        transferable = getStructureModifier().copy(transferable);
    }
    IStructureModifier structureModifier = getStructureModifier();
    IStructureLocation location = structureModifier.getInsertionLocation(transferable, targetSelection, semantics);
    IUndoableOperation operation = createDropOperation(currentDataType, detail, structureModifier, (IPlanElementTransferable)transferable, (PlanStructureLocation)location);
    operation = PlanStructureOperationContributor.addContributorOperations(operation, (IPlanElementTransferable)transferable, (PlanStructureLocation)location);
    return operation;
}
项目:OpenSPIFe    文件:TransferRegistry.java   
/**
 * Return whether or not the dragged transferable is cached
 * 
 * @param object
 * @param dataType
 * @return whether or not the dragged transferable is cached
 */
private boolean isDraggedTransferableCached(Object object, TransferData dataType) {
    if (cachedDraggedTransfer == null) {
        return false;
    }
    if (!cachedDraggedTransfer.isSupportedType(dataType)) {
        return false;
    }
    if (object.equals(cachedDraggedObject)) {
        return true;
    }
    // Andrew: this is less than ideal, but we can't use the nice marker method
    // that we did on the clipboard. at least this works and is efficient.
    if ((object instanceof byte[]) && (cachedDraggedObject instanceof byte[])) {
        return Arrays.equals((byte[]) object, (byte[]) cachedDraggedObject);
    }
    return false;
}
项目:OpenSPIFe    文件:ClipboardPasteOperation.java   
protected boolean somethingAvailable() {
    final Display display = WidgetUtils.getDisplay();
    final TransferData[][] typesArray = new TransferData[1][];
    display.syncExec(new Runnable() {
        @Override
        public void run() {
            Clipboard clipboard = ClipboardServer.instance.getClipboard(display);
            typesArray[0] = clipboard.getAvailableTypes();
        }
    });
    TransferData[] types = typesArray[0];
    if ((types == null) || (types.length == 0)) {
        return false;
    }
    List<TransferData> acceptableTypes = new ArrayList<TransferData>();
    for (TransferData type : types) {
        if (modifier.canInsert(type, targetSelection, InsertionSemantics.ON)) {
            acceptableTypes.add(type);
        }
    }
    if (acceptableTypes.isEmpty()) {
        return false;
    }
    this.acceptableTypes = Collections.unmodifiableList(acceptableTypes);
    return true;
}
项目:OpenSPIFe    文件:SerializableTransfer.java   
/**
 * This implementation of <code>javaToNative</code> converts a java 
 * <code>byte[]</code> to a platform specific representation.  For additional
 * information see <code>Transfer#javaToNative</code>.
 * 
 * @see Transfer#javaToNative
 * 
 * @param object a java <code>byte[]</code> containing the data to be converted
 * @param transferData an empty <code>TransferData</code> object; this
 *  object will be filled in on return with the platform specific format of the data
 */ 
@Override
public void javaToNative (Object object, TransferData transferData) {
    if (object == null || !(object instanceof Serializable[])) return;

    if (isSupportedType(transferData)) {
        Serializable[] activities = (Serializable[]) object;

        // write data to a byte array and then ask super to convert to a
        // platform specific representation
        ByteArrayOutputStream bos = new ByteArrayOutputStream();
        try {
            ObjectOutputStream oos = new ObjectOutputStream(bos);
            oos.writeObject(activities);
            oos.flush();
            oos.close();
            bos.close();
            super.javaToNative(bos.toByteArray(), transferData);
        }
        catch (IOException ioe) {
            trace.error("Error serializing Serializable for drag and drop.",ioe);
        }
    }
}
项目:OpenSPIFe    文件:EnsembleDropTargetListener.java   
/**
 * The application can also change the type of data being requested by 
 * modifying the currentDataTypes field but the value must be one of 
 * the values in the dataTypes list.
 * 
 * @param currentDataType
 */
public final void setCurrentDataType(TransferData currentDataType) {
    if (event.dataTypes != null) {
        boolean currentDataTypeOkay = false;
        for (TransferData data : event.dataTypes) {
            if (currentDataType == data) {
                currentDataTypeOkay = true;
                break;
            }
        }
        if (currentDataTypeOkay) {
            event.currentDataType = currentDataType;
        } else {
            throw new IllegalArgumentException("The application can change the type of data being requested by modifying the currentDataTypes field but the value must be one of the values in the dataTypes list.");
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:TypedSourceTransfer.java   
@Override
protected Object nativeToJava(TransferData transferData) {

    byte[] bytes = (byte[]) super.nativeToJava(transferData);
    if (bytes == null)
        return null;
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        int count = in.readInt();
        TypedSource[] results = new TypedSource[count];
        for (int i = 0; i < count; i++) {
            results[i] = readJavaElement(in);
            Assert.isNotNull(results[i]);
        }
        in.close();
        return results;
    } catch (IOException e) {
        return null;
    }
}
项目:geokettle-2.0    文件:XMLTransfer.java   
public Object nativeToJava(TransferData transferData)
{
    if (isSupportedType(transferData))
    {
        try
        {
            byte[] buffer = (byte[]) super.nativeToJava(transferData);
            String xml = new String(Base64.decodeBase64(new String(buffer).getBytes()));
            return new DragAndDropContainer(xml);
        }
        catch (Exception e)
        {
            LogWriter.getInstance().logError(toString(),
                    "Unexpected error trying to read a drag and drop container from the XML Transfer type: " + e.toString());
            LogWriter.getInstance().logError(toString(), Const.getStackTracker(e));
            return null;
        }
    }
    return null;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:FileTransferDropAdapter.java   
/**
 * {@inheritDoc}
 */
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {

    boolean isPackageFragment= target instanceof IPackageFragment;
    boolean isJavaProject= target instanceof IJavaProject;
    boolean isPackageFragmentRoot= target instanceof IPackageFragmentRoot;
    boolean isContainer= target instanceof IContainer;

    if (!(isPackageFragment || isJavaProject || isPackageFragmentRoot || isContainer))
        return DND.DROP_NONE;

    if (isContainer) {
        IContainer container= (IContainer)target;
        if (container.isAccessible() && !Resources.isReadOnly(container))
            return DND.DROP_COPY;
    } else {
        IJavaElement element= (IJavaElement)target;
        if (!element.isReadOnly())
            return DND.DROP_COPY;
    }

    return DND.DROP_NONE;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaElementTransfer.java   
@Override
protected Object nativeToJava(TransferData transferData) {
    /*
     * The element serialization format is:
     *  (int) number of element
     * Then, the following for each element:
     *  (String) handle identifier
     */

    byte[] bytes= (byte[]) super.nativeToJava(transferData);
    if (bytes == null)
        return null;
    DataInputStream in= new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        int count= in.readInt();
        IJavaElement[] results= new IJavaElement[count];
        for (int i= 0; i < count; i++) {
            results[i]= readJavaElement(in);
        }
        return results;
    } catch (IOException e) {
        return null;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CallHierarchyTransferDropAdapter.java   
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {
    setSelectionFeedbackEnabled(false);
    setExpandEnabled(false);

    initializeSelection();

    if (target != null) {
        return super.determineOperation(target, operation, transferType, operations);
    } else if (getInputElement(getSelection()) != null) {
        setSelectionFeedbackEnabled(false);
        setExpandEnabled(false);
        return operation == DND.DROP_DEFAULT || operation == DND.DROP_MOVE ? DND.DROP_LINK : operation;
    } else {
        return DND.DROP_NONE;
    }
}
项目:read-open-source-code    文件:XMLTransfer.java   
public void javaToNative(Object object, TransferData transferData)
{
    if (!checkMyType(object) /*|| !isSupportedType(transferData)*/ )
    {
        return; // DND.error(DND.ERROR_INVALID_DATA);
    }

    try
    {
        byte[] buffer = Base64.encodeBase64(((DragAndDropContainer) object).getXML().getBytes());

        super.javaToNative(buffer, transferData);
    }
    catch (Exception e)
    {
        log.logError("Unexpected error trying to put a string onto the XML Transfer type: " + e.toString());
        log.logError(Const.getStackTracker(e));
        return;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:TypedSourceTransfer.java   
@Override
protected Object nativeToJava(TransferData transferData) {

    byte[] bytes = (byte[]) super.nativeToJava(transferData);
    if (bytes == null)
        return null;
    DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
    try {
        int count = in.readInt();
        TypedSource[] results = new TypedSource[count];
        for (int i = 0; i < count; i++) {
            results[i] = readJavaElement(in);
            Assert.isNotNull(results[i]);
        }
        in.close();
        return results;
    } catch (IOException e) {
        return null;
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:ViewerInputDropAdapter.java   
/**
 * {@inheritDoc}
 */
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {

    setSelectionFeedbackEnabled(true);
    setExpandEnabled(true);

    initializeSelection();

    if (target != null) {
        return super.determineOperation(target, operation, transferType, operations);
    } else if (getInputElement(getSelection()) != null) {
        setSelectionFeedbackEnabled(false);
        setExpandEnabled(false);
        return OPERATION;
    } else {
        return DND.DROP_NONE;
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CallHierarchyTransferDropAdapter.java   
@Override
protected int determineOperation(Object target, int operation, TransferData transferType, int operations) {
    setSelectionFeedbackEnabled(false);
    setExpandEnabled(false);

    initializeSelection();

    if (target != null) {
        return super.determineOperation(target, operation, transferType, operations);
    } else if (getInputElement(getSelection()) != null) {
        setSelectionFeedbackEnabled(false);
        setExpandEnabled(false);
        return operation == DND.DROP_DEFAULT || operation == DND.DROP_MOVE ? DND.DROP_LINK : operation;
    } else {
        return DND.DROP_NONE;
    }
}
项目:geokettle-2.0    文件:ImageDataTransfer.java   
protected Object nativeToJava(TransferData transferData) {
        final Object o = super.nativeToJava(transferData);
        final byte[] bytes = (byte[]) o;

        try {
                final InputStream bis = new PrependWinBMPHeaderFilterInputStream(
                                new UncompressDibFilterInputStream(new ByteArrayInputStream(
                                                bytes)));
                final ImageData[] data = new ImageLoader().load(bis);
                if (data.length < 1) {
                        return null;
                }
                return data[0];
        } catch (IOException e) {
                return null;
        }
}
项目:birt    文件:SimpleTextTransfer.java   
/**
 * This implementation of <code>javaToNative</code> converts plain text
 * represented by a java <code>String</code> to a platform specific
 * representation.
 * 
 * @param object
 *            a java <code>String</code> containing text
 * @param transferData
 *            an empty <code>TransferData</code> object; this object will
 *            be filled in on return with the platform specific format of
 *            the data
 * 
 * @see Transfer#javaToNative
 */
public void javaToNative( Object object, TransferData transferData )
{
    if ( checkText( object ) && isSupportedType( transferData ) )
    {
        try
        {
            super.javaToNative( ( (String) object ).getBytes( "UTF-8" ), //$NON-NLS-1$
                    transferData );
        }
        catch ( UnsupportedEncodingException e )
        {
            // do not need to log
            super.javaToNative( ( (String) object ).getBytes( ),
                    transferData );
        }
    }
}
项目:neoscada    文件:ItemTransfer.java   
@Override
protected void javaToNative ( final Object object, final TransferData transferData )
{
    final byte[] bytes = toByteArray ( (Item[])object );
    if ( bytes != null )
    {
        super.javaToNative ( bytes, transferData );
    }
}
项目:neoscada    文件:ItemTransfer.java   
@Override
public Object nativeToJava ( final TransferData transferData )
{
    final byte[] bytes = (byte[])super.nativeToJava ( transferData );
    if ( bytes == null )
    {
        return null;
    }
    return fromByteArray ( bytes );
}
项目:neoscada    文件:ItemDropAdapter.java   
@Override
public boolean validateDrop ( final Object target, final int operation, final TransferData transferData )
{
    if ( ItemTransfer.getInstance ().isSupportedType ( transferData ) )
    {
        return true;
    }
    if ( TextTransfer.getInstance ().isSupportedType ( transferData ) )
    {
        return true;
    }
    return false;
}
项目:neoscada    文件:ItemTransfer.java   
@Override
protected void javaToNative ( final Object object, final TransferData transferData )
{
    final byte[] bytes = toByteArray ( (Item[])object );
    if ( bytes != null )
    {
        super.javaToNative ( bytes, transferData );
    }
}
项目:neoscada    文件:ItemTransfer.java   
@Override
public Object nativeToJava ( final TransferData transferData )
{
    final byte[] bytes = (byte[])super.nativeToJava ( transferData );
    if ( bytes == null )
    {
        return null;
    }
    return fromByteArray ( bytes );
}
项目:convertigo-eclipse    文件:PaletteSourceTransfer.java   
@Override
protected Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        return paletteSource;
    }

    return null;
}
项目:convertigo-eclipse    文件:StepSourceTransfer.java   
@Override
protected Object nativeToJava(TransferData transferData) {
    if (isSupportedType(transferData)) {
        return stepSource;
    }

    return null;
}