|
5 | 5 | import javafx.fxml.FXML; |
6 | 6 | import javafx.scene.control.Button; |
7 | 7 | import javafx.scene.control.ButtonType; |
| 8 | +import javafx.scene.control.ComboBox; |
8 | 9 | import javafx.scene.control.ListView; |
9 | 10 | import javafx.scene.control.TextArea; |
10 | 11 | import javafx.scene.control.TextField; |
11 | 12 |
|
12 | 13 | import org.jabref.gui.DialogService; |
13 | 14 | import org.jabref.gui.JabRefFrame; |
14 | 15 | import org.jabref.gui.LibraryTab; |
| 16 | +import org.jabref.gui.importer.ImportEntriesViewModel; |
15 | 17 | import org.jabref.gui.theme.ThemeManager; |
16 | 18 | import org.jabref.gui.util.BaseDialog; |
17 | 19 | import org.jabref.gui.util.FileDialogConfiguration; |
|
22 | 24 | import org.jabref.logic.util.StandardFileType; |
23 | 25 | import org.jabref.model.database.BibDatabase; |
24 | 26 | import org.jabref.model.database.BibDatabaseContext; |
| 27 | +import org.jabref.model.entry.BibEntry; |
25 | 28 | import org.jabref.preferences.PreferencesService; |
26 | 29 |
|
27 | 30 | import com.airhacks.afterburner.views.ViewLoader; |
28 | 31 | import jakarta.inject.Inject; |
| 32 | +import org.controlsfx.control.CheckListView; |
29 | 33 |
|
30 | 34 | /** |
31 | 35 | * A wizard dialog for generating a new sub database from existing TeX AUX file |
32 | 36 | */ |
33 | 37 | public class FromAuxDialog extends BaseDialog<Void> { |
34 | 38 |
|
| 39 | + public CheckListView<BibEntry> entriesListView; |
| 40 | + |
| 41 | + private ImportEntriesViewModel viewModel; |
| 42 | + public ComboBox<String> libraryListView; |
35 | 43 | private final LibraryTab libraryTab; |
36 | 44 | @FXML private ButtonType generateButtonType; |
37 | 45 | private final Button generateButton; |
@@ -99,4 +107,23 @@ private void browseButtonClicked() { |
99 | 107 | .withInitialDirectory(preferences.getFilePreferences().getWorkingDirectory()).build(); |
100 | 108 | dialogService.showFileOpenDialog(fileDialogConfiguration).ifPresent(file -> auxFileField.setText(file.toAbsolutePath().toString())); |
101 | 109 | } |
| 110 | + |
| 111 | + public void unselectAll() { |
| 112 | + entriesListView.getCheckModel().clearChecks(); |
| 113 | + } |
| 114 | + |
| 115 | + public void selectAllNewEntries() { |
| 116 | + unselectAll(); |
| 117 | + for (BibEntry entry : entriesListView.getItems()) { |
| 118 | + if (!viewModel.hasDuplicate(entry)) { |
| 119 | + entriesListView.getCheckModel().check(entry); |
| 120 | + } |
| 121 | + } |
| 122 | + } |
| 123 | + |
| 124 | + public void selectAllEntries() { |
| 125 | + unselectAll(); |
| 126 | + entriesListView.getCheckModel().checkAll(); |
| 127 | + } |
| 128 | + |
102 | 129 | } |
0 commit comments