Example usage for javax.swing.filechooser FileSystemView isDrive

List of usage examples for javax.swing.filechooser FileSystemView isDrive

Introduction

In this page you can find the example usage for javax.swing.filechooser FileSystemView isDrive.

Prototype

public boolean isDrive(File dir) 

Source Link

Document

Used by UI classes to decide whether to display a special icon for drives or partitions, e.g.

Usage

From source file:org.dbgl.util.FileUtils.java

public static boolean isStoredOnCDRomDrive(File file) {
    if (PlatformUtils.IS_OSX)
        return false; // FileSystemView doesn't work on OSX and leads to freeze on application exit

    FileSystemView fsv = FileSystemView.getFileSystemView();
    for (File f : File.listRoots()) {
        if (areRelated(f, file)) {
            return fsv.isDrive(f) && fsv.getSystemTypeDescription(f).toUpperCase().contains("CD");
        }//  w w  w  . j  av a 2  s . c  o m
    }
    return false;
}