Java Code Examples for java.awt.datatransfer.DataFlavor#isRepresentationClassReader()

The following examples show how to use java.awt.datatransfer.DataFlavor#isRepresentationClassReader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileDropDecorator.java    From MtgDesktopCompanion with GNU General Public License v3.0 6 votes vote down vote up
private boolean isDragOk( final DropTargetDragEvent evt )
{   
	boolean ok = false;
    DataFlavor[] flavors = evt.getCurrentDataFlavors();
    int i = 0;
    while( !ok && i < flavors.length )
    {   
       final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( DataFlavor.javaFileListFlavor ) ||
            curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        i++;
    }
    return ok;
}
 
Example 2
Source File: DataTransferer.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        DataTransferer.charArrayClass.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          DataTransferer.byteArrayClass.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 3
Source File: FileDrop.java    From freeinternals with Apache License 2.0 5 votes vote down vote up
/**
 * Determine if the dragged data is a file list.
 */
private boolean isDragOk(final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt) {
    boolean ok = false;

    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();

    // See if any of the flavors are a file list
    int i = 0;
    while (!ok && i < flavors.length) {
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if (curFlavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)
                || curFlavor.isRepresentationClassReader()) {
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors

    // If logging is enabled, show data flavors
    if (out != null) {
        if (flavors.length == 0) {
            log(out, "FileDrop: no data flavors.");
        }
        for (i = 0; i < flavors.length; i++) {
            log(out, flavors[i].toString());
        }
    }   // end if: logging enabled

    return ok;
}
 
Example 4
Source File: FileDrop.java    From beast-mcmc with GNU Lesser General Public License v2.1 5 votes vote down vote up
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{   boolean ok = false;

    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();

    // See if any of the flavors are a file list
    int i = 0;
    while( !ok && i < flavors.length )
    {
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
                curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors

    // If logging is enabled, show data flavors
    if( out != null )
    {   if( flavors.length == 0 )
        log( out, "FileDrop: no data flavors." );
        for( i = 0; i < flavors.length; i++ )
            log( out, flavors[i].toString() );
    }   // end if: logging enabled

    return ok;
}
 
Example 5
Source File: JFileDrop.java    From i18n-editor with MIT License 5 votes vote down vote up
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{   boolean ok = false;
    
    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
    
    // See if any of the flavors are a file list
    int i = 0;
    while( !ok && i < flavors.length )
    {   
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
            curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors
    
    // If logging is enabled, show data flavors
    if( out != null )
    {   if( flavors.length == 0 )
            log( out, "FileDrop: no data flavors." );
        for( i = 0; i < flavors.length; i++ )
            log( out, flavors[i].toString() );
    }   // end if: logging enabled
    
    return ok;
}
 
Example 6
Source File: FileDrop.java    From PyramidShader with GNU General Public License v3.0 5 votes vote down vote up
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{   boolean ok = false;
    
    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
    
    // See if any of the flavors are a file list
    int i = 0;
    while( !ok && i < flavors.length )
    {   
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
            curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors
    
    // If logging is enabled, show data flavors
    if( out != null )
    {   if( flavors.length == 0 )
            log( out, "FileDrop: no data flavors." );
        for( i = 0; i < flavors.length; i++ )
            log( out, flavors[i].toString() );
    }   // end if: logging enabled
    
    return ok;
}
 
Example 7
Source File: DataTransferer.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        DataTransferer.charArrayClass.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          DataTransferer.byteArrayClass.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 8
Source File: DataTransferer.java    From jdk8u-dev-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 9
Source File: FileDrop.java    From JavaExercises with GNU General Public License v2.0 5 votes vote down vote up
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{   boolean ok = false;
    
    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
    
    // See if any of the flavors are a file list
    int i = 0;
    while( !ok && i < flavors.length )
    {   
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
            curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors
    
    // If logging is enabled, show data flavors
    if( out != null )
    {   if( flavors.length == 0 )
            log( out, "FileDrop: no data flavors." );
        for( i = 0; i < flavors.length; i++ )
            log( out, flavors[i].toString() );
    }   // end if: logging enabled
    
    return ok;
}
 
Example 10
Source File: DataTransferer.java    From dragonwell8_jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 11
Source File: DataTransferer.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 12
Source File: DataTransferer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 13
Source File: DataFlavorUtil.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the 'charset'
 * parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
            !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class<?> rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
            String.class.equals(rep_class) ||
            flavor.isRepresentationClassCharBuffer() ||
            char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
            flavor.isRepresentationClassByteBuffer() ||
            byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    // null equals default encoding which is always supported
    return (charset == null) || isEncodingSupported(charset);
}
 
Example 14
Source File: FileDrop.java    From bytecode-viewer with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Determine if the dragged data is a file list.
 */
private boolean isDragOk(final java.io.PrintStream out,
                         final java.awt.dnd.DropTargetDragEvent evt) {
    boolean ok = false;

    // Get data flavors being dragged
    final java.awt.datatransfer.DataFlavor[] flavors = evt
            .getCurrentDataFlavors();

    // See if any of the flavors are a file list
    int i = 0;
    while (!ok && i < flavors.length) {
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support
        // added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if (curFlavor
                .equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor)
                || curFlavor.isRepresentationClassReader()) {
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support
        // added.
        i++;
    } // end while: through flavors

    // If logging is enabled, show data flavors
    if (out != null) {
        if (flavors.length == 0) {
            log(out, "FileDrop: no data flavors.");
        }
        for (i = 0; i < flavors.length; i++) {
            log(out, flavors[i].toString());
        }
    } // end if: logging enabled

    return ok;
}
 
Example 15
Source File: DataTransferer.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 16
Source File: FileDrop.java    From Panako with GNU Affero General Public License v3.0 5 votes vote down vote up
/** Determine if the dragged data is a file list. */
private boolean isDragOk( final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt )
{   boolean ok = false;
    
    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();
    
    // See if any of the flavors are a file list
    int i = 0;
    while( !ok && i < flavors.length )
    {   
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if( curFlavor.equals( java.awt.datatransfer.DataFlavor.javaFileListFlavor ) ||
            curFlavor.isRepresentationClassReader()){
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors
    
    // If logging is enabled, show data flavors
    if( out != null )
    {   if( flavors.length == 0 )
            log( out, "FileDrop: no data flavors." );
        for( i = 0; i < flavors.length; i++ )
            log( out, flavors[i].toString() );
    }   // end if: logging enabled
    
    return ok;
}
 
Example 17
Source File: DataTransferer.java    From jdk8u-jdk with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 18
Source File: FileDrop.java    From Briss-2.0 with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Determine if the dragged data is a file list.
 */
private boolean isDragOk(final java.io.PrintStream out, final java.awt.dnd.DropTargetDragEvent evt) {
    boolean ok = false;

    // Get data flavors being dragged
    java.awt.datatransfer.DataFlavor[] flavors = evt.getCurrentDataFlavors();

    // See if any of the flavors are a file list
    int i = 0;
    while (!ok && i < flavors.length) {
        // BEGIN 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        // Is the flavor a file list?
        final DataFlavor curFlavor = flavors[i];
        if (curFlavor.equals(java.awt.datatransfer.DataFlavor.javaFileListFlavor) ||
            curFlavor.isRepresentationClassReader()) {
            ok = true;
        }
        // END 2007-09-12 Nathan Blomquist -- Linux (KDE/Gnome) support added.
        i++;
    }   // end while: through flavors

    // If logging is enabled, show data flavors
    if (out != null) {
        if (flavors.length == 0)
            log(out, "FileDrop: no data flavors.");
        for (i = 0; i < flavors.length; i++)
            log(out, flavors[i].toString());
    }   // end if: logging enabled

    return ok;
}
 
Example 19
Source File: DataTransferer.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Returns whether this flavor is a text type which supports the
 * 'charset' parameter.
 */
public static boolean isFlavorCharsetTextType(DataFlavor flavor) {
    // Although stringFlavor doesn't actually support the charset
    // parameter (because its primary MIME type is not "text"), it should
    // be treated as though it does. stringFlavor is semantically
    // equivalent to "text/plain" data.
    if (DataFlavor.stringFlavor.equals(flavor)) {
        return true;
    }

    if (!"text".equals(flavor.getPrimaryType()) ||
        !doesSubtypeSupportCharset(flavor))
    {
        return false;
    }

    Class rep_class = flavor.getRepresentationClass();

    if (flavor.isRepresentationClassReader() ||
        String.class.equals(rep_class) ||
        flavor.isRepresentationClassCharBuffer() ||
        char[].class.equals(rep_class))
    {
        return true;
    }

    if (!(flavor.isRepresentationClassInputStream() ||
          flavor.isRepresentationClassByteBuffer() ||
          byte[].class.equals(rep_class))) {
        return false;
    }

    String charset = flavor.getParameter("charset");

    return (charset != null)
        ? DataTransferer.isEncodingSupported(charset)
        : true; // null equals default encoding which is always supported
}
 
Example 20
Source File: TraceTabbedPane.java    From pega-tracerviewer with Apache License 2.0 4 votes vote down vote up
private boolean isDragOk(final DropTargetDragEvent evt) {

        boolean retValue = false;

        // Get data flavors being dragged
        DataFlavor[] dataFlavorArray = evt.getCurrentDataFlavors();

        for (int i = 0; i < dataFlavorArray.length; i++) {

            final DataFlavor dataFlavor = dataFlavorArray[i];

            if (dataFlavor.equals(DataFlavor.javaFileListFlavor) || dataFlavor.isRepresentationClassReader()) {
                retValue = true;
                break;
            }
        }

        return retValue;
    }