Search in sources :

Example 1 with MergeDialog

use of org.jabref.gui.MergeDialog in project jabref by JabRef.

the class AppendDatabaseAction method action.

@Override
public void action() {
    filesToOpen.clear();
    final MergeDialog dialog = new MergeDialog(frame, Localization.lang("Append library"), true);
    dialog.setLocationRelativeTo(panel);
    dialog.setVisible(true);
    if (dialog.isOkPressed()) {
        FileDialogConfiguration fileDialogConfiguration = new FileDialogConfiguration.Builder().withDefaultExtension(FileExtensions.BIBTEX_DB).withInitialDirectory(Globals.prefs.get(JabRefPreferences.WORKING_DIRECTORY)).build();
        DialogService dialogService = new FXDialogService();
        List<Path> chosen = DefaultTaskExecutor.runInJavaFXThread(() -> dialogService.showFileOpenDialogAndGetMultipleFiles(fileDialogConfiguration));
        if (chosen.isEmpty()) {
            return;
        }
        filesToOpen.addAll(chosen);
        // Run the actual open in a thread to prevent the program
        // locking until the file is loaded.
        JabRefExecutorService.INSTANCE.execute(() -> openIt(dialog.importEntries(), dialog.importStrings(), dialog.importGroups(), dialog.importSelectorWords()));
    }
}
Also used : FXDialogService(org.jabref.gui.FXDialogService) Path(java.nio.file.Path) DialogService(org.jabref.gui.DialogService) FXDialogService(org.jabref.gui.FXDialogService) FileDialogConfiguration(org.jabref.gui.util.FileDialogConfiguration) MergeDialog(org.jabref.gui.MergeDialog)

Aggregations

Path (java.nio.file.Path)1 DialogService (org.jabref.gui.DialogService)1 FXDialogService (org.jabref.gui.FXDialogService)1 MergeDialog (org.jabref.gui.MergeDialog)1 FileDialogConfiguration (org.jabref.gui.util.FileDialogConfiguration)1