/** Clears the database folder. */ private void clearDatabaseFolder() { boolean databaseClosed = true; // close the database connection if (identification != null) { try { identification.close(); identification = null; } catch (SQLException e) { databaseClosed = false; e.printStackTrace(); JOptionPane.showMessageDialog( null, "Failed to close the database.", "Database Error", JOptionPane.WARNING_MESSAGE); } } // empty the matches folder if (databaseClosed) { File matchFolder = new File(resource, PeptideShaker.SERIALIZATION_DIRECTORY); if (matchFolder.exists()) { File[] tempFiles = matchFolder.listFiles(); if (tempFiles != null) { for (File currentFile : tempFiles) { Util.deleteDir(currentFile); } } if (matchFolder.listFiles() != null && matchFolder.listFiles().length > 0) { JOptionPane.showMessageDialog( null, "Failed to empty the database folder:\n" + matchFolder.getPath() + ".", "Database Cleanup Failed", JOptionPane.WARNING_MESSAGE); } } } }