Added "Add example entry" and "Import existing PDFs" when a library is empty#12741
Conversation
-Ensures button is hidden when entries exist but are filtered -Add listeners to track database and table entry changes
-used localization -added styles for button
…e-12662 # Conflicts: # src/main/java/org/jabref/gui/maintable/MainTable.java
-checks if directory exists -triggers search for unlinked files ( if directory exists ) -Shows notification and open library properties ( if directory doesn't exist)
| dialogService.showWarningDialogAndWait( | ||
| Localization.lang("File directory is not set or does not exist!"), |
There was a problem hiding this comment.
Used Key which was already defined in properties , Should i update ?
…e-12662 # Conflicts: # src/main/java/org/jabref/gui/Base.css
| dialogService.showWarningDialogAndWait( | ||
| Localization.lang("File directory is not set or does not exist!"), |
There was a problem hiding this comment.
Yes, but please think whether it could be critical error, then leave the !.
- Removed Unnecessary comments - Used withField for BibEntry instead of setField
-updating with period
Hey , Could you please explain in detail about the global prefs checks . Thanks |
Please. Think of a user perspective. Read on at https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#directories-for-files, then my specification makes sense?! |
|
With
That wish should be fulfilled... Hopefully. Please check |
Yes, I’m checking this condition: Just to confirm inside the else block, I should also check the global preferences, right? |
| libraryTab.showAndEdit(entry); | ||
| }); | ||
|
|
||
| Button importPdfsButton = new Button(Localization.lang("Import existing PDFs")); |
There was a problem hiding this comment.
// TODO: activate only if directories available
// enable if !databaseContext.getFileDirectories(filePreferences).isEmpty()
There was a problem hiding this comment.
Add hover if disabled: "Please configure a file directory"
There was a problem hiding this comment.
with respect to initial issue - Show a notification that no directory exist and then open the library properties.
what about open library properties ? are we doing that ?
There was a problem hiding this comment.
| dialogService.showWarningDialogAndWait( | ||
| Localization.lang("File directory is not set or does not exist."), | ||
| Localization.lang("Please configure a file directory")); | ||
|
|
||
| LibraryPropertiesAction libraryPropertiesAction = new LibraryPropertiesAction(stateManager); | ||
| libraryPropertiesAction.execute(); |
-Added focus for library-specific file directory
-Removed Unused Localization keys -Updated to lambda for better readability
|
|
||
| updatePlaceholder(placeholderBox); | ||
|
|
||
| database.getDatabase().getEntries().addListener((ListChangeListener<BibEntry>) change -> updatePlaceholder(placeholderBox)); |
There was a problem hiding this comment.
Does following work, too? - I don't see any usage of the variable.
| database.getDatabase().getEntries().addListener((ListChangeListener<BibEntry>) change -> updatePlaceholder(placeholderBox)); | |
| database.getDatabase().getEntries().addListener(_ -> updatePlaceholder(placeholderBox)); |
There was a problem hiding this comment.
I'm sticking with the original code since the lambda with an underscore parameter creates ambiguity error.
|
|
||
| database.getDatabase().getEntries().addListener((ListChangeListener<BibEntry>) change -> updatePlaceholder(placeholderBox)); | ||
|
|
||
| this.getItems().addListener((ListChangeListener<BibEntryTableViewModel>) change -> updatePlaceholder(placeholderBox)); |
There was a problem hiding this comment.
| this.getItems().addListener((ListChangeListener<BibEntryTableViewModel>) change -> updatePlaceholder(placeholderBox)); | |
| this.getItems().addListener(_ -> updatePlaceholder(placeholderBox)); |
There was a problem hiding this comment.
I'm sticking with the original code since the lambda with an underscore parameter creates ambiguity error.
| BibEntry exampleEntry = new BibEntry(StandardEntryType.Article); | ||
| exampleEntry.withField(StandardField.AUTHOR, "Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker"); | ||
| exampleEntry.withField(StandardField.TITLE, "JabRef: BibTeX-based literature management software"); | ||
| exampleEntry.withField(StandardField.JOURNAL, "TUGboat"); | ||
| exampleEntry.withField(StandardField.VOLUME, "44"); | ||
| exampleEntry.withField(StandardField.NUMBER, "3"); | ||
| exampleEntry.withField(StandardField.PAGES, "441--447"); | ||
| exampleEntry.withField(StandardField.DOI, "10.47397/tb/44-3/tb138kopp-jabref"); | ||
| exampleEntry.withField(StandardField.ISSN, "0896-3207"); | ||
| exampleEntry.withField(StandardField.ISSUE, "138"); | ||
| exampleEntry.withField(StandardField.YEAR, "2023"); |
There was a problem hiding this comment.
Chain these statemetns
| BibEntry exampleEntry = new BibEntry(StandardEntryType.Article); | |
| exampleEntry.withField(StandardField.AUTHOR, "Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker"); | |
| exampleEntry.withField(StandardField.TITLE, "JabRef: BibTeX-based literature management software"); | |
| exampleEntry.withField(StandardField.JOURNAL, "TUGboat"); | |
| exampleEntry.withField(StandardField.VOLUME, "44"); | |
| exampleEntry.withField(StandardField.NUMBER, "3"); | |
| exampleEntry.withField(StandardField.PAGES, "441--447"); | |
| exampleEntry.withField(StandardField.DOI, "10.47397/tb/44-3/tb138kopp-jabref"); | |
| exampleEntry.withField(StandardField.ISSN, "0896-3207"); | |
| exampleEntry.withField(StandardField.ISSUE, "138"); | |
| exampleEntry.withField(StandardField.YEAR, "2023"); | |
| BibEntry exampleEntry = new BibEntry(StandardEntryType.Article) | |
| .withField(StandardField.AUTHOR, "Oliver Kopp and Carl Christian Snethlage and Christoph Schwentker") | |
| .withField(StandardField.TITLE, "JabRef: BibTeX-based literature management software") | |
| .withField(StandardField.JOURNAL, "TUGboat") | |
| .withField(StandardField.VOLUME, "44") | |
| .withField(StandardField.NUMBER, "3") | |
| .withField(StandardField.PAGES, "441--447") | |
| .withField(StandardField.DOI, "10.47397/tb/44-3/tb138kopp-jabref") | |
| .withField(StandardField.ISSN, "0896-3207") | |
| .withField(StandardField.ISSUE, "138") | |
| .withField(StandardField.YEAR, "2023"); |
| FindUnlinkedFilesAction findUnlinkedFilesAction = new FindUnlinkedFilesAction(dialogService, stateManager); | ||
| findUnlinkedFilesAction.execute(); |
|
|
||
|
|
-Label Style Changes
…into fix-issue-12662
|
@trag-bot didn't find any issues in the code! ✅✨ |
…s empty (JabRef#12741) * Add placeholder with "Add Example Entry" for empty library -Ensures button is hidden when entries exist but are filtered -Add listeners to track database and table entry changes * Updated code based on draft review ( Import pdf pending) -used localization -added styles for button * Added function for Import existing PDFs -checks if directory exists -triggers search for unlinked files ( if directory exists ) -Shows notification and open library properties ( if directory doesn't exist) * updated CHANGELOG.md * Fixed localization issues and checkstyle * Fixed localization issues * submodules changes * roll back .gitmodules * Added comment at the right place * Resolved Review Comments - Removed Unnecessary comments - Used withField for BibEntry instead of setField * Removed Exclamation mark , should be avoided in UI messages. -updating with period * -Refactored function name to importPdfs -Added focus for library-specific file directory * -Refactored importPDFs to follow fail fast principles -Removed Unused Localization keys -Updated to lambda for better readability * -rewriteRun changes * -Resolved Review Changes . -Label Style Changes --------- Co-authored-by: Christoph <siedlerkiller@gmail.com>
…s empty (JabRef#12741) * Add placeholder with "Add Example Entry" for empty library -Ensures button is hidden when entries exist but are filtered -Add listeners to track database and table entry changes * Updated code based on draft review ( Import pdf pending) -used localization -added styles for button * Added function for Import existing PDFs -checks if directory exists -triggers search for unlinked files ( if directory exists ) -Shows notification and open library properties ( if directory doesn't exist) * updated CHANGELOG.md * Fixed localization issues and checkstyle * Fixed localization issues * submodules changes * roll back .gitmodules * Added comment at the right place * Resolved Review Comments - Removed Unnecessary comments - Used withField for BibEntry instead of setField * Removed Exclamation mark , should be avoided in UI messages. -updating with period * -Refactored function name to importPdfs -Added focus for library-specific file directory * -Refactored importPDFs to follow fail fast principles -Removed Unused Localization keys -Updated to lambda for better readability * -rewriteRun changes * -Resolved Review Changes . -Label Style Changes --------- Co-authored-by: Christoph <siedlerkiller@gmail.com>





Closes #12662
Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if change is visible to the user)