// Result will be null if the user clicked cancel or closed the dialog w/o OK
if (toOpen != null) {
String fileName = toOpen.getAbsolutePath();
System.out.println("Chosen file: " + fileName);
// get a reference to the DataImport implementation
DataImport impl = Lookup.getDefault().lookup(DataImport.class);
// import the CSV file
impl.importFile(fileName);
}
}