public static boolean promptToReplace(javax.swing.JDialog parent, String filename) { FileCollisionDialog dialog = new FileCollisionDialog(parent); dialog.setFilename(filename); dialog.enableApplyToAll(false); dialog.pack(); dialog.setVisible(true); return dialog.shouldReplace(); }
@Override public boolean shouldReplace(File file, int index, int total) { if (isCanceled) { return false; } if (yesToAll) { return true; } FileCollisionDialog dialog = new FileCollisionDialog(Core.getMainWindow().getApplicationFrame()); dialog.setFilename(file.getName()); dialog.enableApplyToAll(total - index > 1); dialog.pack(); dialog.setVisible(true); isCanceled = dialog.userDidCancel(); if (isCanceled) { return false; } yesToAll = dialog.isApplyToAll() && dialog.shouldReplace(); return yesToAll || dialog.shouldReplace(); }