use of org.jabref.gui.cleanup.CleanupPresetPanel in project jabref by JabRef.
the class CleanupAction method run.
@Override
public void run() {
if (canceled) {
return;
}
CleanupPresetPanel presetPanel = new CleanupPresetPanel(panel.getBibDatabaseContext(), CleanupPreset.loadFromPreferences(preferences));
int choice = showDialog(presetPanel);
if (choice != JOptionPane.OK_OPTION) {
canceled = true;
return;
}
CleanupPreset cleanupPreset = presetPanel.getCleanupPreset();
cleanupPreset.storeInPreferences(preferences);
if (cleanupPreset.isRenamePDF() && Globals.prefs.getBoolean(JabRefPreferences.ASK_AUTO_NAMING_PDFS_AGAIN)) {
CheckBoxMessage cbm = new CheckBoxMessage(Localization.lang("Auto-generating PDF-Names does not support undo. Continue?"), Localization.lang("Disable this confirmation dialog"), false);
int answer = JOptionPane.showConfirmDialog(frame, cbm, Localization.lang("Autogenerate PDF Names"), JOptionPane.YES_NO_OPTION);
if (cbm.isSelected()) {
Globals.prefs.putBoolean(JabRefPreferences.ASK_AUTO_NAMING_PDFS_AGAIN, false);
}
if (answer == JOptionPane.NO_OPTION) {
canceled = true;
return;
}
}
for (BibEntry entry : panel.getSelectedEntries()) {
// undo granularity is on entry level
NamedCompound ce = new NamedCompound(Localization.lang("Cleanup entry"));
doCleanup(cleanupPreset, entry, ce);
ce.end();
if (ce.hasEdits()) {
modifiedEntriesCount++;
panel.getUndoManager().addEdit(ce);
}
}
}
Aggregations