From 362873f7d1f0a5cec494d7ffc7787a82d45fc561 Mon Sep 17 00:00:00 2001 From: subhramit Date: Sat, 13 Sep 2025 18:53:52 +0530 Subject: [PATCH 1/9] Try again --- .jbang/CheckoutPR.java | 16 +- .jbang/CloneJabRef.java | 2 +- .jbang/JabKitLauncher.java | 2 +- .jbang/JabLsLauncher.java | 2 +- .jbang/JabSrvLauncher.java | 2 +- .../java/CitationStyleCatalogGenerator.java | 2 +- .../src/main/java/JournalListMvGenerator.java | 3 +- .../src/main/java/LtwaListMvGenerator.java | 2 +- .../java/org/jabref/cli/CliImportHelper.java | 12 +- .../org/jabref/gui/JabRefDialogService.java | 34 +- .../main/java/org/jabref/gui/JabRefGUI.java | 2 +- .../main/java/org/jabref/gui/LibraryTab.java | 6 +- .../ai/components/aichat/AiChatComponent.java | 16 +- .../chatprompt/ChatPromptComponent.java | 6 +- .../util/notifications/Notification.java | 5 +- .../AutoCompletionTextInputBinding.java | 4 +- .../PersonNameStringConverter.java | 6 +- .../gui/autocompleter/SuggestionProvider.java | 4 +- .../autosaveandbackup/AutosaveManager.java | 4 +- .../gui/autosaveandbackup/BackupManager.java | 17 +- .../gui/auximport/NewSubLibraryAction.java | 2 +- .../GenerateCitationKeyAction.java | 50 +- .../gui/cleanup/CleanupSingleAction.java | 14 +- .../DatabaseChangeDetailsViewFactory.java | 80 +- .../collab/DatabaseChangesResolverDialog.java | 6 +- .../jabref/gui/collab/entryadd/EntryAdd.java | 4 +- .../gui/collab/entrychange/EntryChange.java | 2 +- .../entrychange/EntryChangeDetailsView.java | 4 +- .../gui/collab/entrydelete/EntryDelete.java | 4 +- .../MetadataChangeDetailsView.java | 12 +- .../SaveOrderConfigPanel.java | 4 +- .../consistency/ConsistencyCheckDialog.java | 6 +- .../ConsistencyCheckDialogViewModel.java | 32 +- .../jabref/gui/desktop/os/NativeDesktop.java | 19 +- .../java/org/jabref/gui/desktop/os/OSX.java | 2 +- .../documentviewer/DocumentViewerView.java | 2 +- .../DuplicateResolverDialog.java | 3 +- .../org/jabref/gui/edit/CopyMoreAction.java | 3 +- .../java/org/jabref/gui/edit/EditAction.java | 39 +- .../MoveFieldValueAction.java | 3 +- .../EditFieldContentViewModel.java | 4 +- .../jabref/gui/entryeditor/EntryEditor.java | 4 +- .../LatexCitationsTabViewModel.java | 6 +- .../gui/entryeditor/OtherFieldsTab.java | 4 +- .../org/jabref/gui/entryeditor/SciteTab.java | 6 +- .../org/jabref/gui/entryeditor/SourceTab.java | 16 +- .../citationrelationtab/BibEntryView.java | 10 +- .../CitationRelationsTab.java | 20 +- .../CitationsRelationsTabViewModel.java | 6 +- .../fileannotationtab/FileAnnotationTab.java | 12 +- .../gui/errorconsole/LogEventViewModel.java | 18 +- .../jabref/gui/exporter/ExportCommand.java | 4 +- .../gui/exporter/ExportToClipboardAction.java | 4 +- .../org/jabref/gui/exporter/SaveAction.java | 9 +- .../gui/exporter/SaveDatabaseAction.java | 34 +- .../externalfiles/AutoSetFileLinksUtil.java | 4 +- .../gui/externalfiles/ChainedFilters.java | 3 +- .../gui/externalfiles/FileFilterUtils.java | 44 +- .../externalfiles/GitIgnoreFileFilter.java | 4 +- .../gui/externalfiles/ImportHandler.java | 2 +- .../gui/externalfiles/PdfMergeDialog.java | 6 +- .../externalfiles/UnlinkedFilesCrawler.java | 5 +- .../UnlinkedFilesDialogView.java | 16 +- .../CustomExternalFileType.java | 2 +- .../externalfiletype/ExternalFileType.java | 2 +- .../externalfiletype/ExternalFileTypes.java | 4 +- .../gui/fieldeditors/CitationCountEditor.java | 4 +- .../CitationCountEditorViewModel.java | 1 + .../gui/fieldeditors/FieldNameLabel.java | 18 +- .../jabref/gui/fieldeditors/GroupEditor.java | 6 +- .../gui/fieldeditors/ICORERankingEditor.java | 4 +- .../gui/fieldeditors/KeywordsEditor.java | 8 +- .../gui/fieldeditors/LinkedFileViewModel.java | 2 +- .../gui/fieldeditors/LinkedFilesEditor.java | 4 +- .../LinkedFilesEditorViewModel.java | 24 +- .../contextmenu/ContextAction.java | 86 +- .../contextmenu/EditorContextAction.java | 42 +- .../DoiIdentifierEditorViewModel.java | 24 +- .../identifier/IdentifierEditor.java | 7 +- .../gui/frame/JabRefFrameViewModel.java | 14 +- .../jabref/gui/frame/UiMessageHandler.java | 2 +- .../gui/git/GitCommitDialogViewModel.java | 2 +- .../jabref/gui/groups/GroupNodeViewModel.java | 107 +- .../org/jabref/gui/groups/GroupTreeView.java | 14 +- .../jabref/gui/groups/GroupTreeViewModel.java | 8 +- .../gui/groups/UndoableAddOrRemoveGroup.java | 31 +- .../jabref/gui/help/ErrorConsoleAction.java | 2 +- .../org/jabref/gui/help/VersionWorker.java | 4 +- .../BibEntryTypePrefsAndFileViewModel.java | 4 +- .../jabref/gui/importer/ImportCommand.java | 4 +- .../ImportCustomEntryTypesDialog.java | 4 +- .../gui/importer/ImportEntriesDialog.java | 82 +- .../gui/importer/ImportEntriesViewModel.java | 6 +- .../gui/importer/NewDatabaseAction.java | 4 +- .../importer/ParserResultWarningDialog.java | 2 +- .../importer/actions/GUIPostOpenAction.java | 6 +- .../importer/actions/OpenDatabaseAction.java | 26 +- .../gui/integrity/BibLogSettingsPane.java | 2 +- .../integrity/BibLogSettingsViewModel.java | 2 +- .../gui/integrity/IntegrityCheckDialog.java | 2 +- .../jabref/gui/journals/AbbreviationType.java | 2 +- .../gui/keyboard/TextInputKeyBindings.java | 8 +- .../LibraryPropertiesViewModel.java | 2 +- .../ContentSelectorViewModel.java | 4 +- .../general/GeneralPropertiesViewModel.java | 6 +- .../saving/SavingPropertiesViewModel.java | 9 +- .../gui/linkedfile/AttachFileAction.java | 16 +- .../linkedfile/AttachFileFromURLAction.java | 10 +- .../RedownloadMissingFilesAction.java | 44 +- .../maintable/ExtractReferencesAction.java | 6 +- .../org/jabref/gui/maintable/MainTable.java | 28 +- .../gui/maintable/MainTableColumnModel.java | 20 +- .../gui/maintable/MainTableDataModel.java | 4 +- .../MainTableFieldValueFormatter.java | 22 +- .../maintable/MainTableHeaderContextMenu.java | 4 +- .../gui/maintable/OpenFolderAction.java | 32 +- .../jabref/gui/maintable/RightClickMenu.java | 22 +- .../columns/LinkedIdentifierColumn.java | 2 +- .../jabref/gui/menus/ChangeEntryTypeMenu.java | 4 +- .../gui/mergeentries/BatchEntryMergeTask.java | 28 +- .../BatchEntryMergeWithFetchedDataAction.java | 2 +- .../gui/mergeentries/MergeEntriesHelper.java | 2 +- .../DiffHighlightingEllipsingTextFlow.java | 9 +- .../threewaymerge/EntriesMergeResult.java | 6 +- .../threewaymerge/FieldRowViewModel.java | 23 +- .../threewaymerge/GroupDiffMode.java | 2 +- .../ThreeWayMergeHeaderView.java | 8 +- .../threewaymerge/ThreeWayMergeView.java | 6 +- .../threewaymerge/cell/HeaderCell.java | 3 +- .../threewaymerge/cell/MergedFieldCell.java | 6 +- .../cell/OpenExternalLinkAction.java | 2 +- .../sidebuttons/ToggleMergeUnmergeButton.java | 3 +- .../diffhighlighter/SplitDiffHighlighter.java | 22 +- .../fieldsmerger/CommentMerger.java | 3 +- .../fieldsmerger/FieldMerger.java | 3 +- .../fieldsmerger/FieldMergerFactory.java | 18 +- .../fieldsmerger/FileMerger.java | 3 +- .../fieldsmerger/GroupMerger.java | 3 +- .../fieldsmerger/KeywordMerger.java | 3 +- .../toolbar/ThreeWayMergeToolbar.java | 4 +- .../org/jabref/gui/newentry/NewEntryView.java | 114 +- .../gui/newentry/NewEntryViewModel.java | 9 +- .../org/jabref/gui/openoffice/Bootstrap.java | 41 +- .../org/jabref/gui/openoffice/OOBibBase.java | 62 +- .../gui/openoffice/OOBibBaseConnect.java | 8 +- .../gui/openoffice/OpenOfficePanel.java | 3 +- .../StyleSelectDialogViewModel.java | 8 +- .../gui/preferences/JabRefGuiPreferences.java | 24 +- .../preferences/PreferenceTabViewModel.java | 2 +- .../preferences/PreferencesSearchHandler.java | 22 +- .../gui/preferences/ai/AiTabViewModel.java | 49 +- .../AutoCompletionTabViewModel.java | 9 +- .../CustomEntryTypesTabViewModel.java | 2 +- .../customentrytypes/EntryTypeViewModel.java | 10 +- .../export/ExportTabViewModel.java | 9 +- .../external/ExternalTabViewModel.java | 6 +- .../keybindings/KeyBindingsTabViewModel.java | 2 +- .../linkedfiles/LinkedFilesTabViewModel.java | 9 +- .../network/NetworkTabViewModel.java | 1 - .../protectedterms/ProtectedTermsTab.java | 20 +- .../preferences/table/TableTabViewModel.java | 21 +- .../preview/ClipboardContentGenerator.java | 9 +- .../org/jabref/gui/preview/PreviewViewer.java | 34 +- .../jabref/gui/push/GuiPushToApplication.java | 2 +- .../gui/push/GuiPushToApplicationCommand.java | 6 +- .../jabref/gui/search/SearchTextField.java | 4 +- .../org/jabref/gui/sidepane/SidePane.java | 12 +- .../gui/sidepane/SidePaneContentFactory.java | 61 +- .../gui/sidepane/SidePaneViewModel.java | 27 +- .../gui/slr/ExistingStudySearchAction.java | 2 +- .../gui/slr/ManageStudyDefinitionView.java | 10 +- .../jabref/gui/slr/StartNewStudyAction.java | 4 +- .../SpecialFieldValueViewModel.java | 96 +- .../specialfields/SpecialFieldViewModel.java | 18 +- .../org/jabref/gui/theme/StyleSheetFile.java | 10 +- .../main/java/org/jabref/gui/theme/Theme.java | 2 +- .../java/org/jabref/gui/theme/ThemeTypes.java | 20 +- .../org/jabref/gui/util/ControlHelper.java | 13 +- .../jabref/gui/util/CustomTitledPaneSkin.java | 11 +- .../java/org/jabref/gui/util/FieldsUtil.java | 15 +- .../jabref/gui/util/FileFilterConverter.java | 4 +- .../main/java/org/jabref/gui/util/URLs.java | 2 +- .../org/jabref/gui/util/UiTaskExecutor.java | 3 +- ...extFieldTableCellVisualizationFactory.java | 4 +- .../org/jabref/gui/util/ZipFileChooser.java | 2 +- .../gui/walkthrough/WalkthroughAction.java | 9 +- .../walkthrough/WalkthroughHighlighter.java | 21 +- .../gui/walkthrough/WalkthroughOverlay.java | 11 +- .../gui/walkthrough/WalkthroughRenderer.java | 6 +- .../jabref/gui/walkthrough/WindowOverlay.java | 57 +- .../gui/walkthrough/declarative/Trigger.java | 2 +- .../declarative/WindowResolver.java | 2 +- .../declarative/effect/WalkthroughEffect.java | 5 +- .../declarative/effect/WindowEffect.java | 6 +- .../declarative/step/PanelStep.java | 29 +- .../declarative/step/SideEffect.java | 5 +- .../declarative/step/TooltipStep.java | 29 +- .../walkthrough/effects/BaseWindowEffect.java | 2 +- .../utils/WalkthroughResolver.java | 6 +- .../utils/WalkthroughReverter.java | 6 +- .../utils/WalkthroughScroller.java | 12 +- .../walkthrough/utils/WalkthroughUtils.java | 4 +- .../org/jabref/gui/welcome/WelcomeTab.java | 27 +- .../gui/welcome/components/QuickSettings.java | 10 +- .../welcome/components/ThemeWireFrame.java | 9 +- .../welcome/quicksettings/ThemeDialog.java | 9 +- .../viewmodel/ThemeDialogViewModel.java | 15 +- .../PerformLoadDatabaseMigrations.java | 2 +- .../migrations/PreferencesMigrations.java | 8 +- .../ai/components/aichat/AiChatComponent.fxml | 63 +- .../chathistory/ChatHistoryComponent.fxml | 19 +- .../chatmessage/ChatMessageComponent.fxml | 42 +- .../privacynotice/PrivacyNoticeComponent.fxml | 37 +- .../summary/SummaryShowingComponent.fxml | 36 +- .../util/errorstate/ErrorStateComponent.fxml | 54 +- .../jabref/gui/auximport/FromAuxDialog.fxml | 57 +- .../gui/cleanup/CleanupPresetPanel.fxml | 109 +- .../collab/DatabaseChangesResolverDialog.fxml | 59 +- .../CitationKeyPatternsPanel.fxml | 35 +- .../FieldFormatterCleanupsPanel.fxml | 106 +- .../SaveOrderConfigPanel.fxml | 68 +- .../consistency/ConsistencyCheckDialog.fxml | 51 +- .../consistency/ConsistencySymbolsDialog.fxml | 37 +- .../jabref/gui/copyfiles/CopyFilesDialog.fxml | 32 +- .../gui/documentviewer/DocumentViewer.fxml | 54 +- .../jabref/gui/edit/ManageKeywordsDialog.fxml | 56 +- .../org/jabref/gui/edit/ReplaceString.fxml | 140 +- .../AutomaticFieldEditorDialog.fxml | 21 +- .../CopyOrMoveFieldContentTab.fxml | 65 +- .../editfieldcontent/EditFieldContentTab.fxml | 46 +- .../renamefield/RenameFieldTab.fxml | 27 +- .../jabref/gui/entryeditor/EntryEditor.fxml | 102 +- .../fileannotationtab/FileAnnotationTab.fxml | 47 +- .../jabref/gui/errorconsole/ErrorConsole.fxml | 39 +- .../exporter/CreateModifyExporterDialog.fxml | 82 +- .../externalfiles/UnlinkedFilesDialog.fxml | 178 ++- .../gui/fieldeditors/CitationCountEditor.fxml | 27 +- .../gui/fieldeditors/CitationKeyEditor.fxml | 14 +- .../jabref/gui/fieldeditors/DateEditor.fxml | 15 +- .../gui/fieldeditors/ICORERankingEditor.fxml | 40 +- .../jabref/gui/fieldeditors/ISSNEditor.fxml | 47 +- .../gui/fieldeditors/JournalEditor.fxml | 22 +- .../gui/fieldeditors/KeywordsEditor.fxml | 11 +- .../gui/fieldeditors/LinkedEntriesEditor.fxml | 11 +- .../gui/fieldeditors/LinkedFilesEditor.fxml | 46 +- .../jabref/gui/fieldeditors/OwnerEditor.fxml | 18 +- .../jabref/gui/fieldeditors/UrlEditor.fxml | 21 +- .../identifier/IdentifierEditor.fxml | 48 +- .../fieldeditors/journalinfo/JournalInfo.fxml | 256 +++- .../optioneditors/OptionEditor.fxml | 16 +- .../org/jabref/gui/git/GitCommitDialog.fxml | 22 +- .../gui/git/GitShareToGitHubDialog.fxml | 39 +- .../org/jabref/gui/groups/GroupDialog.fxml | 220 ++- .../org/jabref/gui/help/AboutDialog.fxml | 140 +- .../importer/GenerateEntryFromIdDialog.fxml | 55 +- .../ImportCustomEntryTypesDialog.fxml | 21 +- .../gui/importer/ImportEntriesDialog.fxml | 112 +- .../gui/integrity/BibLogSettingsPane.fxml | 10 +- .../gui/integrity/IntegrityCheckDialog.fxml | 65 +- .../libraryproperties/LibraryProperties.fxml | 21 +- .../constants/ConstantsProperties.fxml | 64 +- .../contentselectors/ContentSelector.fxml | 65 +- .../general/GeneralProperties.fxml | 179 ++- .../keypattern/KeyPatternProperties.fxml | 36 +- .../preamble/PreambleProperties.fxml | 18 +- .../saving/SavingProperties.fxml | 31 +- .../gui/linkedfile/LinkedFileEditDialog.fxml | 78 +- .../multiwaymerge/MultiMergeEntries.fxml | 91 +- .../toolbar/ThreeWayMergeToolbar.fxml | 139 +- .../org/jabref/gui/newentry/NewEntry.fxml | 216 ++- .../gui/openoffice/AdvancedCiteDialog.fxml | 39 +- .../gui/openoffice/ManageCitationsDialog.fxml | 32 +- ...ModifyCSLBibliographyPropertiesDialog.fxml | 46 +- .../gui/openoffice/StyleSelectDialog.fxml | 160 +- .../gui/preferences/PreferencesDialog.fxml | 108 +- .../preferences/PreferencesFilterDialog.fxml | 40 +- .../org/jabref/gui/preferences/ai/AiTab.fxml | 142 +- .../autocompletion/AutoCompletionTab.fxml | 78 +- .../CitationKeyPatternTab.fxml | 85 +- .../customentrytypes/CustomEntryTypesTab.fxml | 126 +- .../customexporter/CustomExporterTab.fxml | 54 +- .../customimporter/CustomImporterTab.fxml | 48 +- .../gui/preferences/entry/EntryTab.fxml | 85 +- .../entryeditor/EntryEditorTab.fxml | 90 +- .../gui/preferences/export/ExportTab.fxml | 18 +- .../gui/preferences/external/ExternalTab.fxml | 196 ++- .../EditExternalFileTypeEntryDialog.fxml | 129 +- .../ExternalFileTypesTab.fxml | 68 +- .../gui/preferences/general/GeneralTab.fxml | 244 ++- .../gui/preferences/groups/GroupsTab.fxml | 38 +- .../journals/JournalAbbreviationsTab.fxml | 126 +- .../keybindings/KeyBindingsTab.fxml | 80 +- .../linkedfiles/LinkedFilesTab.fxml | 162 +- .../nameformatter/NameFormatterTab.fxml | 74 +- .../gui/preferences/network/NetworkTab.fxml | 154 +- .../gui/preferences/preview/PreviewTab.fxml | 136 +- .../protectedterms/ProtectedTermsTab.fxml | 61 +- .../gui/preferences/table/TableTab.fxml | 171 ++- .../preferences/websearch/ApiKeyDialog.fxml | 31 +- .../preferences/websearch/WebSearchTab.fxml | 93 +- .../gui/preferences/xmp/XmpPrivacyTab.fxml | 62 +- .../gui/search/GlobalSearchResultDialog.fxml | 29 +- .../gui/shared/SharedDatabaseLoginDialog.fxml | 265 +++- .../jabref/gui/slr/ManageStudyDefinition.fxml | 5 +- .../gui/texparser/ParseLatexDialog.fxml | 47 +- .../gui/texparser/ParseLatexResult.fxml | 31 +- .../welcome/components/ThemeWireFrame.fxml | 274 ++-- .../EntryTableConfigurationDialog.fxml | 25 +- .../LargeLibraryOptimizationDialog.fxml | 51 +- .../MainFileDirectoryDialog.fxml | 36 +- .../quicksettings/OnlineServicesDialog.fxml | 64 +- .../quicksettings/PushApplicationDialog.fxml | 40 +- .../welcome/quicksettings/ThemeDialog.fxml | 77 +- .../PersonNameStringConverterTest.java | 10 +- .../jabref/gui/edit/CopyMoreActionTest.java | 24 +- ...opyOrMoveFieldContentTabViewModelTest.java | 4 +- .../FieldEditorsMultilinePropertyTest.java | 124 +- .../AutoRenameFileOnEntryChangeTest.java | 4 +- .../externalfiles/FileFilterUtilsTest.java | 32 +- .../gui/externalfiles/ImportHandlerTest.java | 1 - .../UnlinkedFilesDialogViewModelTest.java | 2 +- .../LinkedFilesEditorViewModelTest.java | 6 +- .../contextmenu/ContextMenuFactoryTest.java | 27 +- .../fetcher/WebSearchPaneViewModelTest.java | 4 +- .../ConstantsPropertiesViewModelTest.java | 12 +- .../fieldsmerger/FileMergerTest.java | 4 +- .../JournalAbbreviationsViewModelTabTest.java | 10 +- .../jabref/gui/util/ControlHelperTest.java | 4 +- .../gui/util/IconValidationDecoratorTest.java | 2 +- .../JournalAbbreviationRepositoryTest.java | 12 +- .../GuiPreferencesMigrationsTest.java | 4 +- .../interactive/styletester/StyleTester.fxml | 717 ++++++--- .../org/jabref/cli/ArgumentProcessor.java | 6 +- .../java/org/jabref/cli/CheckIntegrity.java | 4 +- .../src/main/java/org/jabref/cli/Convert.java | 6 +- .../src/main/java/org/jabref/cli/Fetch.java | 5 +- .../org/jabref/cli/ArgumentProcessorTest.java | 2 +- .../org/jabref/logic/FilePreferences.java | 2 +- .../org/jabref/logic/InternalPreferences.java | 4 +- .../main/java/org/jabref/logic/UiCommand.java | 26 +- .../jabref/logic/ai/AiDefaultPreferences.java | 10 +- .../org/jabref/logic/ai/AiPreferences.java | 15 +- .../java/org/jabref/logic/ai/AiService.java | 6 +- .../logic/ai/chatting/AiChatService.java | 8 +- .../logic/ai/chatting/ChatHistoryService.java | 31 +- .../storages/MVStoreChatHistoryStorage.java | 4 +- .../logic/ai/chatting/model/Gpt4AllModel.java | 42 +- .../model/JabRefChatLanguageModel.java | 31 +- .../logic/ai/ingestion/LowLevelIngestor.java | 4 +- .../ai/ingestion/MVStoreEmbeddingStore.java | 13 +- .../ingestion/model/JabRefEmbeddingModel.java | 6 +- .../ai/summarization/GenerateSummaryTask.java | 3 +- .../logic/ai/summarization/Summary.java | 7 +- .../logic/ai/templates/PaperExcerpt.java | 5 +- .../org/jabref/logic/ai/util/MVStoreBase.java | 6 +- .../logic/auxparser/DefaultAuxParser.java | 8 +- .../jabref/logic/biblog/BibtexLogParser.java | 1 - .../org/jabref/logic/bibtex/FieldWriter.java | 1 - .../bibtex/InvalidFieldValueException.java | 4 +- .../bibtex/comparator/BibEntryCompare.java | 6 +- .../bibtex/comparator/EntryComparator.java | 6 +- .../logic/bibtex/comparator/MetaDataDiff.java | 5 +- .../org/jabref/logic/bst/BstFunctions.java | 11 +- .../org/jabref/logic/bst/BstVMContext.java | 15 +- .../org/jabref/logic/bst/BstVMVisitor.java | 3 +- .../jabref/logic/bst/util/BstCaseChanger.java | 5 +- .../logic/bst/util/BstNameFormatter.java | 16 +- .../logic/bst/util/BstTextPrefixer.java | 1 + .../SearchCitationsRelationsService.java | 6 +- ...CitationsAndReferencesRepositoryShell.java | 8 +- .../repository/BibEntrySerializer.java | 12 +- .../citationkeypattern/BracketedPattern.java | 16 +- .../CitationKeyGenerator.java | 3 +- .../CitationKeyPattern.java | 4 +- .../logic/citationstyle/CSLStyleUtils.java | 15 +- .../jabref/logic/cleanup/CleanupWorker.java | 2 +- .../jabref/logic/cleanup/EprintCleanup.java | 6 +- .../org/jabref/logic/crawler/Crawler.java | 4 +- .../StudyCatalogToFetcherConverter.java | 2 +- .../jabref/logic/crawler/StudyRepository.java | 10 +- .../logic/exporter/BibDatabaseWriter.java | 16 +- .../jabref/logic/exporter/CffExporter.java | 22 +- .../logic/exporter/EndnoteXmlExporter.java | 4 +- .../logic/exporter/GroupSerializer.java | 30 +- .../logic/exporter/TemplateExporter.java | 28 +- .../jabref/logic/externalfiles/DateRange.java | 2 +- .../ExternalFilesContentImporter.java | 2 +- .../externalfiles/LinkedFileHandler.java | 10 +- .../bibtexfields/CleanupUrlFormatter.java | 11 +- .../ConvertMSCCodesFormatter.java | 3 +- .../bibtexfields/NormalizeDateFormatter.java | 8 +- .../NormalizeUnicodeFormatter.java | 2 +- .../NormalizeWhitespaceFormatter.java | 2 +- .../bibtexfields/ShortenDOIFormatter.java | 16 +- .../casechanger/SentenceCaseFormatter.java | 18 +- .../casechanger/ShortTitleFormatter.java | 2 +- .../casechanger/TitleCaseFormatter.java | 30 +- .../casechanger/UnprotectTermsFormatter.java | 5 +- .../logic/formatter/casechanger/Word.java | 8 +- .../java/org/jabref/logic/git/GitHandler.java | 10 +- .../org/jabref/logic/git/GitSyncService.java | 11 +- .../GitConflictResolverStrategy.java | 2 +- .../conflicts/SemanticConflictDetector.java | 10 +- .../git/conflicts/ThreeWayEntryConflict.java | 6 +- .../jabref/logic/git/io/RevisionTriple.java | 4 +- .../jabref/logic/git/merge/GitMergeUtil.java | 2 +- .../git/merge/GitSemanticMergeExecutor.java | 12 +- .../org/jabref/logic/git/merge/MergePlan.java | 5 +- .../logic/git/status/GitStatusSnapshot.java | 10 +- .../logic/icore/ConferenceRepository.java | 16 +- .../jabref/logic/icore/ConferenceUtils.java | 6 +- .../logic/importer/AuthorListParser.java | 6 +- .../importer/FetcherServerException.java | 2 +- .../logic/importer/FulltextFetchers.java | 2 +- .../jabref/logic/importer/ImportCleanup.java | 6 +- .../logic/importer/ImportCleanupBiblatex.java | 4 +- .../logic/importer/ImportFormatReader.java | 4 +- .../logic/importer/ImporterPreferences.java | 2 +- .../jabref/logic/importer/OpenDatabase.java | 2 +- .../importer/PagedSearchBasedFetcher.java | 4 +- .../PagedSearchBasedParserFetcher.java | 4 +- .../jabref/logic/importer/ParserResult.java | 6 +- .../jabref/logic/importer/QueryParser.java | 2 +- .../logic/importer/SearchBasedFetcher.java | 4 +- .../jabref/logic/importer/WebFetchers.java | 11 +- .../logic/importer/fetcher/ArXivFetcher.java | 24 +- .../importer/fetcher/ComplexSearchQuery.java | 51 +- .../logic/importer/fetcher/CrossRef.java | 2 +- .../logic/importer/fetcher/DOABFetcher.java | 65 +- .../logic/importer/fetcher/DoiResolution.java | 2 +- .../jabref/logic/importer/fetcher/IEEE.java | 12 +- .../logic/importer/fetcher/LOBIDFetcher.java | 10 +- .../logic/importer/fetcher/OpenAccessDoi.java | 2 +- .../fetcher/ScholarArchiveFetcher.java | 4 +- .../importer/fetcher/SemanticScholar.java | 8 +- .../fetcher/SpringerNatureWebFetcher.java | 4 +- .../isbntobibtex/OpenLibraryIsbnFetcher.java | 10 +- .../AbstractQueryTransformer.java | 11 +- .../CiteSeerQueryTransformer.java | 33 +- .../transformers/IEEEQueryTransformer.java | 8 +- .../BibliographyFromPdfImporter.java | 10 +- .../importer/fileformat/BibtexImporter.java | 6 +- .../importer/fileformat/BibtexParser.java | 9 +- .../importer/fileformat/CffImporter.java | 10 +- .../fileformat/CitaviXmlImporter.java | 139 +- .../importer/fileformat/CustomImporter.java | 2 +- .../fileformat/EndnoteXmlImporter.java | 31 +- .../importer/fileformat/IsiImporter.java | 11 +- .../importer/fileformat/MarcXmlParser.java | 18 +- .../importer/fileformat/MedlineImporter.java | 111 +- .../fileformat/MedlinePlainImporter.java | 3 +- .../importer/fileformat/ModsImporter.java | 67 +- .../importer/fileformat/MrDLibImporter.java | 4 +- .../importer/fileformat/ReferImporter.java | 72 +- .../importer/fileformat/RepecNepImporter.java | 28 +- .../importer/fileformat/RisImporter.java | 36 +- .../fileformat/pdf/PdfContentImporter.java | 15 +- .../logic/importer/util/FileFieldParser.java | 8 +- .../logic/importer/util/GrobidService.java | 28 +- .../util/INSPIREBibtexFilterReader.java | 3 +- .../logic/importer/util/MathMLParser.java | 4 +- .../logic/importer/util/MetaDataParser.java | 6 +- .../logic/integrity/AmpersandChecker.java | 2 +- .../logic/integrity/HowPublishedChecker.java | 4 +- .../integrity/IntegrityCheckResultWriter.java | 3 +- .../integrity/LatexIntegrityChecker.java | 2 +- .../jabref/logic/integrity/PagesChecker.java | 38 +- ...deNormalFormCanonicalCompositionCheck.java | 2 +- .../logic/journals/AbbreviationFormat.java | 12 +- .../JournalAbbreviationRepository.java | 14 +- .../logic/journals/ltwa/LtwaTsvParser.java | 2 +- .../logic/journals/ltwa/PrefixTree.java | 4 +- .../java/org/jabref/logic/l10n/Language.java | 7 +- .../layout/AbstractParamLayoutFormatter.java | 15 +- .../org/jabref/logic/layout/LayoutEntry.java | 227 ++- .../layout/format/AuthorAndsReplacer.java | 6 +- .../jabref/logic/layout/format/CSLType.java | 25 +- .../jabref/logic/layout/format/FirstPage.java | 2 +- .../jabref/logic/layout/format/HTMLChars.java | 3 +- .../logic/layout/format/HayagrivaType.java | 32 +- .../layout/format/JournalAbbreviator.java | 4 +- .../jabref/logic/layout/format/LastPage.java | 2 +- .../logic/layout/format/NameFormatter.java | 50 +- .../jabref/logic/layout/format/Ordinal.java | 12 +- .../jabref/logic/layout/format/RTFChars.java | 22 +- .../logic/layout/format/WrapContent.java | 2 +- .../logic/layout/format/WrapFileLinks.java | 8 +- .../org/jabref/logic/msbib/MSBibEntry.java | 16 +- .../jabref/logic/msbib/MSBibEntryType.java | 2 +- .../org/jabref/logic/msbib/MSBibMapping.java | 2 +- .../org/jabref/logic/net/URLDownload.java | 7 +- .../logic/net/ssl/TrustStoreManager.java | 8 +- .../logic/openoffice/ReferenceMark.java | 8 +- .../logic/openoffice/action/EditMerge.java | 12 +- .../logic/openoffice/backend/Backend52.java | 26 +- .../logic/openoffice/backend/Codec52.java | 25 +- .../backend/NamedRangeReferenceMark.java | 2 +- .../logic/openoffice/frontend/OOFrontend.java | 17 +- .../frontend/UpdateCitationMarkers.java | 6 +- .../openoffice/oocsltext/CSLFormatUtils.java | 2 +- .../jabref/logic/openoffice/style/JStyle.java | 6 +- .../style/JStyleGetCitationMarker.java | 244 ++- .../style/JStyleGetNumCitationMarker.java | 64 +- .../style/OOFormatBibliography.java | 21 +- .../openoffice/style/OOPreFormatter.java | 32 +- .../logic/openoffice/style/OOProcess.java | 26 +- .../style/OOProcessAuthorYearMarkers.java | 26 +- .../style/OOProcessCitationKeyMarkers.java | 10 +- .../style/OOProcessNumericMarkers.java | 2 +- .../src/main/java/org/jabref/logic/os/OS.java | 2 +- .../preferences/JabRefCliPreferences.java | 17 +- .../pseudonymization/Pseudonymization.java | 6 +- .../logic/push/CitationCommandString.java | 5 +- .../logic/push/PushToApplicationDetector.java | 33 +- .../jabref/logic/push/PushToApplications.java | 30 +- .../org/jabref/logic/push/PushToEmacs.java | 8 +- .../org/jabref/logic/push/PushToTeXworks.java | 2 +- .../java/org/jabref/logic/push/PushToVim.java | 12 +- .../BibliographyConsistencyCheck.java | 19 +- ...liographyConsistencyCheckResultWriter.java | 18 +- .../consistency/ConsistencyMessage.java | 4 +- .../remote/server/RemoteMessageHandler.java | 3 +- .../search/indexing/BibFieldsIndexer.java | 12 +- .../query/SearchQueryExtractorVisitor.java | 12 +- .../search/query/SearchQueryVisitor.java | 16 +- .../search/query/SearchToLuceneVisitor.java | 12 +- .../search/query/SearchToSqlVisitor.java | 12 +- .../jabref/logic/shared/DBMSProcessor.java | 4 +- .../java/org/jabref/logic/util/BuildInfo.java | 26 +- .../logic/util/CurrentThreadTaskExecutor.java | 3 +- .../jabref/logic/util/DelayTaskThrottler.java | 2 +- .../org/jabref/logic/util/Directories.java | 6 +- .../logic/util/HeadlessExecutorService.java | 2 +- .../jabref/logic/util/ProgressCounter.java | 5 +- .../org/jabref/logic/util/TaskExecutor.java | 4 +- .../java/org/jabref/logic/util/URLUtil.java | 4 +- .../jabref/logic/util/io/BackupFileUtil.java | 8 +- .../jabref/logic/util/io/FileNameCleaner.java | 2 +- .../logic/util/io/FileNameUniqueness.java | 6 +- .../logic/util/io/RegExpBasedFileFinder.java | 8 +- .../logic/util/strings/StringManipulator.java | 37 +- .../util/strings/UnicodeLigaturesMap.java | 2 +- .../xmp/DocumentInformationExtractor.java | 9 +- .../jabref/logic/xmp/DublinCoreExtractor.java | 23 +- .../org/jabref/logic/xmp/XmpUtilReader.java | 14 +- .../org/jabref/logic/xmp/XmpUtilShared.java | 2 +- .../org/jabref/logic/xmp/XmpUtilWriter.java | 6 +- .../main/java/org/jabref/model/ChainNode.java | 3 +- .../main/java/org/jabref/model/TreeNode.java | 10 +- .../model/database/BibDatabaseContext.java | 1 - .../model/database/BibDatabaseMode.java | 4 +- .../database/BibDatabaseModeDetection.java | 4 +- .../model/database/KeyChangeListener.java | 6 +- .../java/org/jabref/model/entry/Author.java | 8 +- .../org/jabref/model/entry/AuthorList.java | 45 +- .../java/org/jabref/model/entry/BibEntry.java | 19 +- .../org/jabref/model/entry/BibEntryType.java | 16 +- .../model/entry/BibEntryTypeBuilder.java | 6 +- .../model/entry/BibEntryTypesManager.java | 17 +- .../org/jabref/model/entry/BibtexString.java | 4 +- .../java/org/jabref/model/entry/Date.java | 64 +- .../java/org/jabref/model/entry/Langid.java | 2 +- .../java/org/jabref/model/entry/Month.java | 52 +- .../java/org/jabref/model/entry/Season.java | 15 +- .../jabref/model/entry/field/BibField.java | 4 +- .../org/jabref/model/entry/field/Field.java | 2 +- .../model/entry/field/FieldFactory.java | 32 +- .../model/entry/field/SpecialFieldValue.java | 42 +- .../model/entry/field/UnknownField.java | 4 +- .../entry/identifier/ArXivIdentifier.java | 7 +- .../entry/identifier/EprintIdentifier.java | 3 +- .../jabref/model/entry/identifier/SSRN.java | 2 +- .../BiblatexAPAEntryTypeDefinitions.java | 6 +- .../org/jabref/model/groups/SearchGroup.java | 6 +- .../jabref/model/http/SimpleHttpResponse.java | 9 +- .../org/jabref/model/metadata/SaveOrder.java | 2 +- .../metadata/SelfContainedSaveOrder.java | 2 +- .../model/openoffice/DocumentAnnotation.java | 6 +- .../model/openoffice/ootext/OOTextIntoOO.java | 28 +- .../model/openoffice/rangesort/RangeSort.java | 2 +- .../openoffice/rangesort/RangeSortVisual.java | 5 +- .../model/openoffice/style/Citation.java | 8 +- .../model/openoffice/style/CitationType.java | 7 +- .../model/openoffice/style/CitedKeys.java | 2 +- .../model/openoffice/uno/UnoCursor.java | 4 +- .../jabref/model/openoffice/uno/UnoNamed.java | 4 +- .../model/openoffice/uno/UnoProperties.java | 6 +- .../openoffice/uno/UnoReferenceMark.java | 2 +- .../model/openoffice/uno/UnoTextDocument.java | 4 +- .../jabref/model/openoffice/uno/UnoUndo.java | 2 +- .../uno/UnoUserDefinedProperty.java | 6 +- .../model/schema/DublinCoreSchemaCustom.java | 16 +- .../jabref/model/search/PostgreConstants.java | 68 +- .../event/IndexAddedOrUpdatedEvent.java | 3 +- .../model/search/event/IndexRemovedEvent.java | 3 +- .../jabref/model/search/query/NotNode.java | 3 +- .../model/search/query/OperatorNode.java | 4 +- .../model/search/query/SearchQueryNode.java | 4 +- .../org/jabref/model/strings/StringUtil.java | 5 +- .../java/org/jabref/model/study/Study.java | 4 +- .../org/jabref/model/texparser/Citation.java | 7 +- .../jabref/model/util/FileUpdateMonitor.java | 2 +- .../java/org/jabref/model/util/Range.java | 4 +- .../logic/bibtex/BibEntryWriterTest.java | 36 +- .../jabref/logic/bibtex/FieldWriterTest.java | 2 +- .../logic/bibtex/FileFieldWriterTest.java | 8 +- .../comparator/EntryComparatorTest.java | 10 +- .../logic/bst/util/BstTextPrefixerTest.java | 32 +- .../SearchCitationsRelationsServiceTest.java | 6 +- ...tionsAndReferencesRepositoryShellTest.java | 26 +- ...ibEntryRelationsRepositoryTestHelpers.java | 14 +- ...MVStoreBibEntryRelationRepositoryTest.java | 42 +- .../BracketedPatternTest.java | 37 +- .../CitationKeyGeneratorTest.java | 4 +- .../MakeLabelWithoutDatabaseTest.java | 4 +- .../citationstyle/CitationStyleCacheTest.java | 32 +- .../jabref/logic/cleanup/DoiCleanupTest.java | 20 +- .../logic/cleanup/DoiDecodeCleanupTest.java | 12 +- .../RemoveLinksToNotExistentFilesTest.java | 22 +- .../logic/cleanup/RenamePdfCleanupTest.java | 8 +- .../jabref/logic/cleanup/URLCleanupTest.java | 298 ++-- .../logic/database/DatabaseMergerTest.java | 14 +- .../jabref/logic/exporter/ExporterTest.java | 2 +- .../logic/exporter/GroupSerializerTest.java | 2 +- .../logic/exporter/XmpExporterTest.java | 100 +- .../logic/exporter/YamlExporterTest.java | 20 +- .../jabref/logic/formatter/FormatterTest.java | 2 +- .../HtmlToUnicodeFormatterTest.java | 20 +- .../UnicodeToLatexFormatterTest.java | 20 +- .../minifier/MinifyNameListFormatterTest.java | 2 +- .../org/jabref/logic/git/GitHandlerTest.java | 8 +- .../jabref/logic/git/GitSyncServiceTest.java | 160 +- .../git/status/GitStatusCheckerTest.java | 80 +- .../logic/git/util/GitFileWriterTest.java | 11 +- .../logic/git/util/NoopGitSystemReader.java | 6 +- .../util/SemanticConflictDetectorTest.java | 1050 ++++++------- .../logic/git/util/SemanticMergerTest.java | 118 +- .../logic/icore/ConferenceRepositoryTest.java | 64 +- .../logic/icore/ConferenceUtilsTest.java | 230 +-- .../logic/importer/AuthorListParserTest.java | 16 +- .../ImportFormatReaderIntegrationTest.java | 16 +- .../logic/importer/ParserResultTest.java | 54 +- .../logic/importer/WebFetchersTest.java | 16 +- .../fetcher/ACMPortalFetcherTest.java | 32 +- .../importer/fetcher/ArXivFetcherTest.java | 6 +- .../fetcher/BiodiversityLibraryTest.java | 22 +- .../importer/fetcher/BvbFetcherTest.java | 8 +- .../logic/importer/fetcher/CiteSeerTest.java | 8 +- .../importer/fetcher/DOAJFetcherTest.java | 26 +- .../importer/fetcher/ResearchGateTest.java | 2 +- .../importer/fetcher/ScienceDirectTest.java | 1 + .../SearchBasedFetcherCapabilityTest.java | 2 +- .../importer/fetcher/SemanticScholarTest.java | 2 +- .../fetcher/SpringerNatureWebFetcherTest.java | 82 +- .../CitationFetcherHelpersForTest.java | 6 +- .../isbntobibtex/GVKIsbnFetcherTest.java | 2 +- .../CiteSeerQueryTransformerTest.java | 4 +- .../fileformat/ACMPortalParserTest.java | 32 +- .../BibliographyFromPdfImporterTest.java | 20 +- .../fileformat/MedlinePlainImporterTest.java | 4 +- .../fileformat/ReferImporterTest.java | 6 +- .../GrobidPlainCitationParserTest.java | 20 +- .../importer/util/FileFieldParserTest.java | 12 +- .../integrity/DoiDuplicationCheckerTest.java | 2 +- .../integrity/PagesCheckerBiblatexTest.java | 4 +- .../integrity/PagesCheckerBibtexTest.java | 4 +- .../logic/integrity/UTF8CheckerTest.java | 4 +- .../org/jabref/logic/layout/LayoutTest.java | 6 +- .../AbstractParamLayoutFormatterTest.java | 2 +- .../layout/format/CompositeFormatTest.java | 2 +- .../logic/layout/format/DOIStripTest.java | 32 +- .../logic/layout/format/HTMLCharsTest.java | 16 +- .../layout/format/MarkdownFormatterTest.java | 82 +- .../java/org/jabref/logic/net/ProxyTest.java | 52 +- .../oocsltext/CSLFormatUtilsTest.java | 3 +- .../logic/openoffice/style/JStyleTest.java | 20 +- .../ProtectedTermsLoaderTest.java | 4 +- ...hyConsistencyCheckResultCsvWriterTest.java | 15 +- ...hyConsistencyCheckResultTxtWriterTest.java | 21 +- .../BibliographyConsistencyCheckTest.java | 27 +- .../logic/remote/RemoteCommunicationTest.java | 8 +- .../jabref/logic/remote/RemoteSetupTest.java | 6 +- .../DatabaseSearcherWithBibFilesTest.java | 12 +- .../query/SearchQuerySQLConversionTest.java | 1328 ++++++++--------- .../logic/shared/DBMSProcessorTest.java | 2 +- .../logic/util/ExternalLinkCreatorTest.java | 10 +- .../logic/util/FileNameCleanerTest.java | 22 +- .../util/io/RegExpBasedFileFinderTest.java | 10 +- .../util/strings/StringSimilarityTest.java | 36 +- .../database/BibDatabaseContextTest.java | 24 +- .../org/jabref/model/entry/AuthorTest.java | 8 +- .../model/entry/BibEntryTypeBuilderTest.java | 16 +- .../model/entry/BibEntryTypesManagerTest.java | 36 +- .../java/org/jabref/model/entry/DateTest.java | 30 +- .../jabref/model/entry/EntryLinkListTest.java | 4 +- .../model/entry/identifier/DOITest.java | 6 +- .../model/entry/identifier/SSRNTest.java | 2 +- .../types/BibtexEntryTypeDefinitionsTest.java | 6 +- .../model/groups/GroupTreeNodeTest.java | 40 +- .../model/metadata/UserHostInfoTest.java | 18 +- .../jabref/model/strings/StringUtilTest.java | 8 +- .../BibtexTextDocumentService.java | 6 +- .../util/LspDiagnosticBuilder.java | 3 +- .../org/jabref/http/server/cli/ServerCli.java | 6 +- .../java/org/jabref/http/dto/BibEntryDTO.java | 12 +- .../jabref/http/server/LibraryResource.java | 15 +- .../org/jabref/http/server/RootResource.java | 14 +- .../server/cayw/format/BibLatexFormatter.java | 4 +- .../cayw/format/SimpleJsonFormatter.java | 4 +- .../http/server/cayw/gui/CAYWEntry.java | 9 +- .../http/server/services/ServerUtils.java | 8 +- .../http/server/cayw/CAYWResourceTest.java | 3 +- 712 files changed, 12502 insertions(+), 7694 deletions(-) diff --git a/.jbang/CheckoutPR.java b/.jbang/CheckoutPR.java index 98801f5b4e8..5aa2203ab1c 100644 --- a/.jbang/CheckoutPR.java +++ b/.jbang/CheckoutPR.java @@ -15,7 +15,7 @@ import org.kohsuke.github.GitHubBuilder; import org.kohsuke.github.PagedIterator; -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ //RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED @@ -62,7 +62,7 @@ public static void main(String[] args) throws Exception { while (prIterator.hasNext()) { pr = prIterator.next(); if ((contributor.isEmpty() || pr.getHead().getUser().getLogin().equals(contributor)) && - pr.getHead().getRef().equals(branchName)) { + pr.getHead().getRef().equals(branchName)) { found = true; System.out.println("Found pull request #" + pr.getNumber()); break; @@ -165,9 +165,9 @@ private static void checkoutUpstreamMain() throws Exception { // Check if a remote pointing to JabRef/jabref already exists List remotes = git.remoteList().call(); Optional jabrefRemote = remotes.stream() - // We use "contains", because there could be SSH remote URLs - .filter(r -> r.getURIs().stream().anyMatch(uri -> uri.toString().contains("JabRef/jabref"))) - .findFirst(); + // We use "contains", because there could be SSH remote URLs + .filter(r -> r.getURIs().stream().anyMatch(uri -> uri.toString().contains("JabRef/jabref"))) + .findFirst(); String remoteToUse; if (jabrefRemote.isPresent()) { @@ -176,9 +176,9 @@ private static void checkoutUpstreamMain() throws Exception { } else { System.out.println("Adding remote 'upstream' pointing to " + jabrefRepoUrl); git.remoteAdd() - .setName(upstreamName) - .setUri(new URIish(jabrefRepoUrl)) - .call(); + .setName(upstreamName) + .setUri(new URIish(jabrefRepoUrl)) + .call(); remoteToUse = upstreamName; } diff --git a/.jbang/CloneJabRef.java b/.jbang/CloneJabRef.java index 4b6fbb0e047..1fbbaf78f9c 100644 --- a/.jbang/CloneJabRef.java +++ b/.jbang/CloneJabRef.java @@ -1,7 +1,7 @@ import java.nio.file.Files; import java.nio.file.Path; -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 21+ //RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED diff --git a/.jbang/JabKitLauncher.java b/.jbang/JabKitLauncher.java index 0678a94b3dc..b521993c664 100644 --- a/.jbang/JabKitLauncher.java +++ b/.jbang/JabKitLauncher.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //DESCRIPTION jabkit - mange BibTeX files using JabRef diff --git a/.jbang/JabLsLauncher.java b/.jbang/JabLsLauncher.java index ea64b2320e7..357930ecc89 100644 --- a/.jbang/JabLsLauncher.java +++ b/.jbang/JabLsLauncher.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //DESCRIPTION jabls - start a bibtex languageserver diff --git a/.jbang/JabSrvLauncher.java b/.jbang/JabSrvLauncher.java index 353a8c75f97..09df3e0e967 100644 --- a/.jbang/JabSrvLauncher.java +++ b/.jbang/JabSrvLauncher.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //DESCRIPTION jabsrv - serve BibTeX files using JabRef diff --git a/build-support/src/main/java/CitationStyleCatalogGenerator.java b/build-support/src/main/java/CitationStyleCatalogGenerator.java index 0f00c97314f..0e52c0377a9 100644 --- a/build-support/src/main/java/CitationStyleCatalogGenerator.java +++ b/build-support/src/main/java/CitationStyleCatalogGenerator.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 24 //RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED diff --git a/build-support/src/main/java/JournalListMvGenerator.java b/build-support/src/main/java/JournalListMvGenerator.java index cf945736b98..eab0bb15841 100644 --- a/build-support/src/main/java/JournalListMvGenerator.java +++ b/build-support/src/main/java/JournalListMvGenerator.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 24 //RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED @@ -44,7 +44,6 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; - /// Has to be started in the root of the repository due to public class JournalListMvGenerator { diff --git a/build-support/src/main/java/LtwaListMvGenerator.java b/build-support/src/main/java/LtwaListMvGenerator.java index 063d3405380..d4a75fc15fc 100644 --- a/build-support/src/main/java/LtwaListMvGenerator.java +++ b/build-support/src/main/java/LtwaListMvGenerator.java @@ -1,4 +1,4 @@ -///usr/bin/env jbang "$0" "$@" ; exit $? +/// usr/bin/env jbang "$0" "$@" ; exit $? //JAVA 24 //RUNTIME_OPTIONS --enable-native-access=ALL-UNNAMED diff --git a/jabgui/src/main/java/org/jabref/cli/CliImportHelper.java b/jabgui/src/main/java/org/jabref/cli/CliImportHelper.java index 759a5f2432d..7fa6265ddb8 100644 --- a/jabgui/src/main/java/org/jabref/cli/CliImportHelper.java +++ b/jabgui/src/main/java/org/jabref/cli/CliImportHelper.java @@ -30,8 +30,8 @@ public class CliImportHelper { * @param location URL or file path to import */ public static Optional importFile(String location, - CliPreferences cliPreferences, - boolean porcelain) { + CliPreferences cliPreferences, + boolean porcelain) { LOGGER.debug("Importing file from locaiton {}", location); String[] data = location.split(","); @@ -42,7 +42,7 @@ public static Optional importFile(String location, try { file = new URLDownload(address).toTemporaryFile(); } catch (FetcherException | - MalformedURLException e) { + MalformedURLException e) { System.err.println(Localization.lang("Problem downloading from %0: %1", address, e.getLocalizedMessage())); return Optional.empty(); } @@ -63,9 +63,9 @@ public static Optional importFile(String location, return importResult; } - public static Optional importFile(Path file, - CliPreferences cliPreferences, - boolean porcelain) { + public static Optional importFile(Path file, + CliPreferences cliPreferences, + boolean porcelain) { try { ImportFormatReader importFormatReader = new ImportFormatReader( cliPreferences.getImporterPreferences(), diff --git a/jabgui/src/main/java/org/jabref/gui/JabRefDialogService.java b/jabgui/src/main/java/org/jabref/gui/JabRefDialogService.java index 278049ec5d0..3d47502abbe 100644 --- a/jabgui/src/main/java/org/jabref/gui/JabRefDialogService.java +++ b/jabgui/src/main/java/org/jabref/gui/JabRefDialogService.java @@ -446,23 +446,23 @@ public void notify(String message) { LOGGER.info(message); UiTaskExecutor.runInJavaFXThread(() -> - Notifications.create() - .text(message) - .position(Pos.BOTTOM_CENTER) - .hideAfter(TOAST_MESSAGE_DISPLAY_TIME) - .owner(mainWindow) - .threshold(5, - Notifications.create() - .title(Localization.lang("Last notification")) - .text( - "(" + Localization.lang("Check the event log to see all notifications") + ")" - + "\n\n" + message) - .onAction(e -> { - ErrorConsoleAction ec = new ErrorConsoleAction(); - ec.execute(); - })) - .hideCloseButton() - .show()); + Notifications.create() + .text(message) + .position(Pos.BOTTOM_CENTER) + .hideAfter(TOAST_MESSAGE_DISPLAY_TIME) + .owner(mainWindow) + .threshold(5, + Notifications.create() + .title(Localization.lang("Last notification")) + .text( + "(" + Localization.lang("Check the event log to see all notifications") + ")" + + "\n\n" + message) + .onAction(e -> { + ErrorConsoleAction ec = new ErrorConsoleAction(); + ec.execute(); + })) + .hideCloseButton() + .show()); } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/JabRefGUI.java b/jabgui/src/main/java/org/jabref/gui/JabRefGUI.java index bbfa03714f0..dd5f3f4be1b 100644 --- a/jabgui/src/main/java/org/jabref/gui/JabRefGUI.java +++ b/jabgui/src/main/java/org/jabref/gui/JabRefGUI.java @@ -326,7 +326,7 @@ public void onShowing(WindowEvent event) { // Open last edited databases if (uiCommands.stream().noneMatch(UiCommand.BlankWorkspace.class::isInstance) - && preferences.getWorkspacePreferences().shouldOpenLastEdited()) { + && preferences.getWorkspacePreferences().shouldOpenLastEdited()) { mainFrame.openLastEditedDatabases(); } diff --git a/jabgui/src/main/java/org/jabref/gui/LibraryTab.java b/jabgui/src/main/java/org/jabref/gui/LibraryTab.java index a05eacf3020..f1f92e040ed 100644 --- a/jabgui/src/main/java/org/jabref/gui/LibraryTab.java +++ b/jabgui/src/main/java/org/jabref/gui/LibraryTab.java @@ -205,8 +205,8 @@ private LibraryTab(@NonNull BibDatabaseContext bibDatabaseContext, stateManager.activeDatabaseProperty().addListener((_, _, _) -> { if (preferences.getSearchPreferences().isFulltext()) { - mainTable.getTableModel().refreshSearchMatches(); - } + mainTable.getTableModel().refreshSearchMatches(); + } }); } @@ -968,7 +968,7 @@ public void resetChangedProperties() { * Creates a new library tab. Contents are loaded by the {@code dataLoadingTask}. Most of the other parameters are required by {@code resetChangeMonitor()}. * * @param dataLoadingTask The task to execute to load the data asynchronously. - * @param file the path to the file (loaded by the dataLoadingTask) + * @param file the path to the file (loaded by the dataLoadingTask) */ public static LibraryTab createLibraryTab(BackgroundTask dataLoadingTask, Path file, diff --git a/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java b/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java index 8a4b2db488d..2cdf73708df 100644 --- a/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java +++ b/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/AiChatComponent.java @@ -95,8 +95,8 @@ public AiChatComponent(AiService aiService, aiService.getIngestionService().ingest(name, ListUtil.getLinkedFiles(entries).toList(), bibDatabaseContext); ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); } @FXML @@ -215,10 +215,11 @@ private List updateNotificationsForEntry(BibEntry entry) { entry.getFiles().stream().map(file -> aiService.getIngestionService().ingest(file, bibDatabaseContext)).forEach(ingestionStatus -> { switch (ingestionStatus.getState()) { - case PROCESSING -> notifications.add(new Notification( - Localization.lang("File %0 is currently being processed", ingestionStatus.getObject().getLink()), - Localization.lang("After the file is ingested, you will be able to chat with it.") - )); + case PROCESSING -> + notifications.add(new Notification( + Localization.lang("File %0 is currently being processed", ingestionStatus.getObject().getLink()), + Localization.lang("After the file is ingested, you will be able to chat with it.") + )); case ERROR -> { assert ingestionStatus.getException().isPresent(); // When the state is ERROR, the exception must be present. @@ -229,7 +230,8 @@ private List updateNotificationsForEntry(BibEntry entry) { )); } - case SUCCESS -> { } + case SUCCESS -> { + } } }); diff --git a/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java b/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java index 8bb590103ac..890e1761861 100644 --- a/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java +++ b/jabgui/src/main/java/org/jabref/gui/ai/components/aichat/chatprompt/ChatPromptComponent.java @@ -127,9 +127,9 @@ private void initialize() { // The easy way to get rid of this ambiguity is to disallow scrolling when there are new lines in the prompt. // But the exception to this situation is when the caret position is at the beginning of the prompt. history.get().stream() - .skip(newValue.intValue()) - .findFirst() - .ifPresent(message -> userPromptTextArea.setText(message)); + .skip(newValue.intValue()) + .findFirst() + .ifPresent(message -> userPromptTextArea.setText(message)); } } else { // When currentUserMessageScroll is set to NEW_NON_EXISTENT_MESSAGE, then we should: diff --git a/jabgui/src/main/java/org/jabref/gui/ai/components/util/notifications/Notification.java b/jabgui/src/main/java/org/jabref/gui/ai/components/util/notifications/Notification.java index c8123974a16..90ecf40d691 100644 --- a/jabgui/src/main/java/org/jabref/gui/ai/components/util/notifications/Notification.java +++ b/jabgui/src/main/java/org/jabref/gui/ai/components/util/notifications/Notification.java @@ -9,4 +9,7 @@ * about possible problems with entries (because that will affect LLM output), but on the other hand the user would * like to chat with all available entries in the group, even if some of them are not valid. */ -public record Notification(String title, String message) { } +public record Notification( + String title, + String message) { +} diff --git a/jabgui/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java b/jabgui/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java index 77e58b078d9..f95d716b342 100644 --- a/jabgui/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java +++ b/jabgui/src/main/java/org/jabref/gui/autocompleter/AutoCompletionTextInputBinding.java @@ -1,7 +1,7 @@ /** * Copyright (c) 2014, 2015, ControlsFX * All rights reserved. - * + *

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -12,7 +12,7 @@ * * Neither the name of ControlsFX, any associated website, nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + *

* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/jabgui/src/main/java/org/jabref/gui/autocompleter/PersonNameStringConverter.java b/jabgui/src/main/java/org/jabref/gui/autocompleter/PersonNameStringConverter.java index c5fc8cf8fcc..a1869ff6e75 100644 --- a/jabgui/src/main/java/org/jabref/gui/autocompleter/PersonNameStringConverter.java +++ b/jabgui/src/main/java/org/jabref/gui/autocompleter/PersonNameStringConverter.java @@ -41,7 +41,8 @@ public PersonNameStringConverter(AutoCompletePreferences preferences) { public String toString(Author author) { if (autoCompLF) { switch (autoCompleteFirstNameMode) { - case ONLY_ABBREVIATED, BOTH: + case ONLY_ABBREVIATED, + BOTH: return author.getFamilyGiven(true); case ONLY_FULL: return author.getFamilyGiven(false); @@ -51,7 +52,8 @@ public String toString(Author author) { } if (autoCompFF) { switch (autoCompleteFirstNameMode) { - case ONLY_ABBREVIATED, BOTH: + case ONLY_ABBREVIATED, + BOTH: return author.getGivenFamily(true); case ONLY_FULL: return author.getGivenFamily(false); diff --git a/jabgui/src/main/java/org/jabref/gui/autocompleter/SuggestionProvider.java b/jabgui/src/main/java/org/jabref/gui/autocompleter/SuggestionProvider.java index 14755e3a9db..a5405854536 100644 --- a/jabgui/src/main/java/org/jabref/gui/autocompleter/SuggestionProvider.java +++ b/jabgui/src/main/java/org/jabref/gui/autocompleter/SuggestionProvider.java @@ -1,7 +1,7 @@ /** * Copyright (c) 2014, 2016 ControlsFX * All rights reserved. - * + *

* Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright @@ -12,7 +12,7 @@ * * Neither the name of ControlsFX, any associated website, nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. - * + *

* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE diff --git a/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/AutosaveManager.java b/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/AutosaveManager.java index 95b7c9b3ffe..c8a012edc36 100644 --- a/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/AutosaveManager.java +++ b/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/AutosaveManager.java @@ -44,8 +44,8 @@ private AutosaveManager(BibDatabaseContext bibDatabaseContext, CoarseChangeFilte this.executor.scheduleAtFixedRate( () -> { if (needsSave) { - eventBus.post(new AutosaveEvent()); - needsSave = false; + eventBus.post(new AutosaveEvent()); + needsSave = false; } }, DELAY_BETWEEN_AUTOSAVE_ATTEMPTS_IN_SECONDS, diff --git a/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java b/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java index 6477c85aca2..983948d5edc 100644 --- a/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java +++ b/jabgui/src/main/java/org/jabref/gui/autosaveandbackup/BackupManager.java @@ -137,11 +137,10 @@ public static void shutdown(BibDatabaseContext bibDatabaseContext, Path backupDi /** * Checks whether a backup file exists for the given database file. If it exists, it is checked whether it is * newer and different from the original. - * + *

* In case a discarded file is present, the method also returns false, See also {@link #discardBackup(Path)}. * * @param originalPath Path to the file a backup should be checked for. Example: jabref.bib. - * * @return true if backup file exists AND differs from originalPath. false is the * "default" return value in the good case. In case a discarded file exists, false is returned, too. * In the case of an exception true is returned to ensure that the user checks the output. @@ -303,7 +302,7 @@ private static Path determineDiscardedFile(Path file, Path backupDir) { /** * Marks the backups as discarded. - * + *

* We do not delete any files, because the user might want to recover old backup files. * Therefore, we mark discarded backups by a --discarded file. */ @@ -340,11 +339,11 @@ private void startBackupTask(Path backupDir) { fillQueue(backupDir); executor.scheduleAtFixedRate( - // We need to determine the backup path on each action, because we use the timestamp in the filename - () -> determineBackupPathForNewBackup(backupDir).ifPresent(this::performBackup), - DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS, - DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS, - TimeUnit.SECONDS); + // We need to determine the backup path on each action, because we use the timestamp in the filename + () -> determineBackupPathForNewBackup(backupDir).ifPresent(this::performBackup), + DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS, + DELAY_BETWEEN_BACKUP_ATTEMPTS_IN_SECONDS, + TimeUnit.SECONDS); } private void fillQueue(Path backupDir) { @@ -370,7 +369,7 @@ private void fillQueue(Path backupDir) { * Unregisters the BackupManager from the eventBus of {@link BibDatabaseContext}. * This method should only be used when closing a database/JabRef in a normal way. * - * @param backupDir The backup directory + * @param backupDir The backup directory * @param createBackup If the backup manager should still perform a backup */ private void shutdown(Path backupDir, boolean createBackup) { diff --git a/jabgui/src/main/java/org/jabref/gui/auximport/NewSubLibraryAction.java b/jabgui/src/main/java/org/jabref/gui/auximport/NewSubLibraryAction.java index 2af0171b5da..e807348e537 100644 --- a/jabgui/src/main/java/org/jabref/gui/auximport/NewSubLibraryAction.java +++ b/jabgui/src/main/java/org/jabref/gui/auximport/NewSubLibraryAction.java @@ -9,7 +9,7 @@ /** * The action concerned with generate a new (sub-)database from latex AUX file. - * + *

* A new library is created by {@link org.jabref.gui.importer.NewDatabaseAction} */ public class NewSubLibraryAction extends SimpleCommand { diff --git a/jabgui/src/main/java/org/jabref/gui/citationkeypattern/GenerateCitationKeyAction.java b/jabgui/src/main/java/org/jabref/gui/citationkeypattern/GenerateCitationKeyAction.java index c204060d7d2..e537a12eec5 100644 --- a/jabgui/src/main/java/org/jabref/gui/citationkeypattern/GenerateCitationKeyAction.java +++ b/jabgui/src/main/java/org/jabref/gui/citationkeypattern/GenerateCitationKeyAction.java @@ -109,32 +109,32 @@ private BackgroundTask generateKeysInBackground() { @Override public Void call() { - if (isCanceled) { - return null; - } - UiTaskExecutor.runInJavaFXThread(() -> { - updateProgress(0, entries.size()); - messageProperty().set(Localization.lang("%0/%1 entries", 0, entries.size())); - }); - stateManager.getActiveDatabase().ifPresent(databaseContext -> { - // generate the new citation keys for each entry - compound = new NamedCompound(Localization.lang("Autogenerate citation keys")); - CitationKeyGenerator keyGenerator = - new CitationKeyGenerator(databaseContext, preferences.getCitationKeyPatternPreferences()); - int entriesDone = 0; - for (BibEntry entry : entries) { - keyGenerator.generateAndSetKey(entry) - .ifPresent(fieldChange -> compound.addEdit(new UndoableKeyChange(fieldChange))); - entriesDone++; - int finalEntriesDone = entriesDone; - UiTaskExecutor.runInJavaFXThread(() -> { - updateProgress(finalEntriesDone, entries.size()); - messageProperty().set(Localization.lang("%0/%1 entries", finalEntriesDone, entries.size())); - }); - } - compound.end(); - }); + if (isCanceled) { return null; + } + UiTaskExecutor.runInJavaFXThread(() -> { + updateProgress(0, entries.size()); + messageProperty().set(Localization.lang("%0/%1 entries", 0, entries.size())); + }); + stateManager.getActiveDatabase().ifPresent(databaseContext -> { + // generate the new citation keys for each entry + compound = new NamedCompound(Localization.lang("Autogenerate citation keys")); + CitationKeyGenerator keyGenerator = + new CitationKeyGenerator(databaseContext, preferences.getCitationKeyPatternPreferences()); + int entriesDone = 0; + for (BibEntry entry : entries) { + keyGenerator.generateAndSetKey(entry) + .ifPresent(fieldChange -> compound.addEdit(new UndoableKeyChange(fieldChange))); + entriesDone++; + int finalEntriesDone = entriesDone; + UiTaskExecutor.runInJavaFXThread(() -> { + updateProgress(finalEntriesDone, entries.size()); + messageProperty().set(Localization.lang("%0/%1 entries", finalEntriesDone, entries.size())); + }); + } + compound.end(); + }); + return null; } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleAction.java b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleAction.java index 6f9ffc08892..7aa2eeaf70b 100644 --- a/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleAction.java +++ b/jabgui/src/main/java/org/jabref/gui/cleanup/CleanupSingleAction.java @@ -100,15 +100,15 @@ private void doCleanup(BibDatabaseContext databaseContext, CleanupPreferences pr } private void cleanup(BibDatabaseContext databaseContext, CleanupPreferences cleanupPreferences) { - // undo granularity is on entry level - NamedCompound ce = new NamedCompound(Localization.lang("Cleanup entry")); + // undo granularity is on entry level + NamedCompound ce = new NamedCompound(Localization.lang("Cleanup entry")); - doCleanup(databaseContext, cleanupPreferences, entry, ce); + doCleanup(databaseContext, cleanupPreferences, entry, ce); - ce.end(); - if (ce.hasEdits()) { - undoManager.addEdit(ce); - } + ce.end(); + if (ce.hasEdits()) { + undoManager.addEdit(ce); + } } private void showFailures(List failures) { diff --git a/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangeDetailsViewFactory.java b/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangeDetailsViewFactory.java index 39939bce263..a9e49e3ce8f 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangeDetailsViewFactory.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangeDetailsViewFactory.java @@ -54,41 +54,51 @@ public DatabaseChangeDetailsViewFactory(BibDatabaseContext databaseContext, public DatabaseChangeDetailsView create(DatabaseChange databaseChange) { return switch (databaseChange) { - case EntryChange entryChange -> new EntryChangeDetailsView( - entryChange.getOldEntry(), - entryChange.getNewEntry(), - databaseContext, - dialogService, - themeManager, - preferences, - entryTypesManager, - previewViewer, - taskExecutor - ); - case EntryAdd entryAdd -> new EntryWithPreviewAndSourceDetailsView( - entryAdd.getAddedEntry(), - databaseContext, - preferences, - entryTypesManager, - previewViewer - ); - case EntryDelete entryDelete -> new EntryWithPreviewAndSourceDetailsView( - entryDelete.getDeletedEntry(), - databaseContext, - preferences, - entryTypesManager, - previewViewer - ); - case BibTexStringAdd stringAdd -> new BibTexStringAddDetailsView(stringAdd); - case BibTexStringDelete stringDelete -> new BibTexStringDeleteDetailsView(stringDelete); - case BibTexStringChange stringChange -> new BibTexStringChangeDetailsView(stringChange); - case BibTexStringRename stringRename -> new BibTexStringRenameDetailsView(stringRename); - case MetadataChange metadataChange -> new MetadataChangeDetailsView( - metadataChange, - preferences.getCitationKeyPatternPreferences().getKeyPatterns() - ); - case GroupChange groupChange -> new GroupChangeDetailsView(groupChange); - case PreambleChange preambleChange -> new PreambleChangeDetailsView(preambleChange); + case EntryChange entryChange -> + new EntryChangeDetailsView( + entryChange.getOldEntry(), + entryChange.getNewEntry(), + databaseContext, + dialogService, + themeManager, + preferences, + entryTypesManager, + previewViewer, + taskExecutor + ); + case EntryAdd entryAdd -> + new EntryWithPreviewAndSourceDetailsView( + entryAdd.getAddedEntry(), + databaseContext, + preferences, + entryTypesManager, + previewViewer + ); + case EntryDelete entryDelete -> + new EntryWithPreviewAndSourceDetailsView( + entryDelete.getDeletedEntry(), + databaseContext, + preferences, + entryTypesManager, + previewViewer + ); + case BibTexStringAdd stringAdd -> + new BibTexStringAddDetailsView(stringAdd); + case BibTexStringDelete stringDelete -> + new BibTexStringDeleteDetailsView(stringDelete); + case BibTexStringChange stringChange -> + new BibTexStringChangeDetailsView(stringChange); + case BibTexStringRename stringRename -> + new BibTexStringRenameDetailsView(stringRename); + case MetadataChange metadataChange -> + new MetadataChangeDetailsView( + metadataChange, + preferences.getCitationKeyPatternPreferences().getKeyPatterns() + ); + case GroupChange groupChange -> + new GroupChangeDetailsView(groupChange); + case PreambleChange preambleChange -> + new PreambleChangeDetailsView(preambleChange); }; } } diff --git a/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangesResolverDialog.java b/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangesResolverDialog.java index 3c0be42e6ed..153470dd696 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangesResolverDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/DatabaseChangesResolverDialog.java @@ -66,7 +66,7 @@ public class DatabaseChangesResolverDialog extends BaseDialog { * A dialog going through given changes, which are diffs to the provided database. * Each accepted change is written to the provided database. * - * @param changes The list of changes + * @param changes The list of changes * @param database The database to apply the changes to */ public DatabaseChangesResolverDialog(List changes, BibDatabaseContext database, String dialogTitle) { @@ -75,8 +75,8 @@ public DatabaseChangesResolverDialog(List changes, BibDatabaseCo this.setTitle(dialogTitle); ViewLoader.view(this) - .load() - .setAsDialogPane(this); + .load() + .setAsDialogPane(this); this.setResultConverter(button -> { if (viewModel.areAllChangesResolved()) { diff --git a/jabgui/src/main/java/org/jabref/gui/collab/entryadd/EntryAdd.java b/jabgui/src/main/java/org/jabref/gui/collab/entryadd/EntryAdd.java index abf8ae633bf..1f73d3c1dad 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/entryadd/EntryAdd.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/entryadd/EntryAdd.java @@ -15,8 +15,8 @@ public EntryAdd(BibEntry addedEntry, BibDatabaseContext databaseContext, Databas super(databaseContext, databaseChangeResolverFactory); this.addedEntry = addedEntry; setChangeName(addedEntry.getCitationKey() - .map(key -> Localization.lang("Added entry '%0'", key)) - .orElse(Localization.lang("Added entry"))); + .map(key -> Localization.lang("Added entry '%0'", key)) + .orElse(Localization.lang("Added entry"))); } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChange.java b/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChange.java index 44189beef93..32e2826ee45 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChange.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChange.java @@ -20,7 +20,7 @@ public EntryChange(BibEntry oldEntry, BibEntry newEntry, BibDatabaseContext data this.oldEntry = oldEntry; this.newEntry = newEntry; setChangeName(oldEntry.getCitationKey().map(key -> Localization.lang("Modified entry '%0'", key)) - .orElse(Localization.lang("Modified entry"))); + .orElse(Localization.lang("Modified entry"))); } public EntryChange(BibEntry oldEntry, BibEntry newEntry, BibDatabaseContext databaseContext) { diff --git a/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChangeDetailsView.java b/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChangeDetailsView.java index 552e2e7bdb3..2f91e5fb135 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChangeDetailsView.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/entrychange/EntryChangeDetailsView.java @@ -56,8 +56,8 @@ public EntryChangeDetailsView(BibEntry oldEntry, TabPane newEntryTabPane = newPreviewWithSourcesTab.getPreviewWithSourceTab(newEntry, databaseContext, preferences, entryTypesManager, previewViewer, Localization.lang("Entry Preview")); EasyBind.subscribe( - oldEntryTabPane.getSelectionModel().selectedIndexProperty(), - selectedIndex -> newEntryTabPane.getSelectionModel().select(selectedIndex.intValue())); + oldEntryTabPane.getSelectionModel().selectedIndexProperty(), + selectedIndex -> newEntryTabPane.getSelectionModel().select(selectedIndex.intValue())); EasyBind.subscribe(newEntryTabPane.getSelectionModel().selectedIndexProperty(), selectedIndex -> { if (oldEntryTabPane.getSelectionModel().getSelectedIndex() != selectedIndex.intValue()) { diff --git a/jabgui/src/main/java/org/jabref/gui/collab/entrydelete/EntryDelete.java b/jabgui/src/main/java/org/jabref/gui/collab/entrydelete/EntryDelete.java index 36116bb5845..67b4b34edd1 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/entrydelete/EntryDelete.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/entrydelete/EntryDelete.java @@ -15,8 +15,8 @@ public EntryDelete(BibEntry deletedEntry, BibDatabaseContext databaseContext, Da super(databaseContext, databaseChangeResolverFactory); this.deletedEntry = deletedEntry; setChangeName(deletedEntry.getCitationKey() - .map(key -> Localization.lang("Deleted entry '%0'", key)) - .orElse(Localization.lang("Deleted entry"))); + .map(key -> Localization.lang("Deleted entry '%0'", key)) + .orElse(Localization.lang("Deleted entry"))); } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/collab/metedatachange/MetadataChangeDetailsView.java b/jabgui/src/main/java/org/jabref/gui/collab/metedatachange/MetadataChangeDetailsView.java index 09600d4c756..4700361558e 100644 --- a/jabgui/src/main/java/org/jabref/gui/collab/metedatachange/MetadataChangeDetailsView.java +++ b/jabgui/src/main/java/org/jabref/gui/collab/metedatachange/MetadataChangeDetailsView.java @@ -38,8 +38,8 @@ public MetadataChangeDetailsView(MetadataChange metadataChange, GlobalCitationKe * Adds a view for a specific metadata difference to the container. * Default view if not a group diff. * - * @param container The parent container to add the difference view to - * @param diff The metadata difference to display + * @param container The parent container to add the difference view to + * @param diff The metadata difference to display * @param metadataChange The metadata change object containing all changes */ private void addDifferenceView(VBox container, MetaDataDiff.Difference diff, MetadataChange metadataChange) { @@ -176,14 +176,14 @@ private String convertGroupTreeToString(GroupTreeNode node) { /** * Recursively appends a group tree node to the string builder. * - * @param node The current node to append + * @param node The current node to append * @param builder The string builder to append to - * @param level The current depth level in the tree (for indentation) + * @param level The current depth level in the tree (for indentation) */ private void appendGroupTreeNode(GroupTreeNode node, StringBuilder builder, int level) { builder.append("| ".repeat(level)) - .append(node.getName()) - .append("\n"); + .append(node.getName()) + .append("\n"); for (GroupTreeNode child : node.getChildren()) { appendGroupTreeNode(child, builder, level + 1); diff --git a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/SaveOrderConfigPanel.java b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/SaveOrderConfigPanel.java index 557f961d424..cf94debf73a 100644 --- a/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/SaveOrderConfigPanel.java +++ b/jabgui/src/main/java/org/jabref/gui/commonfxcontrols/SaveOrderConfigPanel.java @@ -60,8 +60,8 @@ private void initialize() { viewModel.sortCriteriaProperty().addListener((ListChangeListener) change -> { while (change.next()) { if (change.wasReplaced()) { - clearCriterionRow(change.getFrom()); - createCriterionRow(change.getAddedSubList().getFirst(), change.getFrom()); + clearCriterionRow(change.getFrom()); + createCriterionRow(change.getAddedSubList().getFirst(), change.getFrom()); } else if (change.wasAdded()) { for (SortCriterionViewModel criterionViewModel : change.getAddedSubList()) { int row = change.getFrom() + change.getAddedSubList().indexOf(criterionViewModel); diff --git a/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialog.java b/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialog.java index 7924781dc3b..289c53c5a4d 100644 --- a/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialog.java @@ -90,7 +90,7 @@ public void initialize() { viewModel.selectedEntryTypeProperty().addListener((_, _, newValue) -> filteredData.setPredicate(message -> message.message().getFirst().equals(newValue) - )); + )); tableView.setItems(filteredData); @@ -168,8 +168,8 @@ protected void updateItem(String item, boolean empty) { ); targetSymbols.stream() - .map(ConsistencySymbol::getText) - .forEach(this::removeColumnWithUniformValue); + .map(ConsistencySymbol::getText) + .forEach(this::removeColumnWithUniformValue); Arrays.stream(SpecialField.values()) .map(SpecialField::getDisplayName) diff --git a/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialogViewModel.java b/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialogViewModel.java index 263cd7576b3..7463fccc971 100644 --- a/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialogViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/consistency/ConsistencyCheckDialogViewModel.java @@ -65,10 +65,10 @@ public ConsistencyCheckDialogViewModel(DialogService dialogService, this.result = result; this.allReportedFields = result.entryTypeToResultMap().values().stream() - .flatMap(entryTypeResult -> entryTypeResult.fields().stream()) - .sorted(Comparator.comparing(Field::getName)) - .distinct() - .toList(); + .flatMap(entryTypeResult -> entryTypeResult.fields().stream()) + .sorted(Comparator.comparing(Field::getName)) + .distinct() + .toList(); result.entryTypeToResultMap().entrySet().stream() .sorted(Comparator.comparing(entry -> entry.getKey().getName())) @@ -93,7 +93,7 @@ public List getColumnNames() { List result = new ArrayList<>(allReportedFields.size() + 2); // there are two extra columns result.add("Entry Type"); result.add("CitationKey"); - allReportedFields.forEach(field-> result.add(field.getDisplayName().trim())); + allReportedFields.forEach(field -> result.add(field.getDisplayName().trim())); return result; } @@ -119,14 +119,14 @@ private void writeMapEntry(Map.Entry bibEntries = entries.sortedEntries(); bibEntries.forEach(Unchecked.consumer(bibEntry -> - writeBibEntry(bibEntry, entryType, requiredFields, optionalFields) + writeBibEntry(bibEntry, entryType, requiredFields, optionalFields) )); } private void writeBibEntry(BibEntry bibEntry, String entryType, Set requiredFields, Set optionalFields) { List theRecord = getFindingsAsList(bibEntry, entryType, requiredFields, optionalFields); List message = new ArrayList<>(); - for (String s: theRecord) { + for (String s : theRecord) { String modifiedString = s.replaceAll("\\s+", " "); message.add(modifiedString); } @@ -138,15 +138,15 @@ private List getFindingsAsList(BibEntry bibEntry, String entryType, Set< result.add(entryType); result.add(bibEntry.getCitationKey().orElse("")); allReportedFields.forEach(field -> - result.add(bibEntry.getField(field).map(_ -> { - if (requiredFields.contains(field)) { - return ConsistencySymbol.REQUIRED_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); - } else if (optionalFields.contains(field)) { - return ConsistencySymbol.OPTIONAL_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); - } else { - return ConsistencySymbol.UNKNOWN_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); - } - }).orElse(ConsistencySymbol.UNSET_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText())) + result.add(bibEntry.getField(field).map(_ -> { + if (requiredFields.contains(field)) { + return ConsistencySymbol.REQUIRED_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); + } else if (optionalFields.contains(field)) { + return ConsistencySymbol.OPTIONAL_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); + } else { + return ConsistencySymbol.UNKNOWN_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText(); + } + }).orElse(ConsistencySymbol.UNSET_FIELD_AT_ENTRY_TYPE_CELL_ENTRY.getText())) ); return result; } diff --git a/jabgui/src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java b/jabgui/src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java index 39539032415..af7dea79214 100644 --- a/jabgui/src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java +++ b/jabgui/src/main/java/org/jabref/gui/desktop/os/NativeDesktop.java @@ -49,7 +49,7 @@ *

* See https://stackoverflow.com/questions/18004150/desktop-api-is-not-supported-on-the-current-platform for more implementation hints. * https://docs.oracle.com/javase/7/docs/api/java/awt/Desktop.html cannot be used as we don't want to rely on AWT. - * + *

* For non-GUI things, see {@link org.jabref.logic.os.OS}. */ @AllowedToUseAwt("Because of moveToTrash() is not available elsewhere.") @@ -139,7 +139,8 @@ public static void openExternalViewer(BibDatabaseContext databaseContext, LoggerFactory.getLogger(NativeDesktop.class).error("An error occurred on the command: {}", link, e); } } - case null, default -> + case null, + default -> LoggerFactory.getLogger(NativeDesktop.class).info("Message: currently only PDF, PS and HTML files can be opened by double clicking"); } } @@ -358,13 +359,13 @@ public static NativeDesktop get() { * @return the path */ public Path getDefaultFileChooserDirectory() { - Path userDirectory = Directories.getUserDirectory(); - Path documents = userDirectory.resolve("Documents"); - if (!Files.exists(documents)) { - return userDirectory; - } - return documents; - } + Path userDirectory = Directories.getUserDirectory(); + Path documents = userDirectory.resolve("Documents"); + if (!Files.exists(documents)) { + return userDirectory; + } + return documents; + } /** * Moves the given file to the trash. diff --git a/jabgui/src/main/java/org/jabref/gui/desktop/os/OSX.java b/jabgui/src/main/java/org/jabref/gui/desktop/os/OSX.java index 98feb0f4230..06762bce2f7 100644 --- a/jabgui/src/main/java/org/jabref/gui/desktop/os/OSX.java +++ b/jabgui/src/main/java/org/jabref/gui/desktop/os/OSX.java @@ -47,7 +47,7 @@ public void openFolderAndSelectFile(Path file) throws IOException { @Override public void openConsole(String absolutePath, DialogService dialogService) throws IOException { - new ProcessBuilder("open", "-a", "Terminal", absolutePath).start(); + new ProcessBuilder("open", "-a", "Terminal", absolutePath).start(); } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/documentviewer/DocumentViewerView.java b/jabgui/src/main/java/org/jabref/gui/documentviewer/DocumentViewerView.java index 9544366d836..24f7d31ce2e 100644 --- a/jabgui/src/main/java/org/jabref/gui/documentviewer/DocumentViewerView.java +++ b/jabgui/src/main/java/org/jabref/gui/documentviewer/DocumentViewerView.java @@ -103,7 +103,7 @@ private void setupFileChoice() { private void setupViewer() { viewModel.currentDocumentProperty().addListener((_, _, newDocument) -> { - viewer.show(newDocument); + viewer.show(newDocument); }); viewModel.currentPageProperty().bindBidirectional(viewer.currentPageProperty()); viewModel.highlightTextProperty().bindBidirectional(viewer.highlightTextProperty()); diff --git a/jabgui/src/main/java/org/jabref/gui/duplicationFinder/DuplicateResolverDialog.java b/jabgui/src/main/java/org/jabref/gui/duplicationFinder/DuplicateResolverDialog.java index 5629a41cc9c..945500f9ac2 100644 --- a/jabgui/src/main/java/org/jabref/gui/duplicationFinder/DuplicateResolverDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/duplicationFinder/DuplicateResolverDialog.java @@ -107,7 +107,8 @@ private void init(BibEntry one, BibEntry two, DuplicateResolverType type) { threeWayMerge = new ThreeWayMergeView(one, two, Localization.lang("Existing entry"), Localization.lang("From import"), preferences); } - default -> throw new IllegalStateException("Switch expression should be exhaustive"); + default -> + throw new IllegalStateException("Switch expression should be exhaustive"); } this.getDialogPane().getButtonTypes().addAll(first, second, both, merge, cancel); diff --git a/jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java b/jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java index d99d35c7863..1268ba239c5 100644 --- a/jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java +++ b/jabgui/src/main/java/org/jabref/gui/edit/CopyMoreAction.java @@ -69,7 +69,8 @@ public void execute() { copyKeyAndTitle(); case COPY_CITATION_KEY_AND_LINK -> copyKeyAndLink(); - case COPY_DOI, COPY_DOI_URL -> + case COPY_DOI, + COPY_DOI_URL -> copyDoi(); case COPY_FIELD_AUTHOR -> copyField(StandardField.AUTHOR, Localization.lang("Author")); diff --git a/jabgui/src/main/java/org/jabref/gui/edit/EditAction.java b/jabgui/src/main/java/org/jabref/gui/edit/EditAction.java index 48133bb10da..30df1722dc3 100644 --- a/jabgui/src/main/java/org/jabref/gui/edit/EditAction.java +++ b/jabgui/src/main/java/org/jabref/gui/edit/EditAction.java @@ -56,14 +56,22 @@ public void execute() { // Focus is on text field -> copy/paste/cut selected text // DELETE_ENTRY in text field should do forward delete switch (action) { - case SELECT_ALL -> textInput.selectAll(); - case COPY -> textInput.copy(); - case CUT -> textInput.cut(); - case PASTE -> textInput.paste(); - case DELETE -> textInput.clear(); - case DELETE_ENTRY -> textInput.deleteNextChar(); - case UNDO -> textInput.undo(); - case REDO -> textInput.redo(); + case SELECT_ALL -> + textInput.selectAll(); + case COPY -> + textInput.copy(); + case CUT -> + textInput.cut(); + case PASTE -> + textInput.paste(); + case DELETE -> + textInput.clear(); + case DELETE_ENTRY -> + textInput.deleteNextChar(); + case UNDO -> + textInput.undo(); + case REDO -> + textInput.redo(); default -> { String message = "Only cut/copy/paste supported in TextInputControl but got " + action; LOGGER.error(message); @@ -77,10 +85,14 @@ public void execute() { // Not sure what is selected -> copy/paste/cut selected entries except for Preview and CodeArea switch (action) { - case COPY -> tabSupplier.get().copyEntry(); - case CUT -> tabSupplier.get().cutEntry(); - case PASTE -> tabSupplier.get().pasteEntry(); - case DELETE_ENTRY -> tabSupplier.get().deleteEntry(); + case COPY -> + tabSupplier.get().copyEntry(); + case CUT -> + tabSupplier.get().cutEntry(); + case PASTE -> + tabSupplier.get().pasteEntry(); + case DELETE_ENTRY -> + tabSupplier.get().deleteEntry(); case UNDO -> { if (undoManager.canUndo()) { undoManager.undo(); @@ -91,7 +103,8 @@ public void execute() { undoManager.redo(); } } - default -> LOGGER.debug("Only cut/copy/paste/deleteEntry supported but got: {} and focus owner {}", action, focusOwner); + default -> + LOGGER.debug("Only cut/copy/paste/deleteEntry supported but got: {} and focus owner {}", action, focusOwner); } } }); diff --git a/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/MoveFieldValueAction.java b/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/MoveFieldValueAction.java index 660c2f8454b..75ec0b610a6 100644 --- a/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/MoveFieldValueAction.java +++ b/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/MoveFieldValueAction.java @@ -55,7 +55,8 @@ public void execute() { /** * @return the number of affected entries - * */ + * + */ public int executeAndGetAffectedEntriesCount() { execute(); return affectedEntriesCount; diff --git a/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/editfieldcontent/EditFieldContentViewModel.java b/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/editfieldcontent/EditFieldContentViewModel.java index 933e1d4f87b..6f7919a1427 100644 --- a/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/editfieldcontent/EditFieldContentViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/edit/automaticfiededitor/editfieldcontent/EditFieldContentViewModel.java @@ -74,7 +74,7 @@ public void clearSelectedField() { Optional oldFieldValue = entry.getField(selectedField.get()); if (oldFieldValue.isPresent()) { entry.clearField(selectedField.get()) - .ifPresent(fieldChange -> clearFieldEdit.addEdit(new UndoableFieldChange(fieldChange))); + .ifPresent(fieldChange -> clearFieldEdit.addEdit(new UndoableFieldChange(fieldChange))); affectedEntriesCount++; } } @@ -125,7 +125,7 @@ public void appendToFieldValue() { String newFieldValue = oldFieldValue.orElse("").concat(toAppendFieldValue); entry.setField(selectedField.get(), newFieldValue) - .ifPresent(fieldChange -> appendToFieldEdit.addEdit(new UndoableFieldChange(fieldChange))); + .ifPresent(fieldChange -> appendToFieldEdit.addEdit(new UndoableFieldChange(fieldChange))); fieldValue.set(""); affectedEntriesCount++; diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 4c72ecca4f7..fe4573adb69 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -496,8 +496,8 @@ private void fetchAndMerge(EntryBasedFetcher fetcher) { public void setFocusToField(Field field) { UiTaskExecutor.runInJavaFXThread(() -> { - Field actualField = field; - boolean fieldFound = false; + Field actualField = field; + boolean fieldFound = false; for (Tab tab : tabbed.getTabs()) { tabbed.getSelectionModel().select(tab); if ((tab instanceof FieldsEditorTab fieldsEditorTab) diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java index 04226effec1..9a9c14e4fa8 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/LatexCitationsTabViewModel.java @@ -99,9 +99,9 @@ public void handleMouseClick(MouseEvent event, CitationsDisplay citationsDisplay String applicationName = preferences.getPushToApplicationPreferences() .getActiveApplicationName(); GuiPushToApplication application = GuiPushToApplications.getGUIApplicationByName( - applicationName, - dialogService, - preferences.getPushToApplicationPreferences()) + applicationName, + dialogService, + preferences.getPushToApplicationPreferences()) .orElseGet(() -> new GuiPushToTeXstudio(dialogService, preferences.getPushToApplicationPreferences())); preferences.getPushToApplicationPreferences().setActiveApplicationName(application.getDisplayName()); application.jumpToLine(selectedItem.path(), selectedItem.line(), selectedItem.colStart()); diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java index e75e2dfc456..472d482e98b 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/OtherFieldsTab.java @@ -74,8 +74,8 @@ protected SequencedSet determineFieldsToShow(BibEntry entry) { Set allKnownFields = entryType.get().getAllFields(); // Remove all fields being required or optional SequencedSet otherFields = entry.getFields().stream() - .filter(field -> !allKnownFields.contains(field)) - .collect(Collectors.toCollection(LinkedHashSet::new)); + .filter(field -> !allKnownFields.contains(field)) + .collect(Collectors.toCollection(LinkedHashSet::new)); // The key field is in the required tab, but has a special treatment otherFields.remove(InternalField.KEY_FIELD); // Remove all fields contained in JabRef's tab "Deprecated" diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/SciteTab.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/SciteTab.java index 5bb7390f7a1..0e580926a35 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/SciteTab.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/SciteTab.java @@ -200,9 +200,9 @@ private VBox getMessageBox(String url, Label titleLabel, Text message) { } catch (IOException ioex) { // Can't throw a checked exception from here, so display a message to the user instead. dialogService.showErrorDialogAndWait( - "An error occurred opening web browser", - "JabRef was unable to open a web browser for link:\n\n" + url + "\n\nError Message:\n\n" + ioex.getMessage(), - ioex + "An error occurred opening web browser", + "JabRef was unable to open a web browser for link:\n\n" + url + "\n\nError Message:\n\n" + ioex.getMessage(), + ioex ); } } diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/SourceTab.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/SourceTab.java index 996578ba346..9e4eb5b733e 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/SourceTab.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/SourceTab.java @@ -363,7 +363,9 @@ private void storeSource(BibEntry outOfFocusEntry, String text) { private void listenForSaveKeybinding(KeyEvent event) { keyBindingRepository.mapToKeyBinding(event).ifPresent(binding -> { switch (binding) { - case SAVE_DATABASE, SAVE_ALL, SAVE_DATABASE_AS -> + case SAVE_DATABASE, + SAVE_ALL, + SAVE_DATABASE_AS -> storeSource(currentEntry, codeArea.textProperty().getValue()); } }); @@ -380,10 +382,14 @@ public EditAction(StandardActions command) { @Override public void execute() { switch (command) { - case COPY -> codeArea.copy(); - case CUT -> codeArea.cut(); - case PASTE -> codeArea.paste(); - case SELECT_ALL -> codeArea.selectAll(); + case COPY -> + codeArea.copy(); + case CUT -> + codeArea.cut(); + case PASTE -> + codeArea.paste(); + case SELECT_ALL -> + codeArea.selectAll(); } codeArea.requestFocus(); } diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/BibEntryView.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/BibEntryView.java index 279f27072e7..71a92d092b4 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/BibEntryView.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/BibEntryView.java @@ -100,8 +100,8 @@ private static boolean isRTL(String text) { * * @param text The summary text content * @return Node with either: - * - ScrollPane (for RTL text) - * - TextFlowLimited (for LTR text) + * - ScrollPane (for RTL text) + * - TextFlowLimited (for LTR text) */ private static Node createSummary(String text) { if (isRTL(text)) { @@ -116,13 +116,13 @@ private static Node createSummary(String text) { } /** - * Creates a label with horizontal scrolling for RTL text, + * Creates a label with horizontal scrolling for RTL text, * avoiding JavaFX bug related to RTL text wrapping * * @param text The label text content * @return Node with either: - * - ScrollPane (for RTL text) - * - Wrapped Label (for LTR text) + * - ScrollPane (for RTL text) + * - Wrapped Label (for LTR text) */ private static Node createLabel(String text) { if (isRTL(text)) { diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java index f67ed7b12e1..25e179df1c3 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationRelationsTab.java @@ -121,12 +121,12 @@ public CitationRelationsTab(DialogService dialogService, this.searchCitationsRelationsService = searchCitationsRelationsService; this.citationsRelationsTabViewModel = new CitationsRelationsTabViewModel( - preferences, - undoManager, - stateManager, - dialogService, - fileUpdateMonitor, - taskExecutor + preferences, + undoManager, + stateManager, + dialogService, + fileUpdateMonitor, + taskExecutor ); } @@ -515,18 +515,18 @@ private void executeSearch(CitationComponents citationComponents) { * TODO: Make the method return a callable and let the calling method create the background task. */ private BackgroundTask> createBackgroundTask( - BibEntry entry, CitationFetcher.SearchType searchType + BibEntry entry, CitationFetcher.SearchType searchType ) { return switch (searchType) { case CitationFetcher.SearchType.CITES -> { citingTask = BackgroundTask.wrap( - () -> this.searchCitationsRelationsService.searchCites(entry) + () -> this.searchCitationsRelationsService.searchCites(entry) ); yield citingTask; } case CitationFetcher.SearchType.CITED_BY -> { citedByTask = BackgroundTask.wrap( - () -> this.searchCitationsRelationsService.searchCitedBy(entry) + () -> this.searchCitationsRelationsService.searchCitedBy(entry) ); yield citedByTask; } @@ -603,7 +603,7 @@ private void importEntries(List entriesToImport, CitationF * Function to open possible duplicate entries window to compare duplicate entries * * @param citationRelationItem duplicate in the citation relations tab - * @param listView CheckListView to display citations + * @param listView CheckListView to display citations */ private void openPossibleDuplicateEntriesWindow(CitationRelationItem citationRelationItem, CheckListView listView) { BibEntry libraryEntry = citationRelationItem.localEntry(); diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationsRelationsTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationsRelationsTabViewModel.java index 7f75c6c68b1..260a8b798e5 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationsRelationsTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/citationrelationtab/CitationsRelationsTabViewModel.java @@ -56,8 +56,10 @@ public void importEntries(List entriesToImport, CitationFe boolean generateNewKeyOnImport = preferences.getImporterPreferences().generateNewKeyOnImportProperty().get(); switch (searchType) { - case CITES -> importCites(entries, existingEntry, importHandler, generator, generateNewKeyOnImport); - case CITED_BY -> importCitedBy(entries, existingEntry, importHandler, generator, generateNewKeyOnImport); + case CITES -> + importCites(entries, existingEntry, importHandler, generator, generateNewKeyOnImport); + case CITED_BY -> + importCitedBy(entries, existingEntry, importHandler, generator, generateNewKeyOnImport); } } diff --git a/jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTab.java b/jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTab.java index 462618171ae..fd43d08a1f3 100644 --- a/jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTab.java +++ b/jabgui/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTab.java @@ -38,12 +38,12 @@ public boolean shouldShow(BibEntry entry) { return entry.getField(StandardField.FILE).isPresent() && stateManager.activeTabProperty().get() - .map(tab -> tab.getAnnotationCache() - .getFromCache(entry) - .values() - .stream() - .anyMatch(list -> !list.isEmpty())) - .orElse(false); + .map(tab -> tab.getAnnotationCache() + .getFromCache(entry) + .values() + .stream() + .anyMatch(list -> !list.isEmpty())) + .orElse(false); } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/errorconsole/LogEventViewModel.java b/jabgui/src/main/java/org/jabref/gui/errorconsole/LogEventViewModel.java index 47ba7ac56ee..f549048fd21 100644 --- a/jabgui/src/main/java/org/jabref/gui/errorconsole/LogEventViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/errorconsole/LogEventViewModel.java @@ -24,17 +24,23 @@ public String getDisplayText() { public String getStyleClass() { return switch (logEvent.getLevel()) { - case ERROR -> "exception"; - case WARN -> "output"; - default -> "log"; + case ERROR -> + "exception"; + case WARN -> + "output"; + default -> + "log"; }; } public JabRefIcon getIcon() { return switch (logEvent.getLevel()) { - case ERROR -> IconTheme.JabRefIcons.INTEGRITY_FAIL; - case WARN -> IconTheme.JabRefIcons.INTEGRITY_WARN; - default -> IconTheme.JabRefIcons.INTEGRITY_INFO; + case ERROR -> + IconTheme.JabRefIcons.INTEGRITY_FAIL; + case WARN -> + IconTheme.JabRefIcons.INTEGRITY_WARN; + default -> + IconTheme.JabRefIcons.INTEGRITY_INFO; }; } diff --git a/jabgui/src/main/java/org/jabref/gui/exporter/ExportCommand.java b/jabgui/src/main/java/org/jabref/gui/exporter/ExportCommand.java index ac54a3953fa..6bcc127b5fe 100644 --- a/jabgui/src/main/java/org/jabref/gui/exporter/ExportCommand.java +++ b/jabgui/src/main/java/org/jabref/gui/exporter/ExportCommand.java @@ -112,8 +112,8 @@ private void export(Path file, FileChooser.ExtensionFilter selectedExtensionFilt } List fileDirForDatabase = stateManager.getActiveDatabase() - .map(db -> db.getFileDirectories(preferences.getFilePreferences())) - .orElse(List.of(preferences.getFilePreferences().getWorkingDirectory())); + .map(db -> db.getFileDirectories(preferences.getFilePreferences())) + .orElse(List.of(preferences.getFilePreferences().getWorkingDirectory())); // Make sure we remember which filter was used, to set // the default for next time: diff --git a/jabgui/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java b/jabgui/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java index e0bf680413a..5feebfc5fb8 100644 --- a/jabgui/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java +++ b/jabgui/src/main/java/org/jabref/gui/exporter/ExportToClipboardAction.java @@ -157,6 +157,8 @@ private void setContentToClipboard(ExportResult result) { dialogService.notify(Localization.lang("Entries exported to clipboard") + ": " + entries.size()); } - private record ExportResult(String content, FileType fileType) { + private record ExportResult( + String content, + FileType fileType) { } } diff --git a/jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java b/jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java index 83f4011912e..5fa43071f4d 100644 --- a/jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java +++ b/jabgui/src/main/java/org/jabref/gui/exporter/SaveAction.java @@ -54,9 +54,12 @@ public void execute() { stateManager); switch (saveMethod) { - case SAVE -> saveDatabaseAction.save(); - case SAVE_AS -> saveDatabaseAction.saveAs(); - case SAVE_SELECTED -> saveDatabaseAction.saveSelectedAsPlain(); + case SAVE -> + saveDatabaseAction.save(); + case SAVE_AS -> + saveDatabaseAction.saveAs(); + case SAVE_SELECTED -> + saveDatabaseAction.saveSelectedAsPlain(); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java b/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java index f9651ed03a2..882502bdd11 100644 --- a/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java +++ b/jabgui/src/main/java/org/jabref/gui/exporter/SaveDatabaseAction.java @@ -100,23 +100,23 @@ public boolean saveAs(Path file) { private SelfContainedSaveOrder getSaveOrder() { return libraryTab.getBibDatabaseContext() - .getMetaData().getSaveOrder() - .map(so -> { - if (so.getOrderType() == SaveOrder.OrderType.TABLE) { - // We need to "flatten out" SaveOrder.OrderType.TABLE as BibWriter does not have access to preferences - List> sortOrder = libraryTab.getMainTable().getSortOrder(); - return new SelfContainedSaveOrder( - SaveOrder.OrderType.SPECIFIED, - sortOrder.stream() - .filter(col -> col instanceof MainTableColumn) - .map(column -> ((MainTableColumn) column).getModel()) - .flatMap(model -> model.getSortCriteria().stream()) - .toList()); - } else { - return SelfContainedSaveOrder.of(so); - } - }) - .orElse(SaveOrder.getDefaultSaveOrder()); + .getMetaData().getSaveOrder() + .map(so -> { + if (so.getOrderType() == SaveOrder.OrderType.TABLE) { + // We need to "flatten out" SaveOrder.OrderType.TABLE as BibWriter does not have access to preferences + List> sortOrder = libraryTab.getMainTable().getSortOrder(); + return new SelfContainedSaveOrder( + SaveOrder.OrderType.SPECIFIED, + sortOrder.stream() + .filter(col -> col instanceof MainTableColumn) + .map(column -> ((MainTableColumn) column).getModel()) + .flatMap(model -> model.getSortCriteria().stream()) + .toList()); + } else { + return SelfContainedSaveOrder.of(so); + } + }) + .orElse(SaveOrder.getDefaultSaveOrder()); } public void saveSelectedAsPlain() { diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java index 1526290334e..b26593f541c 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/AutoSetFileLinksUtil.java @@ -122,8 +122,8 @@ public List findAssociatedNotLinkedFiles(BibEntry entry) throws IOEx if (!fileAlreadyLinked) { Optional type = FileUtil.getFileExtension(foundFile) - .map(extension -> ExternalFileTypes.getExternalFileTypeByExt(extension, externalApplicationsPreferences)) - .orElse(Optional.of(new UnknownExternalFileType(""))); + .map(extension -> ExternalFileTypes.getExternalFileTypeByExt(extension, externalApplicationsPreferences)) + .orElse(Optional.of(new UnknownExternalFileType(""))); String strType = type.map(ExternalFileType::getName).orElse(""); Path relativeFilePath = FileUtil.relativize(foundFile, directories); diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/ChainedFilters.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/ChainedFilters.java index 8e6f2cba15e..a0b6d367e06 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/ChainedFilters.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/ChainedFilters.java @@ -9,7 +9,8 @@ import org.slf4j.LoggerFactory; /// Chains the given filters - if ALL of them accept, the result is also accepted -public record ChainedFilters(List> filters) implements DirectoryStream.Filter { +public record ChainedFilters( + List> filters) implements DirectoryStream.Filter { private static final Logger LOGGER = LoggerFactory.getLogger(ChainedFilters.class); diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java index 22f2aee57f5..cf2735858e4 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/FileFilterUtils.java @@ -69,11 +69,16 @@ public static boolean filterByDate(Path path, DateRange filter) { FileFilterUtils fileFilter = new FileFilterUtils(); LocalDateTime fileTime = FileFilterUtils.getFileTime(path); boolean isInDateRange = switch (filter) { - case DAY -> fileFilter.isDuringLastDay(fileTime); - case WEEK -> fileFilter.isDuringLastWeek(fileTime); - case MONTH -> fileFilter.isDuringLastMonth(fileTime); - case YEAR -> fileFilter.isDuringLastYear(fileTime); - case ALL_TIME -> true; + case DAY -> + fileFilter.isDuringLastDay(fileTime); + case WEEK -> + fileFilter.isDuringLastWeek(fileTime); + case MONTH -> + fileFilter.isDuringLastMonth(fileTime); + case YEAR -> + fileFilter.isDuringLastYear(fileTime); + case ALL_TIME -> + true; }; return isInDateRange; } @@ -84,11 +89,11 @@ public static boolean filterByDate(Path path, DateRange filter) { */ public List sortByDateAscending(List files) { return files.stream() - .sorted(Comparator.comparingLong(file -> FileFilterUtils.getFileTime(file) - .atZone(ZoneId.systemDefault()) - .toInstant() - .toEpochMilli())) - .collect(Collectors.toList()); + .sorted(Comparator.comparingLong(file -> FileFilterUtils.getFileTime(file) + .atZone(ZoneId.systemDefault()) + .toInstant() + .toEpochMilli())) + .collect(Collectors.toList()); } /** @@ -97,11 +102,11 @@ public List sortByDateAscending(List files) { */ public List sortByDateDescending(List files) { return files.stream() - .sorted(Comparator.comparingLong(file -> -FileFilterUtils.getFileTime(file) - .atZone(ZoneId.systemDefault()) - .toInstant() - .toEpochMilli())) - .collect(Collectors.toList()); + .sorted(Comparator.comparingLong(file -> -FileFilterUtils.getFileTime(file) + .atZone(ZoneId.systemDefault()) + .toInstant() + .toEpochMilli())) + .collect(Collectors.toList()); } /** @@ -111,9 +116,12 @@ public List sortByDateDescending(List files) { public static List sortByDate(List files, ExternalFileSorter sortType) { FileFilterUtils fileFilter = new FileFilterUtils(); List sortedFiles = switch (sortType) { - case DEFAULT -> files; - case DATE_ASCENDING -> fileFilter.sortByDateDescending(files); - case DATE_DESCENDING -> fileFilter.sortByDateAscending(files); + case DEFAULT -> + files; + case DATE_ASCENDING -> + fileFilter.sortByDateDescending(files); + case DATE_DESCENDING -> + fileFilter.sortByDateAscending(files); }; return sortedFiles; } diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/GitIgnoreFileFilter.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/GitIgnoreFileFilter.java index e396c4f883a..2ecb5dce845 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/GitIgnoreFileFilter.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/GitIgnoreFileFilter.java @@ -60,7 +60,7 @@ public boolean accept(Path path) throws IOException { return gitIgnorePatterns.stream().noneMatch(filter -> // we need this one for "*.png" filter.matches(path.getFileName()) || - // we need this one for "**/*.png" - filter.matches(path)); + // we need this one for "**/*.png" + filter.matches(path)); } } diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java index bb201b85f18..787aa5b1bee 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/ImportHandler.java @@ -263,7 +263,7 @@ private void importEntryWithDuplicateCheck(BibDatabaseContext bibDatabaseContext if (existingDuplicateInLibrary.isPresent()) { Optional duplicateHandledEntry = handleDuplicates(bibDatabaseContext, entryToInsert, existingDuplicateInLibrary.get(), decision); if (duplicateHandledEntry.isEmpty()) { - tracker.markSkipped(); + tracker.markSkipped(); return; } finalEntry = duplicateHandledEntry.get(); diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/PdfMergeDialog.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/PdfMergeDialog.java index 6ea1b65568c..3dd1f38c118 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/PdfMergeDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/PdfMergeDialog.java @@ -28,9 +28,9 @@ public class PdfMergeDialog { * Thus, JabRef provides this merge dialog that collects the results of all {@link PdfImporter}s * and gives user a choice between field values. * - * @param entry the entry to merge with - * @param filePath the path to the PDF file. This PDF is used as the source for the {@link PdfImporter}s. - * @param preferences the preferences to use. Full preference object is required, because of current implementation of {@link MultiMergeEntriesView}. + * @param entry the entry to merge with + * @param filePath the path to the PDF file. This PDF is used as the source for the {@link PdfImporter}s. + * @param preferences the preferences to use. Full preference object is required, because of current implementation of {@link MultiMergeEntriesView}. * @param taskExecutor the task executor to use when the multi merge dialog executes the importers. */ public static MultiMergeEntriesView createMergeDialog(BibEntry entry, Path filePath, GuiPreferences preferences, TaskExecutor taskExecutor) { diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawler.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawler.java index 9e13a0173c6..ed43c980bfa 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawler.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesCrawler.java @@ -74,7 +74,6 @@ public FileNodeViewModel call() throws IOException { * and then sorted according to the {@link ExternalFileSorter} value. * * @param unlinkedPDFFileFilter contains a BibDatabaseContext which is used to determine whether the file is linked - * * @return FileNodeViewModel containing the data of the current directory and all subdirectories * @throws IOException if directory is not a directory or empty */ @@ -138,8 +137,8 @@ FileNodeViewModel searchDirectory(Path directory, UnlinkedPDFFileFilter unlinked // create and add FileNodeViewModel to the FileNodeViewModel for the current directory fileNodeViewModelForCurrentDirectory.getChildren().addAll(resultingFiles.stream() - .map(FileNodeViewModel::new) - .toList()); + .map(FileNodeViewModel::new) + .toList()); return fileNodeViewModelForCurrentDirectory; } diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java b/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java index 9c51df3d6e6..469cb2a68fd 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiles/UnlinkedFilesDialogView.java @@ -163,8 +163,8 @@ private void initDirectorySelection() { fileTypeCombo.valueProperty().bindBidirectional(viewModel.selectedExtensionProperty()); new ViewModelListCellFactory() - .withText(DateRange::getDateRange) - .install(fileDateCombo); + .withText(DateRange::getDateRange) + .install(fileDateCombo); fileDateCombo.setItems(viewModel.getDateFilters()); fileDateCombo.valueProperty().bindBidirectional(viewModel.selectedDateProperty()); @@ -331,10 +331,14 @@ public SearchContextAction(StandardActions command) { @Override public void execute() { switch (command) { - case SELECT_ALL -> unlinkedFilesList.getCheckModel().checkAll(); - case UNSELECT_ALL -> unlinkedFilesList.getCheckModel().clearChecks(); - case EXPAND_ALL -> expandTree(unlinkedFilesList.getRoot(), true); - case COLLAPSE_ALL -> expandTree(unlinkedFilesList.getRoot(), false); + case SELECT_ALL -> + unlinkedFilesList.getCheckModel().checkAll(); + case UNSELECT_ALL -> + unlinkedFilesList.getCheckModel().clearChecks(); + case EXPAND_ALL -> + expandTree(unlinkedFilesList.getRoot(), true); + case COLLAPSE_ALL -> + expandTree(unlinkedFilesList.getRoot(), false); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiletype/CustomExternalFileType.java b/jabgui/src/main/java/org/jabref/gui/externalfiletype/CustomExternalFileType.java index 396e1cacf97..a050ef299dc 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiletype/CustomExternalFileType.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiletype/CustomExternalFileType.java @@ -10,7 +10,7 @@ * This class defines a type of external files that can be linked to from JabRef. * The class contains enough information to provide an icon, a standard extension * and a link to which application handles files of this type. - * + *

* TODO: Move to model (and then adapt {@link org.jabref.gui.fieldeditors.LinkedFilesEditorViewModel#fromFile(java.nio.file.Path, java.util.List, FilePreferences)}). */ public class CustomExternalFileType implements ExternalFileType { diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileType.java b/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileType.java index df386dbc19c..88d0c063551 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileType.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileType.java @@ -35,6 +35,6 @@ default Field getField() { * @return A String[] containing all information about this file type. */ default String[] toStringArray() { - return new String[]{getName(), getExtension(), getMimeType(), getOpenWithApplication(), getIcon().name()}; + return new String[] {getName(), getExtension(), getMimeType(), getOpenWithApplication(), getIcon().name()}; } } diff --git a/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java b/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java index 6946b5997ee..f945c2e5da5 100644 --- a/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java +++ b/jabgui/src/main/java/org/jabref/gui/externalfiletype/ExternalFileTypes.java @@ -91,7 +91,7 @@ public static Optional getExternalFileTypeForName(String filen * * @param mimeType The MIME type. * @return The ExternalFileType registered, or null if none. For the mime type "text/html", a valid file type is - * guaranteed to be returned. + * guaranteed to be returned. */ public static Optional getExternalFileTypeByMimeType(String mimeType, ExternalApplicationsPreferences externalApplicationsPreferences) { // Ignores parameters according to link: (https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) @@ -129,7 +129,7 @@ public static Optional getExternalFileTypeByLinkedFile(LinkedF // No type could be found from mime type. Try based on the extension: return FileUtil.getFileExtension(linkedFile.getLink()) - .flatMap(extension -> getExternalFileTypeByExt(extension, externalApplicationsPreferences)); + .flatMap(extension -> getExternalFileTypeByExt(extension, externalApplicationsPreferences)); } else { return type; } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java index 68544e68f91..fab2681f720 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditor.java @@ -37,8 +37,8 @@ public class CitationCountEditor extends HBox implements FieldEditorFX { @Inject private SearchCitationsRelationsService searchCitationsRelationsService; public CitationCountEditor(Field field, - SuggestionProvider suggestionProvider, - FieldCheckers fieldCheckers) { + SuggestionProvider suggestionProvider, + FieldCheckers fieldCheckers) { Injector.registerExistingAndInject(this); this.viewModel = new CitationCountEditorViewModel( field, diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditorViewModel.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditorViewModel.java index 173fc27c078..da74960f387 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditorViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/CitationCountEditorViewModel.java @@ -31,6 +31,7 @@ public class CitationCountEditorViewModel extends AbstractEditorViewModel { private final StateManager stateManager; private final GuiPreferences preferences; private final SearchCitationsRelationsService searchCitationsRelationsService; + public CitationCountEditorViewModel( Field field, SuggestionProvider suggestionProvider, diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldNameLabel.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldNameLabel.java index f607bfa04ac..f9c8bf0b9cb 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldNameLabel.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/FieldNameLabel.java @@ -230,12 +230,18 @@ public String getDescription(Field field) { } } else if (field instanceof SpecialField specialField) { return switch (specialField) { - case PRINTED -> Localization.lang("User-specific printed flag, in case the entry has been printed."); - case PRIORITY -> Localization.lang("User-specific priority."); - case QUALITY -> Localization.lang("User-specific quality flag, in case its quality is assured."); - case RANKING -> Localization.lang("User-specific ranking."); - case READ_STATUS -> Localization.lang("User-specific read status."); - case RELEVANCE -> Localization.lang("User-specific relevance flag, in case the entry is relevant."); + case PRINTED -> + Localization.lang("User-specific printed flag, in case the entry has been printed."); + case PRIORITY -> + Localization.lang("User-specific priority."); + case QUALITY -> + Localization.lang("User-specific quality flag, in case its quality is assured."); + case RANKING -> + Localization.lang("User-specific ranking."); + case READ_STATUS -> + Localization.lang("User-specific read status."); + case RELEVANCE -> + Localization.lang("User-specific relevance flag, in case the entry is relevant."); }; } return ""; diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/GroupEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/GroupEditor.java index 16a50521b65..ca704e4e7aa 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/GroupEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/GroupEditor.java @@ -44,9 +44,9 @@ public GroupEditor(final Field field, List draggedGroups = (List) event.getDragboard().getContent(DragAndDropDataFormats.GROUP); if (bibEntry.isPresent() && draggedGroups.getFirst() != null) { String newGroup = bibEntry.map(entry -> entry.getField(StandardField.GROUPS) - .map(oldGroups -> oldGroups + (preferences.getBibEntryPreferences().getKeywordSeparator()) + (draggedGroups.getFirst())) - .orElse(draggedGroups.getFirst())) - .orElse(null); + .map(oldGroups -> oldGroups + (preferences.getBibEntryPreferences().getKeywordSeparator()) + (draggedGroups.getFirst())) + .orElse(draggedGroups.getFirst())) + .orElse(null); bibEntry.map(entry -> entry.setField(StandardField.GROUPS, newGroup)); success = true; } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/ICORERankingEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/ICORERankingEditor.java index 444f8a14c19..23b6b5ab1a7 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/ICORERankingEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/ICORERankingEditor.java @@ -43,8 +43,8 @@ public ICORERankingEditor(Field field, Injector.registerExistingAndInject(this); ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); this.viewModel = new ICORERankingEditorViewModel( field, diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java index 8520161c1b2..3cd16a17025 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/KeywordsEditor.java @@ -254,18 +254,18 @@ public void execute() { case COPY -> { clipBoardManager.setContent(keyword.get()); dialogService.notify(Localization.lang("Copied '%0' to clipboard.", - JabRefDialogService.shortenDialogMessage(keyword.get()))); + JabRefDialogService.shortenDialogMessage(keyword.get()))); } case CUT -> { clipBoardManager.setContent(keyword.get()); dialogService.notify(Localization.lang("Copied '%0' to clipboard.", - JabRefDialogService.shortenDialogMessage(keyword.get()))); + JabRefDialogService.shortenDialogMessage(keyword.get()))); keywordTagsField.removeTags(keyword); } case DELETE -> - keywordTagsField.removeTags(keyword); + keywordTagsField.removeTags(keyword); default -> - LOGGER.info("Action {} not defined", command.getText()); + LOGGER.info("Action {} not defined", command.getText()); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java index c262b5e753a..89e33d24aea 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFileViewModel.java @@ -171,7 +171,7 @@ public String getTruncatedDescriptionAndLink() { return ControlHelper.truncateString(linkedFile.getDescription(), -1, "...", ControlHelper.EllipsisPosition.CENTER) + " (" + ControlHelper.truncateString(linkedFile.getLink(), -1, "...", - ControlHelper.EllipsisPosition.CENTER) + ")"; + ControlHelper.EllipsisPosition.CENTER) + ")"; } } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java index ff6992be048..5ff20f9e333 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java @@ -99,8 +99,8 @@ public LinkedFilesEditor(Field field, this.fieldCheckers = fieldCheckers; ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); decoratedModelList = new UiThreadObservableList<>(viewModel.filesProperty()); Bindings.bindContentBidirectional(listView.itemsProperty().get(), decoratedModelList); diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java index b5c488750ad..724adfbcbac 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditorViewModel.java @@ -93,7 +93,7 @@ private static String getStringRepresentation(List files) { /** * Creates an instance of {@link LinkedFile} based on the given file. * We try to guess the file type and relativize the path against the given file directories. - * + *

* TODO: Move this method to {@link LinkedFile} as soon as {@link CustomExternalFileType} lives in model. */ public static LinkedFile fromFile(Path file, List fileDirectories, ExternalApplicationsPreferences externalApplicationsPreferences) { @@ -208,17 +208,17 @@ public void fetchFulltext() { } if (urlField.isEmpty() || !download_success) { BackgroundTask - .wrap(() -> fetcher.findFullTextPDF(entry)) - .onRunning(() -> fulltextLookupInProgress.setValue(true)) - .onFinished(() -> fulltextLookupInProgress.setValue(false)) - .onSuccess(url -> { - if (url.isPresent()) { - addFromURLAndDownload(url.get()); - } else { - dialogService.notify(Localization.lang("No full text document found")); - } - }) - .executeWith(taskExecutor); + .wrap(() -> fetcher.findFullTextPDF(entry)) + .onRunning(() -> fulltextLookupInProgress.setValue(true)) + .onFinished(() -> fulltextLookupInProgress.setValue(false)) + .onSuccess(url -> { + if (url.isPresent()) { + addFromURLAndDownload(url.get()); + } else { + dialogService.notify(Localization.lang("No full text document found")); + } + }) + .executeWith(taskExecutor); } } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ContextAction.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ContextAction.java index 09de1094123..1a3247661ab 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ContextAction.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/ContextAction.java @@ -31,44 +31,66 @@ public ContextAction(StandardActions command, this.executable.bind( switch (command) { - case RENAME_FILE_TO_PATTERN -> Bindings.createBooleanBinding( - () -> !linkedFile.getFile().isOnlineLink() - && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent() - && !linkedFile.isGeneratedNameSameAsOriginal(), - linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); - case MOVE_FILE_TO_FOLDER, MOVE_FILE_TO_FOLDER_AND_RENAME -> Bindings.createBooleanBinding( - () -> !linkedFile.getFile().isOnlineLink() - && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent() - && !linkedFile.isGeneratedPathSameAsOriginal(), - linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); - case DOWNLOAD_FILE -> Bindings.createBooleanBinding( - () -> linkedFile.getFile().isOnlineLink(), - linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); - case REDOWNLOAD_FILE -> Bindings.createBooleanBinding( - () -> !linkedFile.getFile().getSourceUrl().isEmpty(), - linkedFile.getFile().sourceUrlProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); - case OPEN_FILE, OPEN_FOLDER, RENAME_FILE_TO_NAME, DELETE_FILE -> Bindings.createBooleanBinding( - () -> !linkedFile.getFile().isOnlineLink() - && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent(), - linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); - default -> BindingsHelper.constantOf(true); + case RENAME_FILE_TO_PATTERN -> + Bindings.createBooleanBinding( + () -> !linkedFile.getFile().isOnlineLink() + && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent() + && !linkedFile.isGeneratedNameSameAsOriginal(), + linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); + case MOVE_FILE_TO_FOLDER, + MOVE_FILE_TO_FOLDER_AND_RENAME -> + Bindings.createBooleanBinding( + () -> !linkedFile.getFile().isOnlineLink() + && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent() + && !linkedFile.isGeneratedPathSameAsOriginal(), + linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); + case DOWNLOAD_FILE -> + Bindings.createBooleanBinding( + () -> linkedFile.getFile().isOnlineLink(), + linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); + case REDOWNLOAD_FILE -> + Bindings.createBooleanBinding( + () -> !linkedFile.getFile().getSourceUrl().isEmpty(), + linkedFile.getFile().sourceUrlProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); + case OPEN_FILE, + OPEN_FOLDER, + RENAME_FILE_TO_NAME, + DELETE_FILE -> + Bindings.createBooleanBinding( + () -> !linkedFile.getFile().isOnlineLink() + && linkedFile.getFile().findIn(databaseContext, preferences.getFilePreferences()).isPresent(), + linkedFile.getFile().linkProperty(), bibEntry.getValue().map(BibEntry::getFieldsObservable).orElse(null)); + default -> + BindingsHelper.constantOf(true); }); } @Override public void execute() { switch (command) { - case EDIT_FILE_LINK -> linkedFile.edit(); - case OPEN_FILE -> linkedFile.open(); - case OPEN_FOLDER -> linkedFile.openFolder(); - case DOWNLOAD_FILE -> linkedFile.download(true); - case REDOWNLOAD_FILE -> linkedFile.redownload(); - case RENAME_FILE_TO_PATTERN -> linkedFile.renameToSuggestion(); - case RENAME_FILE_TO_NAME -> linkedFile.askForNameAndRename(); - case MOVE_FILE_TO_FOLDER -> linkedFile.moveToDefaultDirectory(); - case MOVE_FILE_TO_FOLDER_AND_RENAME -> linkedFile.moveToDefaultDirectoryAndRename(); - case DELETE_FILE -> viewModel.deleteFile(linkedFile); - case REMOVE_LINK, REMOVE_LINKS -> viewModel.removeFileLink(linkedFile); + case EDIT_FILE_LINK -> + linkedFile.edit(); + case OPEN_FILE -> + linkedFile.open(); + case OPEN_FOLDER -> + linkedFile.openFolder(); + case DOWNLOAD_FILE -> + linkedFile.download(true); + case REDOWNLOAD_FILE -> + linkedFile.redownload(); + case RENAME_FILE_TO_PATTERN -> + linkedFile.renameToSuggestion(); + case RENAME_FILE_TO_NAME -> + linkedFile.askForNameAndRename(); + case MOVE_FILE_TO_FOLDER -> + linkedFile.moveToDefaultDirectory(); + case MOVE_FILE_TO_FOLDER_AND_RENAME -> + linkedFile.moveToDefaultDirectoryAndRename(); + case DELETE_FILE -> + viewModel.deleteFile(linkedFile); + case REMOVE_LINK, + REMOVE_LINKS -> + viewModel.removeFileLink(linkedFile); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java index 4aee5fa948a..d05d2087adc 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/contextmenu/EditorContextAction.java @@ -40,12 +40,18 @@ public EditorContextAction(StandardActions command, TextInputControl textInputCo this.executable.bind( switch (command) { - case COPY -> editableBinding.and(maskTextBinding.not()).and(hasSelectionBinding); - case CUT -> maskTextBinding.not().and(hasSelectionBinding); - case PASTE -> editableBinding.and(hasStringInClipboardBinding); - case DELETE -> editableBinding.and(hasSelectionBinding); - case UNDO -> undoableBinding; - case REDO -> redoableBinding; + case COPY -> + editableBinding.and(maskTextBinding.not()).and(hasSelectionBinding); + case CUT -> + maskTextBinding.not().and(hasSelectionBinding); + case PASTE -> + editableBinding.and(hasStringInClipboardBinding); + case DELETE -> + editableBinding.and(hasSelectionBinding); + case UNDO -> + undoableBinding; + case REDO -> + redoableBinding; case SELECT_ALL -> { if (SHOW_HANDLES) { yield hasTextBinding.and(allSelectedBinding.not()); @@ -53,20 +59,28 @@ public EditorContextAction(StandardActions command, TextInputControl textInputCo yield BindingsHelper.constantOf(true); } } - default -> BindingsHelper.constantOf(true); + default -> + BindingsHelper.constantOf(true); }); } @Override public void execute() { switch (command) { - case COPY -> textInputControl.copy(); - case CUT -> textInputControl.cut(); - case PASTE -> textInputControl.paste(); - case DELETE -> textInputControl.deleteText(textInputControl.getSelection()); - case SELECT_ALL -> textInputControl.selectAll(); - case UNDO -> textInputControl.undo(); - case REDO -> textInputControl.redo(); + case COPY -> + textInputControl.copy(); + case CUT -> + textInputControl.cut(); + case PASTE -> + textInputControl.paste(); + case DELETE -> + textInputControl.deleteText(textInputControl.getSelection()); + case SELECT_ALL -> + textInputControl.selectAll(); + case UNDO -> + textInputControl.undo(); + case REDO -> + textInputControl.redo(); } textInputControl.requestFocus(); } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/DoiIdentifierEditorViewModel.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/DoiIdentifierEditorViewModel.java index 91f60f0bd95..c65446e29d6 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/DoiIdentifierEditorViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/DoiIdentifierEditorViewModel.java @@ -47,15 +47,15 @@ public void lookupIdentifier(BibEntry bibEntry) { CrossRef doiFetcher = new CrossRef(); BackgroundTask.wrap(() -> doiFetcher.findIdentifier(entry)) - .onRunning(() -> identifierLookupInProgress.setValue(true)) - .onFinished(() -> identifierLookupInProgress.setValue(false)) - .onSuccess(identifier -> { - if (identifier.isPresent()) { - entry.setField(field, identifier.get().asString()); - } else { - dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); - } - }).onFailure(e -> handleIdentifierFetchingError(e, doiFetcher)).executeWith(taskExecutor); + .onRunning(() -> identifierLookupInProgress.setValue(true)) + .onFinished(() -> identifierLookupInProgress.setValue(false)) + .onSuccess(identifier -> { + if (identifier.isPresent()) { + entry.setField(field, identifier.get().asString()); + } else { + dialogService.notify(Localization.lang("No %0 found", field.getDisplayName())); + } + }).onFailure(e -> handleIdentifierFetchingError(e, doiFetcher)).executeWith(taskExecutor); } @Override @@ -70,7 +70,7 @@ public void fetchBibliographyInformation(BibEntry bibEntry) { @Override public void openExternalLink() { identifier.get().map(DOI::asString) - .ifPresent(s -> NativeDesktop.openCustomDoi(s, preferences, dialogService)); + .ifPresent(s -> NativeDesktop.openCustomDoi(s, preferences, dialogService)); } @Override @@ -82,8 +82,8 @@ public void shortenID() { LOGGER.info("DOI is already shortened"); dialogService.notify(Localization.lang("DOI is already shortened")); } else { - LOGGER.info("Shortened DOI: {} to {}", doi, shortenedDOI); - dialogService.notify(Localization.lang("Shortened DOI to: %0", shortenedDOI)); + LOGGER.info("Shortened DOI: {} to {}", doi, shortenedDOI); + dialogService.notify(Localization.lang("Shortened DOI to: %0", shortenedDOI)); } }); } diff --git a/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/IdentifierEditor.java b/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/IdentifierEditor.java index e557900833b..f1b02f4f184 100644 --- a/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/IdentifierEditor.java +++ b/jabgui/src/main/java/org/jabref/gui/fieldeditors/identifier/IdentifierEditor.java @@ -64,15 +64,16 @@ public IdentifierEditor(Field field, this.viewModel = new EprintIdentifierEditorViewModel(suggestionProvider, fieldCheckers, dialogService, taskExecutor, preferences, undoManager); // TODO: Add support for PMID - case null, default -> { + case null, + default -> { assert field != null; throw new IllegalStateException("Unable to instantiate a view model for identifier field editor '%s'".formatted(field.getDisplayName())); } } ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); textField.textProperty().bindBidirectional(viewModel.textProperty()); diff --git a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrameViewModel.java b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrameViewModel.java index c16ad7ff8ca..8e5aa9306c4 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrameViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/JabRefFrameViewModel.java @@ -120,10 +120,10 @@ public boolean close() { // Read the opened and focused databases before closing them List openedLibraries = tabContainer.getLibraryTabs().stream() - .map(LibraryTab::getBibDatabaseContext) - .map(BibDatabaseContext::getDatabasePath) - .flatMap(Optional::stream) - .toList(); + .map(LibraryTab::getBibDatabaseContext) + .map(BibDatabaseContext::getDatabasePath) + .flatMap(Optional::stream) + .toList(); Path focusedLibraries = Optional.ofNullable(tabContainer.getCurrentLibraryTab()) .map(LibraryTab::getBibDatabaseContext) .flatMap(BibDatabaseContext::getDatabasePath) @@ -164,9 +164,9 @@ public void handleUiCommands(List uiCommands) { // Handle OpenDatabases if (!blank) { uiCommands.stream() - .filter(UiCommand.OpenLibraries.class::isInstance) - .map(UiCommand.OpenLibraries.class::cast) - .forEach(command -> openDatabaseAction.get().openFiles(command.toImport())); + .filter(UiCommand.OpenLibraries.class::isInstance) + .map(UiCommand.OpenLibraries.class::cast) + .forEach(command -> openDatabaseAction.get().openFiles(command.toImport())); uiCommands.stream() .filter(UiCommand.AppendToCurrentLibrary.class::isInstance) diff --git a/jabgui/src/main/java/org/jabref/gui/frame/UiMessageHandler.java b/jabgui/src/main/java/org/jabref/gui/frame/UiMessageHandler.java index 38a41d7d83c..1315ae15b20 100644 --- a/jabgui/src/main/java/org/jabref/gui/frame/UiMessageHandler.java +++ b/jabgui/src/main/java/org/jabref/gui/frame/UiMessageHandler.java @@ -6,7 +6,7 @@ /** * Specifies an interface that can process either cli or remote commands to the ui - * + *

* See {@link org.jabref.logic.remote.server.RemoteMessageHandler} */ public interface UiMessageHandler { diff --git a/jabgui/src/main/java/org/jabref/gui/git/GitCommitDialogViewModel.java b/jabgui/src/main/java/org/jabref/gui/git/GitCommitDialogViewModel.java index 87ae3058081..14a5070c68e 100644 --- a/jabgui/src/main/java/org/jabref/gui/git/GitCommitDialogViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/git/GitCommitDialogViewModel.java @@ -59,7 +59,7 @@ public GitCommitDialogViewModel( public void commit(Runnable onSuccess) { commitTask() - .onSuccess(_-> { + .onSuccess(_ -> { dialogService.notify(Localization.lang("Committed successfully")); onSuccess.run(); }) diff --git a/jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index 66ff70471a0..a34e961c4c9 100644 --- a/jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -395,9 +395,12 @@ public void draggedOn(GroupNodeViewModel target, DroppingMouseLocation mouseLoca // Bottom + top -> insert source row before / after this row // Center -> add as child switch (mouseLocation) { - case BOTTOM -> this.moveTo(targetParent.get(), targetIndex + 1); - case CENTER -> this.moveTo(target); - case TOP -> this.moveTo(targetParent.get(), targetIndex); + case BOTTOM -> + this.moveTo(targetParent.get(), targetIndex + 1); + case CENTER -> + this.moveTo(target); + case TOP -> + this.moveTo(targetParent.get(), targetIndex); } } else { // No parent = root -> just add @@ -461,67 +464,103 @@ public boolean canAddEntriesIn() { public boolean canBeDragged() { AbstractGroup group = groupNode.getGroup(); return switch (group) { - case AllEntriesGroup _, SmartGroup _ -> false; - case ExplicitGroup _, SearchGroup _, AutomaticKeywordGroup _, AutomaticPersonsGroup _, TexGroup _ -> true; + case AllEntriesGroup _, + SmartGroup _ -> + false; + case ExplicitGroup _, + SearchGroup _, + AutomaticKeywordGroup _, + AutomaticPersonsGroup _, + TexGroup _ -> + true; case KeywordGroup _ -> // KeywordGroup is parent of LastNameGroup, RegexKeywordGroup and WordKeywordGroup groupNode.getParent() - .map(GroupTreeNode::getGroup) - .map(groupParent -> - !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) - .orElse(false); - - case null -> throw new IllegalArgumentException("Group cannot be null"); - default -> throw new UnsupportedOperationException("canBeDragged method not yet implemented in group: " + group.getClass().getName()); + .map(GroupTreeNode::getGroup) + .map(groupParent -> + !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) + .orElse(false); + + case null -> + throw new IllegalArgumentException("Group cannot be null"); + default -> + throw new UnsupportedOperationException("canBeDragged method not yet implemented in group: " + group.getClass().getName()); }; } public boolean canAddGroupsIn() { AbstractGroup group = groupNode.getGroup(); return switch (group) { - case AllEntriesGroup _, ExplicitGroup _, SearchGroup _, TexGroup _ -> true; - case AutomaticKeywordGroup _, AutomaticPersonsGroup _, SmartGroup _ -> false; + case AllEntriesGroup _, + ExplicitGroup _, + SearchGroup _, + TexGroup _ -> + true; + case AutomaticKeywordGroup _, + AutomaticPersonsGroup _, + SmartGroup _ -> + false; case KeywordGroup _ -> // KeywordGroup is parent of LastNameGroup, RegexKeywordGroup and WordKeywordGroup groupNode.getParent() - .map(GroupTreeNode::getGroup) - .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) - .orElse(false); - case null -> throw new IllegalArgumentException("Group cannot be null"); - default -> throw new UnsupportedOperationException("canAddGroupsIn method not yet implemented in group: " + group.getClass().getName()); + .map(GroupTreeNode::getGroup) + .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) + .orElse(false); + case null -> + throw new IllegalArgumentException("Group cannot be null"); + default -> + throw new UnsupportedOperationException("canAddGroupsIn method not yet implemented in group: " + group.getClass().getName()); }; } public boolean canRemove() { AbstractGroup group = groupNode.getGroup(); return switch (group) { - case AllEntriesGroup _, SmartGroup _ -> false; - case ExplicitGroup _, SearchGroup _, AutomaticKeywordGroup _, AutomaticPersonsGroup _, TexGroup _ -> true; + case AllEntriesGroup _, + SmartGroup _ -> + false; + case ExplicitGroup _, + SearchGroup _, + AutomaticKeywordGroup _, + AutomaticPersonsGroup _, + TexGroup _ -> + true; case KeywordGroup _ -> // KeywordGroup is parent of LastNameGroup, RegexKeywordGroup and WordKeywordGroup groupNode.getParent() - .map(GroupTreeNode::getGroup) - .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) - .orElse(false); - case null -> throw new IllegalArgumentException("Group cannot be null"); - default -> throw new UnsupportedOperationException("canRemove method not yet implemented in group: " + group.getClass().getName()); + .map(GroupTreeNode::getGroup) + .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) + .orElse(false); + case null -> + throw new IllegalArgumentException("Group cannot be null"); + default -> + throw new UnsupportedOperationException("canRemove method not yet implemented in group: " + group.getClass().getName()); }; } public boolean isEditable() { AbstractGroup group = groupNode.getGroup(); return switch (group) { - case AllEntriesGroup _, SmartGroup _ -> false; - case ExplicitGroup _, SearchGroup _, AutomaticKeywordGroup _, AutomaticPersonsGroup _, TexGroup _ -> true; + case AllEntriesGroup _, + SmartGroup _ -> + false; + case ExplicitGroup _, + SearchGroup _, + AutomaticKeywordGroup _, + AutomaticPersonsGroup _, + TexGroup _ -> + true; case KeywordGroup _ -> // KeywordGroup is parent of LastNameGroup, RegexKeywordGroup and WordKeywordGroup groupNode.getParent() - .map(GroupTreeNode::getGroup) - .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) - .orElse(false); - - case null -> throw new IllegalArgumentException("Group cannot be null"); - default -> throw new UnsupportedOperationException("isEditable method not yet implemented in group: " + group.getClass().getName()); + .map(GroupTreeNode::getGroup) + .map(groupParent -> !(groupParent instanceof AutomaticKeywordGroup || groupParent instanceof AutomaticPersonsGroup)) + .orElse(false); + + case null -> + throw new IllegalArgumentException("Group cannot be null"); + default -> + throw new UnsupportedOperationException("isEditable method not yet implemented in group: " + group.getClass().getName()); }; } diff --git a/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java b/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java index a22b7445ab4..1e90edea3f4 100644 --- a/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java +++ b/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeView.java @@ -98,7 +98,6 @@ public class GroupTreeView extends BorderPane { private final FileUpdateMonitor fileUpdateMonitor; private final KeyBindingRepository keyBindingRepository; - private TreeTableView groupTree; private TreeTableColumn mainColumn; private TreeTableColumn numberColumn; @@ -701,9 +700,12 @@ public ContextAction(StandardActions command, GroupNodeViewModel group) { this.executable.bind(BindingsHelper.constantOf( switch (command) { - case GROUP_EDIT, GROUP_SUBGROUP_RENAME -> + case GROUP_EDIT, + GROUP_SUBGROUP_RENAME -> group.isEditable(); - case GROUP_REMOVE, GROUP_REMOVE_WITH_SUBGROUPS, GROUP_REMOVE_KEEP_SUBGROUPS -> + case GROUP_REMOVE, + GROUP_REMOVE_WITH_SUBGROUPS, + GROUP_REMOVE_KEEP_SUBGROUPS -> group.isEditable() && group.canRemove(); case GROUP_SUGGESTED_GROUPS_ADD -> !group.hasAllSuggestedGroups(); @@ -716,7 +718,8 @@ public ContextAction(StandardActions command, GroupNodeViewModel group) { case GROUP_SUBGROUP_SORT -> group.isEditable() && group.hasSubgroups() && group.canAddEntriesIn() || group.isRoot(); - case GROUP_ENTRIES_ADD, GROUP_ENTRIES_REMOVE -> + case GROUP_ENTRIES_ADD, + GROUP_ENTRIES_REMOVE -> group.canAddEntriesIn(); default -> true; @@ -732,7 +735,8 @@ public void execute() { viewModel.removeGroupKeepSubgroups(group); case GROUP_REMOVE_WITH_SUBGROUPS -> viewModel.removeGroupAndSubgroups(group); - case GROUP_EDIT, GROUP_SUBGROUP_RENAME -> + case GROUP_EDIT, + GROUP_SUBGROUP_RENAME -> viewModel.editGroup(group); case GROUP_GENERATE_EMBEDDINGS -> viewModel.generateEmbeddings(group); diff --git a/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java b/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java index 1977ea34c24..95a3c107425 100644 --- a/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/groups/GroupTreeViewModel.java @@ -189,10 +189,10 @@ private void addGroupImportEntries(GroupNodeViewModel parent) { String grpName = preferences.getLibraryPreferences().getAddImportedEntriesGroupName(); AbstractGroup importEntriesGroup = new SmartGroup(grpName, GroupHierarchyType.INDEPENDENT, ','); boolean isGrpExist = parent.getGroupNode() - .getChildren() - .stream() - .map(GroupTreeNode::getGroup) - .anyMatch(grp -> grp instanceof SmartGroup); + .getChildren() + .stream() + .map(GroupTreeNode::getGroup) + .anyMatch(grp -> grp instanceof SmartGroup); if (!isGrpExist) { currentDatabase.ifPresent(db -> { GroupTreeNode newSubgroup = parent.addSubgroup(importEntriesGroup); diff --git a/jabgui/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java b/jabgui/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java index 69a7bc3e715..b5b5747baea 100644 --- a/jabgui/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java +++ b/jabgui/src/main/java/org/jabref/gui/groups/UndoableAddOrRemoveGroup.java @@ -51,17 +51,14 @@ public class UndoableAddOrRemoveGroup extends AbstractUndoableJabRefEdit { /** * Creates an object that can undo/redo an edit event. * - * @param groupsRoot - * The global groups root. - * @param editType - * The type of editing (ADD_NODE, REMOVE_NODE_KEEP_CHILDREN, - * REMOVE_NODE_AND_CHILDREN) - * @param editedNode - * The edited node (which was added or will be removed). The node - * must be a descendant of node groupsRoot! This means - * that, in case of adding, you first have to add it to the tree, - * then call this constructor. When removing, you first have to - * call this constructor, then remove the node. + * @param groupsRoot The global groups root. + * @param editType The type of editing (ADD_NODE, REMOVE_NODE_KEEP_CHILDREN, + * REMOVE_NODE_AND_CHILDREN) + * @param editedNode The edited node (which was added or will be removed). The node + * must be a descendant of node groupsRoot! This means + * that, in case of adding, you first have to add it to the tree, + * then call this constructor. When removing, you first have to + * call this constructor, then remove the node. */ public UndoableAddOrRemoveGroup(GroupTreeNodeViewModel groupsRoot, GroupTreeNodeViewModel editedNode, int editType) { @@ -83,10 +80,14 @@ public UndoableAddOrRemoveGroup(GroupTreeNodeViewModel groupsRoot, @Override public String getPresentationName() { return switch (m_editType) { - case ADD_NODE -> Localization.lang("Add group"); - case REMOVE_NODE_KEEP_CHILDREN -> Localization.lang("Keep subgroups)"); - case REMOVE_NODE_AND_CHILDREN -> Localization.lang("Also remove subgroups"); - default -> "? (" + Localization.lang("unknown edit") + ")"; + case ADD_NODE -> + Localization.lang("Add group"); + case REMOVE_NODE_KEEP_CHILDREN -> + Localization.lang("Keep subgroups)"); + case REMOVE_NODE_AND_CHILDREN -> + Localization.lang("Also remove subgroups"); + default -> + "? (" + Localization.lang("unknown edit") + ")"; }; } diff --git a/jabgui/src/main/java/org/jabref/gui/help/ErrorConsoleAction.java b/jabgui/src/main/java/org/jabref/gui/help/ErrorConsoleAction.java index a27ffacee40..24f5bfbacff 100644 --- a/jabgui/src/main/java/org/jabref/gui/help/ErrorConsoleAction.java +++ b/jabgui/src/main/java/org/jabref/gui/help/ErrorConsoleAction.java @@ -10,7 +10,7 @@ * Such an error console can be * useful in getting complete bug reports, especially from Windows users, * without asking users to run JabRef in a command window to catch the error info. - * + *

* It offers a separate tab for the log output. */ public class ErrorConsoleAction extends SimpleCommand { diff --git a/jabgui/src/main/java/org/jabref/gui/help/VersionWorker.java b/jabgui/src/main/java/org/jabref/gui/help/VersionWorker.java index a68781ef4a4..fc02498cb3f 100644 --- a/jabgui/src/main/java/org/jabref/gui/help/VersionWorker.java +++ b/jabgui/src/main/java/org/jabref/gui/help/VersionWorker.java @@ -22,7 +22,7 @@ * This worker checks if there is a new version of JabRef available. If there is it will display a dialog to the user * offering him multiple options to proceed (see changelog, go to the download page, ignore this version, and remind * later). - * + *

* If the versions check is executed manually and this is the latest version it will also display a dialog to inform the * user. */ @@ -99,7 +99,7 @@ private void showUpdateInfo(Optional newerVersion, boolean manualExecut } else { // notify the user about a newer version if (dialogService.showCustomDialogAndWait( - new NewVersionDialog(installedVersion, newerVersion.get(), dialogService, externalApplicationsPreferences)) + new NewVersionDialog(installedVersion, newerVersion.get(), dialogService, externalApplicationsPreferences)) .orElse(true)) { internalPreferences.setIgnoredVersion(newerVersion.get()); } diff --git a/jabgui/src/main/java/org/jabref/gui/importer/BibEntryTypePrefsAndFileViewModel.java b/jabgui/src/main/java/org/jabref/gui/importer/BibEntryTypePrefsAndFileViewModel.java index 27735d96c4a..6aefab825de 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/BibEntryTypePrefsAndFileViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/BibEntryTypePrefsAndFileViewModel.java @@ -4,7 +4,9 @@ import org.jabref.logic.l10n.Localization; import org.jabref.model.entry.BibEntryType; -public record BibEntryTypePrefsAndFileViewModel(BibEntryType customTypeFromPreferences, BibEntryType customTypeFromFile) { +public record BibEntryTypePrefsAndFileViewModel( + BibEntryType customTypeFromPreferences, + BibEntryType customTypeFromFile) { /** * Used to render in the UI. This is different from {@link BibEntryType#toString()}, because this is the serialization the user expects */ diff --git a/jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java b/jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java index 5a9f78e4d48..8c079ccd143 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/ImportCommand.java @@ -195,8 +195,8 @@ private ParserResult doImport(List files, Importer importFormat) throws IO () -> dialogService.showWarningDialogAndWait( Localization.lang("Import error"), Localization.lang("Please check your library file for wrong syntax.") - + "\n\n" - + ex.getLocalizedMessage())); + + "\n\n" + + ex.getLocalizedMessage())); } } diff --git a/jabgui/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.java b/jabgui/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.java index 849478abb0b..b80931e82bd 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/ImportCustomEntryTypesDialog.java @@ -44,8 +44,8 @@ public ImportCustomEntryTypesDialog(BibDatabaseMode mode, List cus viewModel.importBibEntryTypes( unknownEntryTypesCheckList.getCheckModel().getCheckedItems(), differentCustomizationCheckList.getCheckModel().getCheckedItems().stream() - .map(BibEntryTypePrefsAndFileViewModel::customTypeFromPreferences) - .toList()); + .map(BibEntryTypePrefsAndFileViewModel::customTypeFromPreferences) + .toList()); } return null; }); diff --git a/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java b/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java index 03492d4cece..e1f336e0c29 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesDialog.java @@ -110,9 +110,9 @@ public ImportEntriesDialog(BibDatabaseContext database, BackgroundTask task, SearchBasedFetcher fetcher, String query) { this.database = database; @@ -256,62 +256,62 @@ private void setupPaginationBindings() { }, viewModel.currentPageProperty(), viewModel.totalPagesProperty()); BooleanBinding isPagedFetcher = Bindings.createBooleanBinding(() -> - searchBasedFetcher.isPresent() && searchBasedFetcher.get() instanceof PagedSearchBasedFetcher + searchBasedFetcher.isPresent() && searchBasedFetcher.get() instanceof PagedSearchBasedFetcher ); // Disable: during loading OR when on the last page for non-paged fetchers // OR when the initial load is not complete for paged fetchers nextPageButton.disableProperty().bind( - loading.or(isOnLastPage.and(isPagedFetcher.not())) - .or(isPagedFetcher.and(initialLoadComplete.not())) + loading.or(isOnLastPage.and(isPagedFetcher.not())) + .or(isPagedFetcher.and(initialLoadComplete.not())) ); prevPageButton.disableProperty().bind(loading.or(viewModel.currentPageProperty().isEqualTo(0))); prevPageButton.textProperty().bind( - Bindings.when(loading) - .then("< " + Localization.lang("Loading...")) - .otherwise("< " + Localization.lang("Previous")) + Bindings.when(loading) + .then("< " + Localization.lang("Loading...")) + .otherwise("< " + Localization.lang("Previous")) ); nextPageButton.textProperty().bind( - Bindings.when(loading) - .then(Localization.lang("Loading...") + " >") - .otherwise( - Bindings.when(initialLoadComplete.not().and(isPagedFetcher)) - .then(Localization.lang("Loading initial entries...")) + Bindings.when(loading) + .then(Localization.lang("Loading...") + " >") .otherwise( - Bindings.when(isOnLastPage) - .then( - Bindings.when(isPagedFetcher) - .then(Localization.lang("Load More") + " >>") - .otherwise(Localization.lang("No more entries")) - ) - .otherwise(Localization.lang("Next") + " >") + Bindings.when(initialLoadComplete.not().and(isPagedFetcher)) + .then(Localization.lang("Loading initial entries...")) + .otherwise( + Bindings.when(isOnLastPage) + .then( + Bindings.when(isPagedFetcher) + .then(Localization.lang("Load More") + " >>") + .otherwise(Localization.lang("No more entries")) + ) + .otherwise(Localization.lang("Next") + " >") + ) ) - ) ); statusLabel.textProperty().bind( - Bindings.when(loading) - .then(Localization.lang("Fetching more entries...")) - .otherwise( - Bindings.when(initialLoadComplete.not().and(isPagedFetcher)) - .then(Localization.lang("Loading initial results...")) + Bindings.when(loading) + .then(Localization.lang("Fetching more entries...")) .otherwise( - Bindings.when(isOnLastPage) - .then( - Bindings.when(isPagedFetcher) - .then(Localization.lang("Click 'Load More' to fetch additional entries")) - .otherwise(Bindings.createStringBinding(() -> { - int totalEntries = viewModel.getAllEntries().size(); - return totalEntries > 0 ? - Localization.lang("All %0 entries loaded", String.valueOf(totalEntries)) : - Localization.lang("No entries available"); - }, viewModel.getAllEntries())) - ) - .otherwise("") + Bindings.when(initialLoadComplete.not().and(isPagedFetcher)) + .then(Localization.lang("Loading initial results...")) + .otherwise( + Bindings.when(isOnLastPage) + .then( + Bindings.when(isPagedFetcher) + .then(Localization.lang("Click 'Load More' to fetch additional entries")) + .otherwise(Bindings.createStringBinding(() -> { + int totalEntries = viewModel.getAllEntries().size(); + return totalEntries > 0 ? + Localization.lang("All %0 entries loaded", String.valueOf(totalEntries)) : + Localization.lang("No entries available"); + }, viewModel.getAllEntries())) + ) + .otherwise("") + ) ) - ) ); loading.addListener((_, _, newVal) -> { @@ -325,7 +325,7 @@ private void setupPaginationBindings() { statusLabel.getStyleClass().remove("info-message"); } }); -} + } private void updatePageUI() { pageNumberLabel.textProperty().bind(Bindings.createStringBinding(() -> { diff --git a/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java b/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java index c841a79c21b..0a39f06c331 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/ImportEntriesViewModel.java @@ -165,7 +165,7 @@ public void loadEntries(List entries) { public boolean hasDuplicate(BibEntry entry) { return findInternalDuplicate(entry).isPresent() || new DuplicateCheck(entryTypesManager) - .containsDuplicate(selectedDb.getValue().getDatabase(), entry, selectedDb.getValue().getMode()).isPresent(); + .containsDuplicate(selectedDb.getValue().getDatabase(), entry, selectedDb.getValue().getMode()).isPresent(); } public String getSourceString(BibEntry entry) { @@ -281,8 +281,8 @@ private void updatePagedEntries() { public void fetchMoreEntries() { if (fetcher.isPresent() && - fetcher.get() instanceof PagedSearchBasedFetcher pagedFetcher && - query.isPresent() && !loading.get()) { + fetcher.get() instanceof PagedSearchBasedFetcher pagedFetcher && + query.isPresent() && !loading.get()) { loading.set(true); BackgroundTask> fetchTask = BackgroundTask .wrap(() -> { diff --git a/jabgui/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java b/jabgui/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java index 43fb3d836d2..cf446898cee 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/NewDatabaseAction.java @@ -16,8 +16,8 @@ public class NewDatabaseAction extends SimpleCommand { /** * Constructs a command to create a new library of the default type * - * @param tabContainer the ui container for libraries - * @param preferences the preferencesService of JabRef + * @param tabContainer the ui container for libraries + * @param preferences the preferencesService of JabRef */ public NewDatabaseAction(LibraryTabContainer tabContainer, CliPreferences preferences) { this.tabContainer = tabContainer; diff --git a/jabgui/src/main/java/org/jabref/gui/importer/ParserResultWarningDialog.java b/jabgui/src/main/java/org/jabref/gui/importer/ParserResultWarningDialog.java index 63ae19877bd..7c000e3e86f 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/ParserResultWarningDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/ParserResultWarningDialog.java @@ -18,7 +18,7 @@ private ParserResultWarningDialog() { /** * Shows a dialog with the warnings from an import or open of a file * - * @param parserResult - ParserResult for the current import/open + * @param parserResult - ParserResult for the current import/open */ public static void showParserResultWarningDialog(final ParserResult parserResult, final DialogService dialogService) { diff --git a/jabgui/src/main/java/org/jabref/gui/importer/actions/GUIPostOpenAction.java b/jabgui/src/main/java/org/jabref/gui/importer/actions/GUIPostOpenAction.java index f4eec73e339..6904b0310b2 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/actions/GUIPostOpenAction.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/actions/GUIPostOpenAction.java @@ -29,10 +29,10 @@ public interface GUIPostOpenAction { * the isActionNecessary() method returned true. *

* Note: if several such methods need to be called sequentially, it is - * important that all implementations of this method do not return - * until the operation is finished. + * important that all implementations of this method do not return + * until the operation is finished. * - * @param pr The result of the BIB parse operation. + * @param pr The result of the BIB parse operation. */ void performAction(ParserResult pr, DialogService dialogService, CliPreferences preferences); } diff --git a/jabgui/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java b/jabgui/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java index 3e872e4ff31..590e21cbb1c 100644 --- a/jabgui/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java +++ b/jabgui/src/main/java/org/jabref/gui/importer/actions/OpenDatabaseAction.java @@ -214,7 +214,7 @@ public void openFiles(List filesToOpen) { /** * This is the real file opening. Should be called via {@link #openFile(Path)} - * + *

* Similar method: {@link org.jabref.gui.frame.JabRefFrame#addTab(org.jabref.model.database.BibDatabaseContext, boolean)}. * * @param file the file, may be NOT null, but may not be existing @@ -281,18 +281,18 @@ private ParserResult loadDatabase(Path file) throws NotASharedDatabaseException, } if (parserResult.getDatabase().isShared()) { - openSharedDatabase( - parserResult, - tabContainer, - dialogService, - preferences, - aiService, - stateManager, - entryTypesManager, - fileUpdateMonitor, - undoManager, - clipboardManager, - taskExecutor); + openSharedDatabase( + parserResult, + tabContainer, + dialogService, + preferences, + aiService, + stateManager, + entryTypesManager, + fileUpdateMonitor, + undoManager, + clipboardManager, + taskExecutor); } return parserResult; } diff --git a/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsPane.java b/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsPane.java index 096e5633884..d3a7f6ec71d 100644 --- a/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsPane.java +++ b/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsPane.java @@ -20,7 +20,7 @@ /** * Controller for the .blg file settings panel. - * + *

* Binds the path text field to the ViewModel, * and handles browse/reset button actions. */ diff --git a/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsViewModel.java b/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsViewModel.java index e6a1c39351b..2551fdded62 100644 --- a/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/integrity/BibLogSettingsViewModel.java @@ -54,7 +54,7 @@ public BibLogSettingsViewModel(MetaData metaData, Optional bibPath) { * * @param databaseContext the current database context used to resolve citation keys in warnings. * @return An Optional containing the list of integrity messages if the file exists and can be parsed, - * or an empty Optional if the file does not exist. + * or an empty Optional if the file does not exist. * @throws JabRefException if the .blg file cannot be parsed or read */ public Optional> getBlgWarnings(BibDatabaseContext databaseContext) throws JabRefException { diff --git a/jabgui/src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.java b/jabgui/src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.java index 8fcf14aa11e..bacffd5e16b 100644 --- a/jabgui/src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/integrity/IntegrityCheckDialog.java @@ -175,7 +175,7 @@ private void loadBibLogSettingsPane() { * Called on: * (1) Dialog initialization (default load) * (2) User triggers Browse or Reset in BibLogSettingsPane - * + *

* This reloads .blg warnings and merges them into the main message list. */ private void reloadBlgWarnings() { diff --git a/jabgui/src/main/java/org/jabref/gui/journals/AbbreviationType.java b/jabgui/src/main/java/org/jabref/gui/journals/AbbreviationType.java index 221141bf7cc..de30b58225c 100644 --- a/jabgui/src/main/java/org/jabref/gui/journals/AbbreviationType.java +++ b/jabgui/src/main/java/org/jabref/gui/journals/AbbreviationType.java @@ -2,7 +2,7 @@ /** * Defines the different abbreviation types that JabRef can operate with. - * + *

* DEFAULT: Default abbreviation type, which is the standard behavior. * DOTLESS: Abbreviation type that does not include dots in the abbreviation. * SHORTEST_UNIQUE: Abbreviation type that generates the shortest unique abbreviation. diff --git a/jabgui/src/main/java/org/jabref/gui/keyboard/TextInputKeyBindings.java b/jabgui/src/main/java/org/jabref/gui/keyboard/TextInputKeyBindings.java index 7140fefe4a6..2fe6622f52c 100644 --- a/jabgui/src/main/java/org/jabref/gui/keyboard/TextInputKeyBindings.java +++ b/jabgui/src/main/java/org/jabref/gui/keyboard/TextInputKeyBindings.java @@ -33,11 +33,15 @@ public static void call(Scene scene, KeyEvent event, KeyBindingRepository keyBin focusedTextField.nextWord(); event.consume(); } - case EDITOR_BEGINNING, EDITOR_UP, EDITOR_BEGINNING_DOC -> { + case EDITOR_BEGINNING, + EDITOR_UP, + EDITOR_BEGINNING_DOC -> { focusedTextField.home(); event.consume(); } - case EDITOR_END, EDITOR_DOWN, EDITOR_END_DOC -> { + case EDITOR_END, + EDITOR_DOWN, + EDITOR_END_DOC -> { focusedTextField.end(); event.consume(); } diff --git a/jabgui/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java b/jabgui/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java index 9c2cd72039b..303885c9c6a 100644 --- a/jabgui/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/libraryproperties/LibraryPropertiesViewModel.java @@ -40,7 +40,7 @@ public void storeAllSettings() { public boolean validateAllSettings() { for (PropertiesTab propertiesTab : propertiesTabs) { if (!propertiesTab.validateSettings()) { - return false; + return false; } } return true; diff --git a/jabgui/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java b/jabgui/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java index 6633dbe1ac9..a7ca2fe833a 100644 --- a/jabgui/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/libraryproperties/contentselectors/ContentSelectorViewModel.java @@ -198,8 +198,8 @@ private List determineFieldsToRemove() { // Remove all content selectors that are not in the new list List result = new ArrayList<>(metaData.getContentSelectors().getFieldsWithSelectors().stream() - .filter(field -> !newlyAddedKeywords.contains(field)) - .toList()); + .filter(field -> !newlyAddedKeywords.contains(field)) + .toList()); // Remove all unset default fields result.addAll(fieldKeywordsMap.entrySet() .stream() diff --git a/jabgui/src/main/java/org/jabref/gui/libraryproperties/general/GeneralPropertiesViewModel.java b/jabgui/src/main/java/org/jabref/gui/libraryproperties/general/GeneralPropertiesViewModel.java index b87b56c4f86..4a7e9c15021 100644 --- a/jabgui/src/main/java/org/jabref/gui/libraryproperties/general/GeneralPropertiesViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/libraryproperties/general/GeneralPropertiesViewModel.java @@ -287,7 +287,7 @@ public void togglePath(StringProperty fileDirectory) { /** * For a saved library, any directory relative to the library path will be set as relative; otherwise, it will be set as absolute. * - * @param fileDirectory file directory to be updated (lib/user/laTex) + * @param fileDirectory file directory to be updated (lib/user/laTex) * @param selectedDirPath path of directory (selected by user) */ private void setDirectory(StringProperty fileDirectory, Path selectedDirPath) { @@ -301,7 +301,7 @@ private void setDirectory(StringProperty fileDirectory, Path selectedDirPath) { // set relative path fileDirectory.setValue(libPath.get() - .getParent() - .relativize(selectedDirPath).toString()); + .getParent() + .relativize(selectedDirPath).toString()); } } diff --git a/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java b/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java index e2701a309c3..489fd81644c 100644 --- a/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/libraryproperties/saving/SavingPropertiesViewModel.java @@ -68,9 +68,12 @@ public void setValues() { // SaveOrderConfigPanel, included via in FXML switch (saveOrder.getOrderType()) { - case SPECIFIED -> saveInSpecifiedOrderProperty.setValue(true); - case ORIGINAL -> saveInOriginalProperty.setValue(true); - case TABLE -> saveInTableOrderProperty.setValue(true); + case SPECIFIED -> + saveInSpecifiedOrderProperty.setValue(true); + case ORIGINAL -> + saveInOriginalProperty.setValue(true); + case TABLE -> + saveInTableOrderProperty.setValue(true); } sortableFieldsProperty.clear(); diff --git a/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileAction.java b/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileAction.java index 941c5c92da7..fce138d1981 100644 --- a/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileAction.java +++ b/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileAction.java @@ -82,14 +82,14 @@ public void execute() { LinkedFileEditDialog dialog = new LinkedFileEditDialog(linkedFile); dialogService.showCustomDialogAndWait(dialog) - .ifPresent(editedLinkedFile -> { - Optional fieldChange = entry.addFile(editedLinkedFile); - fieldChange.ifPresent(change -> { - UndoableFieldChange ce = new UndoableFieldChange(change); - libraryTab.getUndoManager().addEdit(ce); - libraryTab.markBaseChanged(); - }); - }); + .ifPresent(editedLinkedFile -> { + Optional fieldChange = entry.addFile(editedLinkedFile); + fieldChange.ifPresent(change -> { + UndoableFieldChange ce = new UndoableFieldChange(change); + libraryTab.getUndoManager().addEdit(ce); + libraryTab.markBaseChanged(); + }); + }); }); } } diff --git a/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileFromURLAction.java b/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileFromURLAction.java index 8ac056f8119..a172f9dd866 100644 --- a/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileFromURLAction.java +++ b/jabgui/src/main/java/org/jabref/gui/linkedfile/AttachFileFromURLAction.java @@ -63,11 +63,11 @@ public void execute() { try { URL url = URLUtil.create(urlforDownload.get()); LinkedFileViewModel onlineFile = new LinkedFileViewModel( - new LinkedFile(url, ""), - entry, - databaseContext, - taskExecutor, - dialogService, + new LinkedFile(url, ""), + entry, + databaseContext, + taskExecutor, + dialogService, preferences); onlineFile.download(true); } catch (MalformedURLException exception) { diff --git a/jabgui/src/main/java/org/jabref/gui/linkedfile/RedownloadMissingFilesAction.java b/jabgui/src/main/java/org/jabref/gui/linkedfile/RedownloadMissingFilesAction.java index d7de66854cb..e8d96958df1 100644 --- a/jabgui/src/main/java/org/jabref/gui/linkedfile/RedownloadMissingFilesAction.java +++ b/jabgui/src/main/java/org/jabref/gui/linkedfile/RedownloadMissingFilesAction.java @@ -65,29 +65,29 @@ public void execute() { private void redownloadMissing(BibDatabaseContext databaseContext) { LOGGER.info("Redownloading missing files"); databaseContext.getEntries().forEach(entry -> - entry.getFiles().forEach(linkedFile -> { - if (linkedFile.isOnlineLink() || linkedFile.getSourceUrl().isEmpty()) { - return; - } + entry.getFiles().forEach(linkedFile -> { + if (linkedFile.isOnlineLink() || linkedFile.getSourceUrl().isEmpty()) { + return; + } - Optional path = FileUtil.find(this.databaseContext, linkedFile.getLink(), filePreferences); - if (path.isPresent() && Files.exists(path.get())) { - return; - } - String fileName = Path.of(linkedFile.getLink()).getFileName().toString(); + Optional path = FileUtil.find(this.databaseContext, linkedFile.getLink(), filePreferences); + if (path.isPresent() && Files.exists(path.get())) { + return; + } + String fileName = Path.of(linkedFile.getLink()).getFileName().toString(); - DownloadLinkedFileAction downloadAction = new DownloadLinkedFileAction( - this.databaseContext, - entry, - linkedFile, - linkedFile.getSourceUrl(), - dialogService, - externalApplicationsPreferences, - filePreferences, - taskExecutor, - fileName, - true); - downloadAction.execute(); - })); + DownloadLinkedFileAction downloadAction = new DownloadLinkedFileAction( + this.databaseContext, + entry, + linkedFile, + linkedFile.getSourceUrl(), + dialogService, + externalApplicationsPreferences, + filePreferences, + taskExecutor, + fileName, + true); + downloadAction.execute(); + })); } } diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java b/jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java index b4aa68fd321..02474b59304 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/ExtractReferencesAction.java @@ -36,7 +36,7 @@ *

  • Mode choice A: online or offline
  • *
  • Mode choice B: complete entry or single file (the latter is not implemented)
  • * - * + *

    * The mode is selected by the preferences whether to use Grobid or not. */ public class ExtractReferencesAction extends SimpleCommand { @@ -59,7 +59,7 @@ public ExtractReferencesAction(DialogService dialogService, /** * Can be used to bind the action on a context menu in the linked file view (future work) * - * @param entry the entry to handle (can be null) + * @param entry the entry to handle (can be null) * @param linkedFile the linked file (can be null) */ private ExtractReferencesAction(@NonNull DialogService dialogService, @@ -164,7 +164,7 @@ private void extractReferences(Iterator fileListIterator, ParserResult res /** * Creates the field content for the "cites" field. The field contains the citation keys of the imported entries. - * + *

    * TODO: Move this part to logic somehow * * @param currentEntry used to create citation keys if the importer did not provide one from the imported entry diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/MainTable.java b/jabgui/src/main/java/org/jabref/gui/maintable/MainTable.java index 0f59d35000d..3d8c9e8ec2a 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/MainTable.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/MainTable.java @@ -179,10 +179,10 @@ public MainTable(MainTableDataModel model, // force match category column to be the first sort order, (match_category column is always the first column) this.getSortOrder().addFirst(getColumns().getFirst()); this.getSortOrder().addListener((ListChangeListener>) change -> { - if (!this.getSortOrder().getFirst().equals(getColumns().getFirst())) { - this.getSortOrder().addFirst(getColumns().getFirst()); - } - }); + if (!this.getSortOrder().getFirst().equals(getColumns().getFirst())) { + this.getSortOrder().addFirst(getColumns().getFirst()); + } + }); mainTablePreferences.getColumnPreferences().getColumnSortOrder().forEach(columnModel -> this.getColumns().stream() @@ -434,7 +434,7 @@ private void setupKeyBindings(KeyBindingRepository keyBindings) { event.consume(); break; case SCROLL_TO_PREVIOUS_MATCH_CATEGORY: - scrollToPreviousMatchCategory(); + scrollToPreviousMatchCategory(); event.consume(); break; case OPEN_URL_OR_DOI: @@ -540,7 +540,9 @@ private void handleOnDragDropped(TableRow row, BibEntryT switch (ControlHelper.getDroppingMouseLocation(row, event)) { // Different actions depending on where the user releases the drop in the target row // - Bottom + top -> import entries - case TOP, BOTTOM -> importHandler.importFilesInBackground(files, database, filePreferences, transferMode).executeWith(taskExecutor); + case TOP, + BOTTOM -> + importHandler.importFilesInBackground(files, database, filePreferences, transferMode).executeWith(taskExecutor); // - Center -> modify entry: link files to entry case CENTER -> { BibEntry entry = target.getEntry(); @@ -600,13 +602,13 @@ public void setCitationMergeMode(boolean citationMerge) { } private void updatePlaceholder(VBox placeholderBox) { - if (database.getDatabase().getEntries().isEmpty()) { - this.setPlaceholder(placeholderBox); - // [impl->req~maintable.focus~1] - requestFocus(); - } else { - this.setPlaceholder(null); - } + if (database.getDatabase().getEntries().isEmpty()) { + this.setPlaceholder(placeholderBox); + // [impl->req~maintable.focus~1] + requestFocus(); + } else { + this.setPlaceholder(null); + } } private BibEntry addExampleEntry() { diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java index cc14cdb7ac1..0ded3319f92 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableColumnModel.java @@ -34,6 +34,7 @@ public class MainTableColumnModel { public static final Character COLUMNS_QUALIFIER_DELIMITER = ':'; private static final Logger LOGGER = LoggerFactory.getLogger(MainTableColumnModel.class); + public enum Type { MATCH_CATEGORY("match_category"), // Not localized, because this column is always hidden INDEX("index", Localization.lang("Index")), @@ -47,7 +48,6 @@ public enum Type { SPECIALFIELD("special", Localization.lang("Special")), LIBRARY_NAME("library", Localization.lang("Library")); - public static final EnumSet ICON_COLUMNS = EnumSet.of(EXTRAFILE, FILES, GROUPS, GROUP_ICONS, LINKED_IDENTIFIER); private final String name; @@ -84,9 +84,9 @@ public static Type fromString(String text) { @Override public String toString() { return "Type{" + - "name='" + name + '\'' + - ", displayName='" + displayName + '\'' + - '}'; + "name='" + name + '\'' + + ", displayName='" + displayName + '\'' + + '}'; } } @@ -195,15 +195,15 @@ public ObjectProperty sortTypeProperty() { * Returns a list of sort cirteria based on the fields the current column displays. * In case it is single field, a single SortCriterion is returned. * In case of multiple fields, for each field, there is a SortCriterion contained in the list. - * + *

    * Implementation reason: We want to have SortCriterion handle a single field, because the UI allows for handling * "plain" fields only. */ public List getSortCriteria() { boolean descending = getSortType() == TableColumn.SortType.DESCENDING; return FieldFactory.parseOrFields(getQualifier()).getFields().stream() - .map(field -> new SaveOrder.SortCriterion(field, descending)) - .toList(); + .map(field -> new SaveOrder.SortCriterion(field, descending)) + .toList(); } @Override @@ -232,9 +232,9 @@ public int hashCode() { @Override public String toString() { return "MainTableColumnModel{" + - "qualifierProperty=" + qualifierProperty + - ", typeProperty=" + typeProperty + - '}'; + "qualifierProperty=" + qualifierProperty + + ", typeProperty=" + typeProperty + + '}'; } /** diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java index 643f04c505f..50c5e5554c7 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableDataModel.java @@ -222,8 +222,8 @@ public Optional getViewModelByIndex(int index) { public Optional getViewModelByCitationKey(String citationKey) { return entriesViewModel.stream() - .filter(viewModel -> citationKey.equals(viewModel.getEntry().getCitationKey().orElse(""))) - .findFirst(); + .filter(viewModel -> citationKey.equals(viewModel.getEntry().getCitationKey().orElse(""))) + .findFirst(); } public void resetFieldFormatter() { diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableFieldValueFormatter.java b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableFieldValueFormatter.java index 33841527a34..a2838f709c4 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableFieldValueFormatter.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableFieldValueFormatter.java @@ -29,7 +29,7 @@ public MainTableFieldValueFormatter(NameDisplayPreferences nameDisplayPreference * unicode if possible. * * @param fields the fields argument of {@link BibEntryTableViewModel#getFields(OrFields)}. - * @param entry the BibEntry of {@link BibEntryTableViewModel}. + * @param entry the BibEntry of {@link BibEntryTableViewModel}. * @return The formatted name field. */ public String formatFieldsValues(final OrFields fields, final BibEntry entry) { @@ -72,14 +72,18 @@ private String formatFieldWithAuthorValue(final String nameToFormat) { } return switch (displayStyle) { - default -> nameToFormat; - case FIRSTNAME_LASTNAME -> authors.latexFree().getAsFirstLastNames( - abbreviationStyle == AbbreviationStyle.FULL, - false); - case LASTNAME_FIRSTNAME -> authors.latexFree().getAsLastFirstNames( - abbreviationStyle == AbbreviationStyle.FULL, - false); - case NATBIB -> authors.latexFree().getAsNatbib(); + default -> + nameToFormat; + case FIRSTNAME_LASTNAME -> + authors.latexFree().getAsFirstLastNames( + abbreviationStyle == AbbreviationStyle.FULL, + false); + case LASTNAME_FIRSTNAME -> + authors.latexFree().getAsLastFirstNames( + abbreviationStyle == AbbreviationStyle.FULL, + false); + case NATBIB -> + authors.latexFree().getAsNatbib(); }; } } diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableHeaderContextMenu.java b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableHeaderContextMenu.java index 7cfe366ff12..6fd0cbbd65e 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/MainTableHeaderContextMenu.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/MainTableHeaderContextMenu.java @@ -153,7 +153,7 @@ private boolean isACommonColumn(MainTableColumn tableColumn) { * Determines if a list of TableColumns contains the searched column. */ private boolean isColumnInList(MainTableColumn searchColumn, List> tableColumns) { - for (TableColumn column: tableColumns) { + for (TableColumn column : tableColumns) { MainTableColumnModel model = ((MainTableColumn) column).getModel(); if (model.equals(searchColumn.getModel())) { return true; @@ -193,7 +193,7 @@ private boolean isColumnInList(MainTableColumn searchColumn, List> commonTableColumns = new ArrayList<>(); - for (MainTableColumnModel columnModel: commonColumns) { + for (MainTableColumnModel columnModel : commonColumns) { TableColumn tableColumn = factory.createColumn(columnModel); commonTableColumns.add(tableColumn); } diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/OpenFolderAction.java b/jabgui/src/main/java/org/jabref/gui/maintable/OpenFolderAction.java index 8d3e362405c..758cfddf1a7 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/OpenFolderAction.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/OpenFolderAction.java @@ -49,28 +49,28 @@ public OpenFolderAction(DialogService dialogService, @Override public void execute() { - stateManager.getActiveDatabase().ifPresent(databaseContext -> { - if (entry == null) { - stateManager.getSelectedEntries().stream().filter(entry -> !entry.getFiles().isEmpty()).forEach(entry -> { - LinkedFileViewModel linkedFileViewModel = new LinkedFileViewModel( - entry.getFiles().getFirst(), - entry, - databaseContext, - taskExecutor, - dialogService, - preferences); - linkedFileViewModel.openFolder(); - }); - } else { + stateManager.getActiveDatabase().ifPresent(databaseContext -> { + if (entry == null) { + stateManager.getSelectedEntries().stream().filter(entry -> !entry.getFiles().isEmpty()).forEach(entry -> { LinkedFileViewModel linkedFileViewModel = new LinkedFileViewModel( - linkedFile, + entry.getFiles().getFirst(), entry, databaseContext, taskExecutor, dialogService, preferences); linkedFileViewModel.openFolder(); - } - }); + }); + } else { + LinkedFileViewModel linkedFileViewModel = new LinkedFileViewModel( + linkedFile, + entry, + databaseContext, + taskExecutor, + dialogService, + preferences); + linkedFileViewModel.openFolder(); + } + }); } } diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/RightClickMenu.java b/jabgui/src/main/java/org/jabref/gui/maintable/RightClickMenu.java index a7a913bf6e3..16d67dcaf49 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/RightClickMenu.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/RightClickMenu.java @@ -162,12 +162,12 @@ private static Menu createCopyToMenu(ActionFactory factory, } public static Menu createCopySubMenu(ActionFactory factory, - DialogService dialogService, - StateManager stateManager, - GuiPreferences preferences, - ClipBoardManager clipBoardManager, - JournalAbbreviationRepository abbreviationRepository, - TaskExecutor taskExecutor) { + DialogService dialogService, + StateManager stateManager, + GuiPreferences preferences, + ClipBoardManager clipBoardManager, + JournalAbbreviationRepository abbreviationRepository, + TaskExecutor taskExecutor) { Menu copySpecialMenu = factory.createMenu(StandardActions.COPY_MORE); copySpecialMenu.getItems().addAll( @@ -203,11 +203,11 @@ public static Menu createCopySubMenu(ActionFactory factory, } static Menu createCopyFieldContentSubMenu(ActionFactory factory, - DialogService dialogService, - StateManager stateManager, - ClipBoardManager clipBoardManager, - GuiPreferences preferences, - JournalAbbreviationRepository abbreviationRepository) { + DialogService dialogService, + StateManager stateManager, + ClipBoardManager clipBoardManager, + GuiPreferences preferences, + JournalAbbreviationRepository abbreviationRepository) { Menu copyFieldContentMenu = factory.createMenu(StandardActions.COPY_FIELD_CONTENT); copyFieldContentMenu.getItems().addAll( diff --git a/jabgui/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java b/jabgui/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java index 22aa68e43f4..15ac22caf79 100644 --- a/jabgui/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java +++ b/jabgui/src/main/java/org/jabref/gui/maintable/columns/LinkedIdentifierColumn.java @@ -62,7 +62,7 @@ public LinkedIdentifierColumn(MainTableColumnModel model, .withOnMouseClickedEvent((entry, linkedFiles) -> event -> { // If we only have one identifer, open directly if ((linkedFiles.size() == 1) && (event.getButton() == MouseButton.PRIMARY)) { - new OpenUrlAction(dialogService, stateManager, preferences).execute(); + new OpenUrlAction(dialogService, stateManager, preferences).execute(); } }) .install(this); diff --git a/jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java b/jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java index 4ad7dbe3cb2..638fd4a2d4a 100644 --- a/jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java +++ b/jabgui/src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java @@ -65,8 +65,8 @@ private ObservableList getMenuItems(List entries, BibDatabas createSubMenu(Localization.lang("Custom"), entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX), entries, undoManager) .ifPresent(subMenu -> items.addAll(new SeparatorMenuItem(), - subMenu - )); + subMenu + )); } else { // Default BibTeX createSubMenu(BibDatabaseMode.BIBTEX.getFormattedName(), BibtexEntryTypeDefinitions.ALL, entries, undoManager) diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeTask.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeTask.java index b4a9cb82977..7eecc9827ef 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeTask.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeTask.java @@ -53,24 +53,24 @@ public BatchEntryMergeTask(List entries, @Override public Void call() { - if (isCancelled()) { - notifyCancellation(); - return null; - } - - List updatedEntries = processMergeEntries(); + if (isCancelled()) { + notifyCancellation(); + return null; + } - if (isCancelled()) { - notifyCancellation(); - updateUndoManager(updatedEntries); - return null; - } + List updatedEntries = processMergeEntries(); + if (isCancelled()) { + notifyCancellation(); updateUndoManager(updatedEntries); - LOGGER.debug("Merge operation completed. Processed: {}, Successfully updated: {}", - processedEntries, successfulUpdates); - notifySuccess(successfulUpdates); return null; + } + + updateUndoManager(updatedEntries); + LOGGER.debug("Merge operation completed. Processed: {}, Successfully updated: {}", + processedEntries, successfulUpdates); + notifySuccess(successfulUpdates); + return null; } private void notifyCancellation() { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeWithFetchedDataAction.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeWithFetchedDataAction.java index 5fd2dcbe24f..76862ab543e 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeWithFetchedDataAction.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/BatchEntryMergeWithFetchedDataAction.java @@ -17,7 +17,7 @@ /// Handles batch merging of bibliography entries with fetched data. /// -/// @see BatchEntryMergeTask +/// @see BatchEntryMergeTask /// public class BatchEntryMergeWithFetchedDataAction extends SimpleCommand { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/MergeEntriesHelper.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/MergeEntriesHelper.java index 717921f0b6d..5191c3ca0b2 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/MergeEntriesHelper.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/MergeEntriesHelper.java @@ -31,7 +31,7 @@ private MergeEntriesHelper() { /// /// @param entryFromFetcher The entry containing new information (source, from the fetcher) /// @param entryFromLibrary The entry to be updated (target, from the library) - /// @param namedCompound Compound edit to collect undo information + /// @param namedCompound Compound edit to collect undo information public static boolean mergeEntries(BibEntry entryFromFetcher, BibEntry entryFromLibrary, NamedCompound namedCompound) { LOGGER.debug("Entry from fetcher: {}", entryFromFetcher); LOGGER.debug("Entry from library: {}", entryFromLibrary); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/multiwaymerge/DiffHighlightingEllipsingTextFlow.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/multiwaymerge/DiffHighlightingEllipsingTextFlow.java index f01bec88e49..7cc84913088 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/multiwaymerge/DiffHighlightingEllipsingTextFlow.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/multiwaymerge/DiffHighlightingEllipsingTextFlow.java @@ -132,9 +132,12 @@ public void highlightDiff() { text.getStyleClass().add("text-unchanged"); yield List.of(text); } - case WORD -> DiffHighlighting.generateDiffHighlighting(comparisonString.get(), fullText, " "); - case CHARACTER -> DiffHighlighting.generateDiffHighlighting(comparisonString.get(), fullText, ""); - default -> throw new UnsupportedOperationException("Not implemented " + diffMode.getValue()); + case WORD -> + DiffHighlighting.generateDiffHighlighting(comparisonString.get(), fullText, " "); + case CHARACTER -> + DiffHighlighting.generateDiffHighlighting(comparisonString.get(), fullText, ""); + default -> + throw new UnsupportedOperationException("Not implemented " + diffMode.getValue()); }; allChildren.addAll(highlightedText); } else { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/EntriesMergeResult.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/EntriesMergeResult.java index 105d32e8901..f78e1c14352 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/EntriesMergeResult.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/EntriesMergeResult.java @@ -3,6 +3,10 @@ import org.jabref.model.entry.BibEntry; public record EntriesMergeResult( - BibEntry originalLeftEntry, BibEntry originalRightEntry, BibEntry newLeftEntry, BibEntry newRightEntry, BibEntry mergedEntry + BibEntry originalLeftEntry, + BibEntry originalRightEntry, + BibEntry newLeftEntry, + BibEntry newRightEntry, + BibEntry mergedEntry ) { } diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/FieldRowViewModel.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/FieldRowViewModel.java index 2cd50b5ffa6..051c6b4c8d4 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/FieldRowViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/FieldRowViewModel.java @@ -37,7 +37,8 @@ public enum Selection { /** * When the user types something into the merged field value and neither the left nor * right values match it, NONE is selected - * */ + * + */ NONE } @@ -105,8 +106,10 @@ public FieldRowViewModel(Field field, BibEntry leftEntry, BibEntry rightEntry, B EasyBind.subscribe(selectionProperty(), selection -> { LOGGER.debug("Selecting {}' value for field {}", selection, field.getDisplayName()); switch (selection) { - case LEFT -> EasyBind.subscribe(leftFieldValueProperty(), this::setMergedFieldValue); - case RIGHT -> EasyBind.subscribe(rightFieldValueProperty(), this::setMergedFieldValue); + case LEFT -> + EasyBind.subscribe(leftFieldValueProperty(), this::setMergedFieldValue); + case RIGHT -> + EasyBind.subscribe(rightFieldValueProperty(), this::setMergedFieldValue); } }); @@ -129,13 +132,13 @@ public void autoSelectBetterValue() { String rightValue = getRightFieldValue(); if (StandardField.YEAR == field) { - YearFieldValuePlausibilityComparator comparator = new YearFieldValuePlausibilityComparator(); - ComparisonResult comparison = comparator.compare(leftValue, rightValue); - if (ComparisonResult.RIGHT_BETTER == comparison) { - selectRightValue(); - } else if (ComparisonResult.LEFT_BETTER == comparison) { - selectLeftValue(); - } + YearFieldValuePlausibilityComparator comparator = new YearFieldValuePlausibilityComparator(); + ComparisonResult comparison = comparator.compare(leftValue, rightValue); + if (ComparisonResult.RIGHT_BETTER == comparison) { + selectRightValue(); + } else if (ComparisonResult.LEFT_BETTER == comparison) { + selectLeftValue(); + } } else if (InternalField.TYPE_HEADER == field) { if (leftValue.equalsIgnoreCase(StandardEntryType.Misc.getName())) { selectRightValue(); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/GroupDiffMode.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/GroupDiffMode.java index 0f284526c57..c6c577e8d3b 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/GroupDiffMode.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/GroupDiffMode.java @@ -5,7 +5,7 @@ public class GroupDiffMode implements DiffMethod { private final String separator; public GroupDiffMode(String separator) { - this.separator = separator; + this.separator = separator; } @Override diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeHeaderView.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeHeaderView.java index b4d9a713ea8..5c0a1a3cf05 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeHeaderView.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeHeaderView.java @@ -26,10 +26,10 @@ public ThreeWayMergeHeaderView(String leftHeader, String rightHeader) { this.mergedHeaderCell = new HeaderCell(Localization.lang("Merged entry")); addRow(0, - new HeaderCell(""), - leftHeaderCell, - rightHeaderCell, - mergedHeaderCell + new HeaderCell(""), + leftHeaderCell, + rightHeaderCell, + mergedHeaderCell ); setPrefHeight(Control.USE_COMPUTED_SIZE); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeView.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeView.java index 0f177bea80d..d66b16b45c6 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeView.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/ThreeWayMergeView.java @@ -117,9 +117,9 @@ private void updateDiff() { private void initializeHeaderView() { headerView.getColumnConstraints().addAll(fieldNameColumnConstraints, - leftEntryColumnConstraints, - rightEntryColumnConstraints, - mergedEntryColumnConstraints); + leftEntryColumnConstraints, + rightEntryColumnConstraints, + mergedEntryColumnConstraints); } private void initializeScrollPane() { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/HeaderCell.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/HeaderCell.java index 56dd1de1178..f0fe7d82d09 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/HeaderCell.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/HeaderCell.java @@ -5,7 +5,8 @@ /** * A readonly cell used to display the header of the ThreeWayMerge UI at the top of the layout. - * */ + * + */ public class HeaderCell extends ThreeWayMergeCell { public static final String DEFAULT_STYLE_CLASS = "merge-header-cell"; private final Label label = new Label(); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/MergedFieldCell.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/MergedFieldCell.java index 050b85e70f4..e50de5d95fe 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/MergedFieldCell.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/MergedFieldCell.java @@ -28,9 +28,9 @@ private void initialize() { private void initializeTextArea() { BindingsHelper.bindBidirectional(textArea.textProperty(), - textProperty(), - textArea::replaceText, - textProperty()::setValue); + textProperty(), + textArea::replaceText, + textProperty()::setValue); setAlignment(Pos.CENTER); textArea.setWrapText(true); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/OpenExternalLinkAction.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/OpenExternalLinkAction.java index 43e00e1ecca..eeb39e9e192 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/OpenExternalLinkAction.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/OpenExternalLinkAction.java @@ -40,7 +40,7 @@ public void execute() { ); } else { NativeDesktop.openBrowser(urlOrDoi, externalApplicationPreferences - ); + ); } } catch (IOException e) { LOGGER.warn("Cannot open the given external link '{}'", urlOrDoi, e); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/sidebuttons/ToggleMergeUnmergeButton.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/sidebuttons/ToggleMergeUnmergeButton.java index 5b1122c999a..aecb080ffda 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/sidebuttons/ToggleMergeUnmergeButton.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/cell/sidebuttons/ToggleMergeUnmergeButton.java @@ -65,7 +65,8 @@ public boolean canMerge() { /** * Setting {@code canMerge} to {@code false} will disable the merge/unmerge button - * */ + * + */ public void setCanMerge(boolean value) { canMergeProperty().set(value); } diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/diffhighlighter/SplitDiffHighlighter.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/diffhighlighter/SplitDiffHighlighter.java index e6285f812cd..f2edf46f0ee 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/diffhighlighter/SplitDiffHighlighter.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/diffhighlighter/SplitDiffHighlighter.java @@ -38,16 +38,16 @@ public void highlight() { List affectedTokensInSource = delta.getSource().getLines(); List affectedTokensInTarget = delta.getTarget().getLines(); int joinedSourceTokensLength = affectedTokensInSource.stream() - .map(String::length) - .reduce(Integer::sum) - .map(value -> value + (getSeparator().length() * (affectedTokensInSource.size() - 1))) - .orElse(0); + .map(String::length) + .reduce(Integer::sum) + .map(value -> value + (getSeparator().length() * (affectedTokensInSource.size() - 1))) + .orElse(0); int joinedTargetTokensLength = affectedTokensInTarget.stream() - .map(String::length) - .reduce(Integer::sum) - .map(value -> value + (getSeparator().length() * (affectedTokensInTarget.size() - 1))) - .orElse(0); + .map(String::length) + .reduce(Integer::sum) + .map(value -> value + (getSeparator().length() * (affectedTokensInTarget.size() - 1))) + .orElse(0); int affectedSourceTokensPositionInText = getPositionInText(affectedSourceTokensPosition, sourceTokens); int affectedTargetTokensPositionInText = getPositionInText(affectedTargetTokensPosition, targetTokens); switch (delta.getType()) { @@ -68,9 +68,9 @@ public int getPositionInText(int positionInTokenList, List tokenList) { return 0; } else { return tokenList.stream().limit(positionInTokenList).map(String::length) - .reduce(Integer::sum) - .map(value -> value + (getSeparator().length() * positionInTokenList)) - .orElse(0); + .reduce(Integer::sum) + .map(value -> value + (getSeparator().length() * positionInTokenList)) + .orElse(0); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/CommentMerger.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/CommentMerger.java index cccb75db27f..b455c5f98c9 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/CommentMerger.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/CommentMerger.java @@ -5,7 +5,8 @@ /** * A merger for the {@link StandardField#COMMENT} field - * */ + * + */ public class CommentMerger implements FieldMerger { @Override public String merge(String fieldValueA, String fieldValueB) { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMerger.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMerger.java index 7dfdb077341..2ede2f215d4 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMerger.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMerger.java @@ -2,7 +2,8 @@ /** * This class is responsible for taking two values for some field and merging them to into one value - * */ + * + */ @FunctionalInterface public interface FieldMerger { String merge(String fieldValueA, String fieldValueB); diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMergerFactory.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMergerFactory.java index 9af2f85be0c..44b341f39f1 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMergerFactory.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FieldMergerFactory.java @@ -13,12 +13,18 @@ public FieldMergerFactory(BibEntryPreferences bibEntryPreferences) { public FieldMerger create(Field field) { return switch (field) { - case StandardField.GROUPS -> new GroupMerger(bibEntryPreferences); - case StandardField.KEYWORDS -> new KeywordMerger(bibEntryPreferences); - case StandardField.COMMENT -> new CommentMerger(); - case StandardField.FILE -> new FileMerger(); - case null -> throw new IllegalArgumentException("Field must not be null"); - default -> throw new IllegalArgumentException("No implementation found for merging the given field: " + field.getDisplayName()); + case StandardField.GROUPS -> + new GroupMerger(bibEntryPreferences); + case StandardField.KEYWORDS -> + new KeywordMerger(bibEntryPreferences); + case StandardField.COMMENT -> + new CommentMerger(); + case StandardField.FILE -> + new FileMerger(); + case null -> + throw new IllegalArgumentException("Field must not be null"); + default -> + throw new IllegalArgumentException("No implementation found for merging the given field: " + field.getDisplayName()); }; } diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FileMerger.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FileMerger.java index 7e5f075f6cb..91692a97687 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FileMerger.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/FileMerger.java @@ -10,7 +10,8 @@ /** * A merger for the {@link StandardField#FILE} field - * */ + * + */ public class FileMerger implements FieldMerger { @Override public String merge(String filesA, String filesB) { diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/GroupMerger.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/GroupMerger.java index 2aa182c286a..385754806bf 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/GroupMerger.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/GroupMerger.java @@ -11,7 +11,8 @@ /** * A merger for the {@link StandardField#GROUPS} field - * */ + * + */ public class GroupMerger implements FieldMerger { private final @NonNull BibEntryPreferences bibEntryPreferences; diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/KeywordMerger.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/KeywordMerger.java index f47190ef1b5..2e8c365a813 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/KeywordMerger.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/fieldsmerger/KeywordMerger.java @@ -8,7 +8,8 @@ /** * A merger for the {@link StandardField#KEYWORDS} field - * */ + * + */ public class KeywordMerger implements FieldMerger { private final BibEntryPreferences bibEntryPreferences; diff --git a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/toolbar/ThreeWayMergeToolbar.java b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/toolbar/ThreeWayMergeToolbar.java index 74cc54a255d..f086f0c7dbc 100644 --- a/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/toolbar/ThreeWayMergeToolbar.java +++ b/jabgui/src/main/java/org/jabref/gui/mergeentries/threewaymerge/toolbar/ThreeWayMergeToolbar.java @@ -64,8 +64,8 @@ public class ThreeWayMergeToolbar extends AnchorPane { public ThreeWayMergeToolbar() { ViewLoader.view(this) - .root(this) - .load(); + .root(this) + .load(); } @FXML diff --git a/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java b/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java index a6173daff6a..53e9c00e18d 100644 --- a/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java +++ b/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryView.java @@ -209,12 +209,12 @@ public void initialize() { visualizer.setDecoration(new IconValidationDecorator()); EasyBind.subscribe( - viewModel.executedSuccessfullyProperty(), - succeeded -> { - if (succeeded) { - onSuccessfulExecution(); - } - }); + viewModel.executedSuccessfullyProperty(), + succeeded -> { + if (succeeded) { + onSuccessfulExecution(); + } + }); initializeAddEntry(); initializeLookupIdentifier(); @@ -514,38 +514,70 @@ private static String descriptionOfStandardEntryType(StandardEntryType type) { // Biblatex is a superset of bibtex, with more elaborate descriptions, so its documentation is preferred. // See [https://mirrors.ibiblio.org/pub/mirrors/CTAN/macros/latex/contrib/biblatex/doc/biblatex.pdf]. return switch (type) { - case Article -> Localization.lang("An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title."); - case Book -> Localization.lang("A single-volume book with one or more authors where the authors share credit for the work as a whole."); - case Booklet -> Localization.lang("A book-like work without a formal publisher or sponsoring institution."); - case Collection -> Localization.lang("A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor."); - case Conference -> Localization.lang("A legacy alias for \"InProceedings\"."); - case InBook -> Localization.lang("A part of a book which forms a self-contained unit with its own title."); - case InCollection -> Localization.lang("A contribution to a collection which forms a self-contained unit with a distinct author and title."); - case InProceedings -> Localization.lang("An article in a conference proceedings."); - case Manual -> Localization.lang("Technical or other documentation, not necessarily in printed form."); - case MastersThesis -> Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term Master's thesis."); - case Misc -> Localization.lang("A fallback type for entries which do not fit into any other category."); - case PhdThesis -> Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term PhD thesis."); - case Proceedings -> Localization.lang("A single-volume conference proceedings. This type is very similar to \"Collection\"."); - case TechReport -> Localization.lang("Similar to \"Report\" except that the type field is optional and defaults to the localised term technical report."); - case Unpublished -> Localization.lang("A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk."); - case BookInBook -> Localization.lang("This type is similar to \"InBook\" but intended for works originally published as a stand-alone book."); - case InReference -> Localization.lang("An article in a work of reference. This is a more specific variant of the generic \"InCollection\" entry type."); - case MvBook -> Localization.lang("A multi-volume \"Book\"."); - case MvCollection -> Localization.lang("A multi-volume \"Collection\"."); - case MvProceedings -> Localization.lang("A multi-volume \"Proceedings\" entry."); - case MvReference -> Localization.lang("A multi-volume \"Reference\" entry. The standard styles will treat this entry type as an alias for \"MvCollection\"."); - case Online -> Localization.lang("This entry type is intended for sources such as web sites which are intrinsically online resources."); - case Reference -> Localization.lang("A single-volume work of reference such as an encyclopedia or a dictionary."); - case Report -> Localization.lang("A technical report, research report, or white paper published by a university or some other institution."); - case Set -> Localization.lang("An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography."); - case SuppBook -> Localization.lang("Supplemental material in a \"Book\". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only."); - case SuppCollection -> Localization.lang("Supplemental material in a \"Collection\"."); - case SuppPeriodical -> Localization.lang("Supplemental material in a \"Periodical\". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title."); - case Thesis -> Localization.lang("A thesis written for an educational institution to satisfy the requirements for a degree."); - case WWW -> Localization.lang("An alias for \"Online\", provided for jurabib compatibility."); - case Software -> Localization.lang("Computer software. The standard styles will treat this entry type as an alias for \"Misc\"."); - case Dataset -> Localization.lang("A data set or a similar collection of (mostly) raw data."); + case Article -> + Localization.lang("An article in a journal, magazine, newspaper, or other periodical which forms a self-contained unit with its own title."); + case Book -> + Localization.lang("A single-volume book with one or more authors where the authors share credit for the work as a whole."); + case Booklet -> + Localization.lang("A book-like work without a formal publisher or sponsoring institution."); + case Collection -> + Localization.lang("A single-volume collection with multiple, self-contained contributions by distinct authors which have their own title. The work as a whole has no overall author but it will usually have an editor."); + case Conference -> + Localization.lang("A legacy alias for \"InProceedings\"."); + case InBook -> + Localization.lang("A part of a book which forms a self-contained unit with its own title."); + case InCollection -> + Localization.lang("A contribution to a collection which forms a self-contained unit with a distinct author and title."); + case InProceedings -> + Localization.lang("An article in a conference proceedings."); + case Manual -> + Localization.lang("Technical or other documentation, not necessarily in printed form."); + case MastersThesis -> + Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term Master's thesis."); + case Misc -> + Localization.lang("A fallback type for entries which do not fit into any other category."); + case PhdThesis -> + Localization.lang("Similar to \"Thesis\" except that the type field is optional and defaults to the localised term PhD thesis."); + case Proceedings -> + Localization.lang("A single-volume conference proceedings. This type is very similar to \"Collection\"."); + case TechReport -> + Localization.lang("Similar to \"Report\" except that the type field is optional and defaults to the localised term technical report."); + case Unpublished -> + Localization.lang("A work with an author and a title which has not been formally published, such as a manuscript or the script of a talk."); + case BookInBook -> + Localization.lang("This type is similar to \"InBook\" but intended for works originally published as a stand-alone book."); + case InReference -> + Localization.lang("An article in a work of reference. This is a more specific variant of the generic \"InCollection\" entry type."); + case MvBook -> + Localization.lang("A multi-volume \"Book\"."); + case MvCollection -> + Localization.lang("A multi-volume \"Collection\"."); + case MvProceedings -> + Localization.lang("A multi-volume \"Proceedings\" entry."); + case MvReference -> + Localization.lang("A multi-volume \"Reference\" entry. The standard styles will treat this entry type as an alias for \"MvCollection\"."); + case Online -> + Localization.lang("This entry type is intended for sources such as web sites which are intrinsically online resources."); + case Reference -> + Localization.lang("A single-volume work of reference such as an encyclopedia or a dictionary."); + case Report -> + Localization.lang("A technical report, research report, or white paper published by a university or some other institution."); + case Set -> + Localization.lang("An entry set is a group of entries which are cited as a single reference and listed as a single item in the bibliography."); + case SuppBook -> + Localization.lang("Supplemental material in a \"Book\". This type is provided for elements such as prefaces, introductions, forewords, afterwords, etc. which often have a generic title only."); + case SuppCollection -> + Localization.lang("Supplemental material in a \"Collection\"."); + case SuppPeriodical -> + Localization.lang("Supplemental material in a \"Periodical\". This type may be useful when referring to items such as regular columns, obituaries, letters to the editor, etc. which only have a generic title."); + case Thesis -> + Localization.lang("A thesis written for an educational institution to satisfy the requirements for a degree."); + case WWW -> + Localization.lang("An alias for \"Online\", provided for jurabib compatibility."); + case Software -> + Localization.lang("Computer software. The standard styles will treat this entry type as an alias for \"Misc\"."); + case Dataset -> + Localization.lang("A data set or a similar collection of (mostly) raw data."); }; } @@ -595,9 +627,9 @@ private Optional fetcherForIdentifier(Identifier id) { for (IdBasedFetcher fetcher : idFetcher.getItems()) { if ((id instanceof DOI && fetcher instanceof DoiFetcher) || (id instanceof ISBN && (fetcher instanceof IsbnFetcher) || - (id instanceof ArXivIdentifier && fetcher instanceof ArXivFetcher) || - (id instanceof RFC && fetcher instanceof RfcFetcher) || - (id instanceof SSRN && fetcher instanceof DoiFetcher))) { + (id instanceof ArXivIdentifier && fetcher instanceof ArXivFetcher) || + (id instanceof RFC && fetcher instanceof RfcFetcher) || + (id instanceof SSRN && fetcher instanceof DoiFetcher))) { return Optional.of(fetcher); } } diff --git a/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java b/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java index b3cb2d42ad2..8675547e7b8 100644 --- a/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/newentry/NewEntryViewModel.java @@ -357,9 +357,12 @@ protected Optional> call() throws FetcherException { } final PlainCitationParser parser = switch (parserChoice) { - case PlainCitationParserChoice.RULE_BASED -> new RuleBasedPlainCitationParser(); - case PlainCitationParserChoice.GROBID -> new GrobidPlainCitationParser(preferences.getGrobidPreferences(), preferences.getImportFormatPreferences()); - case PlainCitationParserChoice.LLM -> new LlmPlainCitationParser(aiService.getTemplatesService(), preferences.getImportFormatPreferences(), aiService.getChatLanguageModel()); + case PlainCitationParserChoice.RULE_BASED -> + new RuleBasedPlainCitationParser(); + case PlainCitationParserChoice.GROBID -> + new GrobidPlainCitationParser(preferences.getGrobidPreferences(), preferences.getImportFormatPreferences()); + case PlainCitationParserChoice.LLM -> + new LlmPlainCitationParser(aiService.getTemplatesService(), preferences.getImportFormatPreferences(), aiService.getChatLanguageModel()); }; final SeveralPlainCitationParser setParser = new SeveralPlainCitationParser(parser); diff --git a/jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java b/jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java index 89cc4672f70..cccaf6243c7 100644 --- a/jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java +++ b/jabgui/src/main/java/org/jabref/gui/openoffice/Bootstrap.java @@ -52,26 +52,27 @@ import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; -/** Bootstrap offers functionality to obtain a context or simply - * a service manager. - * The service manager can create a few basic services, whose implementations are: - *

      - *
    • com.sun.star.comp.loader.JavaLoader
    • - *
    • com.sun.star.comp.urlresolver.UrlResolver
    • - *
    • com.sun.star.comp.bridgefactory.BridgeFactory
    • - *
    • com.sun.star.comp.connections.Connector
    • - *
    • com.sun.star.comp.connections.Acceptor
    • - *
    • com.sun.star.comp.servicemanager.ServiceManager
    • - *
    - * - * Other services can be inserted into the service manager by - * using its XSet interface: - *
    -  *     XSet xSet = UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
    -  *     // insert the service manager
    -  *     xSet.insert( aSingleComponentFactory );
    -  * 
    -*/ +/** + * Bootstrap offers functionality to obtain a context or simply + * a service manager. + * The service manager can create a few basic services, whose implementations are: + *
      + *
    • com.sun.star.comp.loader.JavaLoader
    • + *
    • com.sun.star.comp.urlresolver.UrlResolver
    • + *
    • com.sun.star.comp.bridgefactory.BridgeFactory
    • + *
    • com.sun.star.comp.connections.Connector
    • + *
    • com.sun.star.comp.connections.Acceptor
    • + *
    • com.sun.star.comp.servicemanager.ServiceManager
    • + *
    + *

    + * Other services can be inserted into the service manager by + * using its XSet interface: + *

    + *     XSet xSet = UnoRuntime.queryInterface( XSet.class, aMultiComponentFactory );
    + *     // insert the service manager
    + *     xSet.insert( aSingleComponentFactory );
    + * 
    + */ public class Bootstrap { private static final Random RANDOM_PIPE_NAME = new Random(); diff --git a/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBase.java b/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBase.java index 483eb775220..7a4e45d18cc 100644 --- a/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBase.java +++ b/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBase.java @@ -365,15 +365,18 @@ private OOVoidResult checkStyleExistsInTheDocument(String familyName, if (internalName.isEmpty()) { String msg = switch (familyName) { - case UnoStyle.PARAGRAPH_STYLES -> Localization.lang("The %0 paragraph style '%1' is missing from the document", - labelInJstyleFile, - styleName); - case UnoStyle.CHARACTER_STYLES -> Localization.lang("The %0 character style '%1' is missing from the document", - labelInJstyleFile, - styleName); - default -> throw new IllegalArgumentException("Expected " + UnoStyle.CHARACTER_STYLES - + " or " + UnoStyle.PARAGRAPH_STYLES - + " for familyName"); + case UnoStyle.PARAGRAPH_STYLES -> + Localization.lang("The %0 paragraph style '%1' is missing from the document", + labelInJstyleFile, + styleName); + case UnoStyle.CHARACTER_STYLES -> + Localization.lang("The %0 character style '%1' is missing from the document", + labelInJstyleFile, + styleName); + default -> + throw new IllegalArgumentException("Expected " + UnoStyle.CHARACTER_STYLES + + " or " + UnoStyle.PARAGRAPH_STYLES + + " for familyName"); } + "\n" + Localization.lang("Please create it in the document or change in the file:") @@ -385,17 +388,20 @@ private OOVoidResult checkStyleExistsInTheDocument(String familyName, if (!internalName.get().equals(styleName)) { String msg = switch (familyName) { - case UnoStyle.PARAGRAPH_STYLES -> Localization.lang("The %0 paragraph style '%1' is a display name for '%2'.", - labelInJstyleFile, - styleName, - internalName.get()); - case UnoStyle.CHARACTER_STYLES -> Localization.lang("The %0 character style '%1' is a display name for '%2'.", - labelInJstyleFile, - styleName, - internalName.get()); - default -> throw new IllegalArgumentException("Expected " + UnoStyle.CHARACTER_STYLES - + " or " + UnoStyle.PARAGRAPH_STYLES - + " for familyName"); + case UnoStyle.PARAGRAPH_STYLES -> + Localization.lang("The %0 paragraph style '%1' is a display name for '%2'.", + labelInJstyleFile, + styleName, + internalName.get()); + case UnoStyle.CHARACTER_STYLES -> + Localization.lang("The %0 character style '%1' is a display name for '%2'.", + labelInJstyleFile, + styleName, + internalName.get()); + default -> + throw new IllegalArgumentException("Expected " + UnoStyle.CHARACTER_STYLES + + " or " + UnoStyle.PARAGRAPH_STYLES + + " for familyName"); } + "\n" + Localization.lang("Please use the latter in the style file below" @@ -525,14 +531,14 @@ public void guiActionApplyCitationEntries(List citationEntries) { *

    * Note: Undo does not remove or reestablish custom properties. * - * @param entries The entries to cite. - * @param bibDatabaseContext The database the entries belong to (all of them). Used when creating the citation mark. - *

    - * Consistency: for each entry in {@code entries}: looking it up in {@code syncOptions.get().databases} (if present) should yield {@code database}. - * @param style The bibliography style we are using. - * @param citationType Indicates whether it is an in-text citation, a citation in parenthesis or an invisible citation. - * @param pageInfo A single page-info for these entries. Attributed to the last entry. - * @param syncOptions Indicates whether in-text citations should be refreshed in the document. Optional.empty() indicates no refresh. Otherwise provides options for refreshing the reference list. + * @param entries The entries to cite. + * @param bibDatabaseContext The database the entries belong to (all of them). Used when creating the citation mark. + *

    + * Consistency: for each entry in {@code entries}: looking it up in {@code syncOptions.get().databases} (if present) should yield {@code database}. + * @param style The bibliography style we are using. + * @param citationType Indicates whether it is an in-text citation, a citation in parenthesis or an invisible citation. + * @param pageInfo A single page-info for these entries. Attributed to the last entry. + * @param syncOptions Indicates whether in-text citations should be refreshed in the document. Optional.empty() indicates no refresh. Otherwise provides options for refreshing the reference list. */ public void guiActionInsertEntry(List entries, BibDatabaseContext bibDatabaseContext, diff --git a/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBaseConnect.java b/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBaseConnect.java index 333c9ed3d49..79ce4e8267b 100644 --- a/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBaseConnect.java +++ b/jabgui/src/main/java/org/jabref/gui/openoffice/OOBibBaseConnect.java @@ -86,8 +86,8 @@ public static void closeOfficeConnection() { try { // get the bridge factory from the local service manager XBridgeFactory bridgeFactory = queryInterface(XBridgeFactory.class, - Bootstrap.createSimpleServiceManager() - .createInstance("com.sun.star.bridge.BridgeFactory")); + Bootstrap.createSimpleServiceManager() + .createInstance("com.sun.star.bridge.BridgeFactory")); if (bridgeFactory != null) { for (XBridge bridge : bridgeFactory.getExistingBridges()) { @@ -148,8 +148,8 @@ public String toString() { } List viewModel = list.stream() - .map(DocumentTitleViewModel::new) - .collect(Collectors.toList()); + .map(DocumentTitleViewModel::new) + .collect(Collectors.toList()); // This whole method is part of a background task when // auto-detecting instances, so we need to show dialog in FX diff --git a/jabgui/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java b/jabgui/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java index 5ee9823a118..7528ab65709 100644 --- a/jabgui/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java +++ b/jabgui/src/main/java/org/jabref/gui/openoffice/OpenOfficePanel.java @@ -662,7 +662,8 @@ private ContextMenu createSettingsPopup() { } case CitationStyle _ -> contextMenu.getItems().remove(alwaysAddCitedOnPagesText); - default -> { } + default -> { + } } }); diff --git a/jabgui/src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java b/jabgui/src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java index 2858430a06f..50372f5eb7f 100644 --- a/jabgui/src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/openoffice/StyleSelectDialogViewModel.java @@ -149,10 +149,10 @@ public OOStyle getSelectedStyle() { public void storeStylePreferences() { // save external jstyles List externalJStyles = jStyles.stream() - .map(this::toJStyle) - .filter(style -> !style.isInternalStyle()) - .map(JStyle::getPath) - .toList(); + .map(this::toJStyle) + .filter(style -> !style.isInternalStyle()) + .map(JStyle::getPath) + .toList(); openOfficePreferences.setExternalJStyles(externalJStyles); diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java b/jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java index e91f4d6bd62..7447ebcf31b 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java @@ -403,8 +403,8 @@ private JabRefGuiPreferences() { /** * @deprecated Never ever add a call to this method. There should be only one caller. - * All other usages should get the preferences passed (or injected). - * The JabRef team leaves the {@code @deprecated} annotation to have IntelliJ listing this method with a strike-through. + * All other usages should get the preferences passed (or injected). + * The JabRef team leaves the {@code @deprecated} annotation to have IntelliJ listing this method with a strike-through. */ @Deprecated public static JabRefGuiPreferences getInstance() { @@ -1169,8 +1169,8 @@ public NewEntryPreferences getNewEntryPreferences() { final int approachIndex = getInt(CREATE_ENTRY_APPROACH); NewEntryDialogTab approach = NewEntryDialogTab.values().length > approachIndex - ? NewEntryDialogTab.values()[approachIndex] - : NewEntryDialogTab.values()[0]; + ? NewEntryDialogTab.values()[approachIndex] + : NewEntryDialogTab.values()[0]; final String immediateTypeName = get(CREATE_ENTRY_IMMEDIATE_TYPE); EntryType immediateType = StandardEntryType.Article; @@ -1182,14 +1182,14 @@ public NewEntryPreferences getNewEntryPreferences() { } newEntryPreferences = new NewEntryPreferences( - approach, - getBoolean(CREATE_ENTRY_EXPAND_RECOMMENDED), - getBoolean(CREATE_ENTRY_EXPAND_OTHER), - getBoolean(CREATE_ENTRY_EXPAND_CUSTOM), - immediateType, - getBoolean(CREATE_ENTRY_ID_LOOKUP_GUESSING), - get(CREATE_ENTRY_ID_FETCHER_NAME), - get(CREATE_ENTRY_INTERPRET_PARSER_NAME)); + approach, + getBoolean(CREATE_ENTRY_EXPAND_RECOMMENDED), + getBoolean(CREATE_ENTRY_EXPAND_OTHER), + getBoolean(CREATE_ENTRY_EXPAND_CUSTOM), + immediateType, + getBoolean(CREATE_ENTRY_ID_LOOKUP_GUESSING), + get(CREATE_ENTRY_ID_FETCHER_NAME), + get(CREATE_ENTRY_INTERPRET_PARSER_NAME)); EasyBind.listen(newEntryPreferences.latestApproachProperty(), (_, _, newValue) -> putInt(CREATE_ENTRY_APPROACH, List.of(NewEntryDialogTab.values()).indexOf(newValue))); EasyBind.listen(newEntryPreferences.typesRecommendedExpandedProperty(), (_, _, newValue) -> putBoolean(CREATE_ENTRY_EXPAND_RECOMMENDED, newValue)); diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/PreferenceTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/PreferenceTabViewModel.java index 393db8e1c03..48fb0c634bf 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/PreferenceTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/PreferenceTabViewModel.java @@ -7,7 +7,7 @@ public interface PreferenceTabViewModel { /** * This method is called when the dialog is opened, or if it is made * visible after being hidden. The tab should update all its values. - * + *

    * This is the ONLY PLACE to set values for the fields in the tab. It * is ILLEGAL to set values only at construction time, because the dialog * will be reused and updated. diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/PreferencesSearchHandler.java b/jabgui/src/main/java/org/jabref/gui/preferences/PreferencesSearchHandler.java index 689b303f883..06f5ffcc469 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/PreferencesSearchHandler.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/PreferencesSearchHandler.java @@ -56,8 +56,8 @@ public void filterTabs(String query) { String searchQuery = query.toLowerCase(Locale.ROOT); List matchedTabs = preferenceTabs.stream() - .filter(tab -> tabMatchesQuery(tab, searchQuery)) - .collect(Collectors.toList()); + .filter(tab -> tabMatchesQuery(tab, searchQuery)) + .collect(Collectors.toList()); filteredPreferenceTabs.setAll(matchedTabs); } @@ -65,7 +65,7 @@ public void filterTabs(String query) { /** * Checks if a tab matches the given search query either by its name or by its controls. * - * @param tab The preferences tab to check. + * @param tab The preferences tab to check. * @param query The search query. * @return True if the tab matches the query. */ @@ -73,10 +73,10 @@ private boolean tabMatchesQuery(PreferencesTab tab, String query) { boolean tabNameMatches = tab.getTabName().toLowerCase(Locale.ROOT).contains(query); boolean controlMatches = preferenceTabsControls.get(tab).stream() - .filter(control -> controlMatchesQuery(control, query)) - .peek(this::highlightControl) - .findAny() - .isPresent(); + .filter(control -> controlMatchesQuery(control, query)) + .peek(this::highlightControl) + .findAny() + .isPresent(); return tabNameMatches || controlMatches; } @@ -102,8 +102,8 @@ private boolean controlMatchesQuery(Control control, String query) { if (control instanceof ComboBox comboBox && !comboBox.getItems().isEmpty()) { return comboBox.getItems().stream() - .map(Object::toString) - .anyMatch(item -> item.toLowerCase(Locale.ROOT).contains(query)); + .map(Object::toString) + .anyMatch(item -> item.toLowerCase(Locale.ROOT).contains(query)); } if (control instanceof TextField textField && textField.getText() != null) { @@ -160,9 +160,9 @@ private ArrayListMultimap getPreferenceTabsControlsMap( /** * Recursively scans nodes and collects all controls. * - * @param node The current node being scanned. + * @param node The current node being scanned. * @param controlMap Map storing tabs and their corresponding controls. - * @param tab The PreferencesTab associated with the current node. + * @param tab The PreferencesTab associated with the current node. */ private void scanControls(Node node, ArrayListMultimap controlMap, PreferencesTab tab) { if (node instanceof Control control) { diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java index 87e62180be7..68861d4383b 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/ai/AiTabViewModel.java @@ -132,7 +132,7 @@ public AiTabViewModel(CliPreferences preferences) { }); this.customizeExpertSettings.addListener((_, _, newValue) -> - disableExpertSettings.set(!newValue || !enableAi.get()) + disableExpertSettings.set(!newValue || !enableAi.get()) ); this.selectedAiProvider.addListener((_, oldValue, newValue) -> { @@ -168,7 +168,7 @@ public AiTabViewModel(CliPreferences preferences) { huggingFaceApiKey.set(currentApiKey.get()); huggingFaceApiBaseUrl.set(currentApiBaseUrl.get()); } - case GPT4ALL-> { + case GPT4ALL -> { gpt4AllChatModel.set(oldChatModel); gpt4AllApiKey.set(currentApiKey.get()); gpt4AllApiBaseUrl.set(currentApiBaseUrl.get()); @@ -211,11 +211,16 @@ public AiTabViewModel(CliPreferences preferences) { } switch (selectedAiProvider.get()) { - case OPEN_AI -> openAiChatModel.set(newValue); - case MISTRAL_AI -> mistralAiChatModel.set(newValue); - case GEMINI -> geminiChatModel.set(newValue); - case HUGGING_FACE -> huggingFaceChatModel.set(newValue); - case GPT4ALL -> gpt4AllChatModel.set(newValue); + case OPEN_AI -> + openAiChatModel.set(newValue); + case MISTRAL_AI -> + mistralAiChatModel.set(newValue); + case GEMINI -> + geminiChatModel.set(newValue); + case HUGGING_FACE -> + huggingFaceChatModel.set(newValue); + case GPT4ALL -> + gpt4AllChatModel.set(newValue); } contextWindowSize.set(AiDefaultPreferences.getContextWindowSize(selectedAiProvider.get(), newValue)); @@ -223,21 +228,31 @@ public AiTabViewModel(CliPreferences preferences) { this.currentApiKey.addListener((_, _, newValue) -> { switch (selectedAiProvider.get()) { - case OPEN_AI -> openAiApiKey.set(newValue); - case MISTRAL_AI -> mistralAiApiKey.set(newValue); - case GEMINI -> geminiAiApiKey.set(newValue); - case HUGGING_FACE -> huggingFaceApiKey.set(newValue); - case GPT4ALL -> gpt4AllApiKey.set(newValue); + case OPEN_AI -> + openAiApiKey.set(newValue); + case MISTRAL_AI -> + mistralAiApiKey.set(newValue); + case GEMINI -> + geminiAiApiKey.set(newValue); + case HUGGING_FACE -> + huggingFaceApiKey.set(newValue); + case GPT4ALL -> + gpt4AllApiKey.set(newValue); } }); this.currentApiBaseUrl.addListener((_, _, newValue) -> { switch (selectedAiProvider.get()) { - case OPEN_AI -> openAiApiBaseUrl.set(newValue); - case MISTRAL_AI -> mistralAiApiBaseUrl.set(newValue); - case GEMINI -> geminiApiBaseUrl.set(newValue); - case HUGGING_FACE -> huggingFaceApiBaseUrl.set(newValue); - case GPT4ALL -> gpt4AllApiBaseUrl.set(newValue); + case OPEN_AI -> + openAiApiBaseUrl.set(newValue); + case MISTRAL_AI -> + mistralAiApiBaseUrl.set(newValue); + case GEMINI -> + geminiApiBaseUrl.set(newValue); + case HUGGING_FACE -> + huggingFaceApiBaseUrl.set(newValue); + case GPT4ALL -> + gpt4AllApiBaseUrl.set(newValue); } }); diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/autocompletion/AutoCompletionTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/autocompletion/AutoCompletionTabViewModel.java index 125b1a7b830..d2ac844aeec 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/autocompletion/AutoCompletionTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/autocompletion/AutoCompletionTabViewModel.java @@ -50,9 +50,12 @@ public void setValues() { } switch (autoCompletePreferences.getFirstNameMode()) { - case ONLY_ABBREVIATED -> firstNameModeAbbreviatedProperty.setValue(true); - case ONLY_FULL -> firstNameModeFullProperty.setValue(true); - default -> firstNameModeBothProperty.setValue(true); + case ONLY_ABBREVIATED -> + firstNameModeAbbreviatedProperty.setValue(true); + case ONLY_FULL -> + firstNameModeFullProperty.setValue(true); + default -> + firstNameModeBothProperty.setValue(true); } } diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTabViewModel.java index eab2fc87d62..9554ab2fcdb 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/CustomEntryTypesTabViewModel.java @@ -44,7 +44,7 @@ public class CustomEntryTypesTabViewModel implements PreferenceTabViewModel { private final ObjectProperty selectedEntryType = new SimpleObjectProperty<>(); private final StringProperty entryTypeToAdd = new SimpleStringProperty(""); private final ObjectProperty newFieldToAdd = new SimpleObjectProperty<>(); - private final ObservableList entryTypesWithFields = FXCollections.observableArrayList(extractor -> new Observable[]{extractor.entryType(), extractor.fields()}); + private final ObservableList entryTypesWithFields = FXCollections.observableArrayList(extractor -> new Observable[] {extractor.entryType(), extractor.fields()}); private final List entryTypesToDelete = new ArrayList<>(); private final CliPreferences preferences; diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/EntryTypeViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/EntryTypeViewModel.java index 56525a2877b..1f1f432897b 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/EntryTypeViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/customentrytypes/EntryTypeViewModel.java @@ -23,11 +23,11 @@ public class EntryTypeViewModel { public EntryTypeViewModel(BibEntryType entryType, Predicate isMultiline) { this.entryType.set(entryType); List allFieldsForType = entryType.getAllBibFields() - .stream().map(bibField -> new FieldViewModel(bibField.field(), - entryType.isRequired(bibField.field()) ? Mandatory.REQUIRED : Mandatory.OPTIONAL, - bibField.priority(), - isMultiline.test(bibField.field()))) - .collect(Collectors.toList()); + .stream().map(bibField -> new FieldViewModel(bibField.field(), + entryType.isRequired(bibField.field()) ? Mandatory.REQUIRED : Mandatory.OPTIONAL, + bibField.priority(), + isMultiline.test(bibField.field()))) + .collect(Collectors.toList()); fields = FXCollections.observableArrayList(allFieldsForType); } diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/export/ExportTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/export/ExportTabViewModel.java index 00717280eaf..3760dd37b8c 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/export/ExportTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/export/ExportTabViewModel.java @@ -36,9 +36,12 @@ public ExportTabViewModel(ExportPreferences exportPreferences) { public void setValues() { SaveOrder exportSaveOrder = exportPreferences.getExportSaveOrder(); switch (exportSaveOrder.getOrderType()) { - case SPECIFIED -> exportInSpecifiedOrderProperty.setValue(true); - case ORIGINAL -> exportInOriginalProperty.setValue(true); - case TABLE -> exportInTableOrderProperty.setValue(true); + case SPECIFIED -> + exportInSpecifiedOrderProperty.setValue(true); + case ORIGINAL -> + exportInOriginalProperty.setValue(true); + case TABLE -> + exportInTableOrderProperty.setValue(true); } sortCriteriaProperty.addAll(exportSaveOrder.getSortCriteria().stream() .map(SortCriterionViewModel::new) diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/external/ExternalTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/external/ExternalTabViewModel.java index cc00d452bdd..6a816f5ecb6 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/external/ExternalTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/external/ExternalTabViewModel.java @@ -166,9 +166,9 @@ public void pushToApplicationSettings() { dialogPane.setContent(settings.getSettingsPane()); dialogService.showCustomDialogAndWait( - Localization.lang("Application settings"), - dialogPane, - ButtonType.OK, ButtonType.CANCEL) + Localization.lang("Application settings"), + dialogPane, + ButtonType.OK, ButtonType.CANCEL) .ifPresent(btn -> { if (btn == ButtonType.OK) { settings.storeSettings(); diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java index ad451dba57e..6d5093516c5 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/keybindings/KeyBindingsTabViewModel.java @@ -83,7 +83,7 @@ public void filterValues(String term) { * Searches for the term in the keybinding's localization, category, or key combination * * @param keyBinding keybinding to search in - * @param searchTerm term to search for + * @param searchTerm term to search for * @return true if the term is found in the keybinding */ private boolean matchesSearchTerm(KeyBinding keyBinding, String searchTerm) { diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java index 313274508f6..f1c81db708f 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/linkedfiles/LinkedFilesTabViewModel.java @@ -93,9 +93,12 @@ public void setValues() { // Autolink preferences switch (autoLinkPreferences.getCitationKeyDependency()) { - case START -> autolinkFileStartsBibtexProperty.setValue(true); - case EXACT -> autolinkFileExactBibtexProperty.setValue(true); - case REGEX -> autolinkUseRegexProperty.setValue(true); + case START -> + autolinkFileStartsBibtexProperty.setValue(true); + case EXACT -> + autolinkFileExactBibtexProperty.setValue(true); + case REGEX -> + autolinkUseRegexProperty.setValue(true); } autolinkRegexKeyProperty.setValue(autoLinkPreferences.getRegularExpression()); diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/network/NetworkTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/network/NetworkTabViewModel.java index 3db20e5be94..11f07fe6c70 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/network/NetworkTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/network/NetworkTabViewModel.java @@ -59,7 +59,6 @@ public class NetworkTabViewModel implements PreferenceTabViewModel { private final DialogService dialogService; private final CliPreferences preferences; - private final ProxyPreferences proxyPreferences; private final ProxyPreferences backupProxyPreferences; private final InternalPreferences internalPreferences; diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java b/jabgui/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java index 733dcec512f..a30e7437077 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/protectedterms/ProtectedTermsTab.java @@ -121,18 +121,26 @@ public ContextAction(StandardActions command, ProtectedTermsListItemModel itemMo this.executable.bind(BindingsHelper.constantOf( switch (command) { - case EDIT_LIST, REMOVE_LIST, RELOAD_LIST -> !itemModel.getTermsList().isInternalList(); - default -> true; + case EDIT_LIST, + REMOVE_LIST, + RELOAD_LIST -> + !itemModel.getTermsList().isInternalList(); + default -> + true; })); } @Override public void execute() { switch (command) { - case EDIT_LIST -> viewModel.edit(itemModel); - case VIEW_LIST -> viewModel.displayContent(itemModel); - case REMOVE_LIST -> viewModel.removeList(itemModel); - case RELOAD_LIST -> viewModel.reloadList(itemModel); + case EDIT_LIST -> + viewModel.edit(itemModel); + case VIEW_LIST -> + viewModel.displayContent(itemModel); + case REMOVE_LIST -> + viewModel.removeList(itemModel); + case RELOAD_LIST -> + viewModel.reloadList(itemModel); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/preferences/table/TableTabViewModel.java b/jabgui/src/main/java/org/jabref/gui/preferences/table/TableTabViewModel.java index 12ae933265e..4625ad54f8e 100644 --- a/jabgui/src/main/java/org/jabref/gui/preferences/table/TableTabViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/preferences/table/TableTabViewModel.java @@ -149,16 +149,23 @@ public void setValues() { } switch (nameDisplayPreferences.getDisplayStyle()) { - case NATBIB -> namesNatbibProperty.setValue(true); - case AS_IS -> nameAsIsProperty.setValue(true); - case FIRSTNAME_LASTNAME -> nameFirstLastProperty.setValue(true); - case LASTNAME_FIRSTNAME -> nameLastFirstProperty.setValue(true); + case NATBIB -> + namesNatbibProperty.setValue(true); + case AS_IS -> + nameAsIsProperty.setValue(true); + case FIRSTNAME_LASTNAME -> + nameFirstLastProperty.setValue(true); + case LASTNAME_FIRSTNAME -> + nameLastFirstProperty.setValue(true); } switch (nameDisplayPreferences.getAbbreviationStyle()) { - case FULL -> abbreviationEnabledProperty.setValue(true); - case LASTNAME_ONLY -> abbreviationLastNameOnlyProperty.setValue(true); - case NONE -> abbreviationDisabledProperty.setValue(true); + case FULL -> + abbreviationEnabledProperty.setValue(true); + case LASTNAME_ONLY -> + abbreviationLastNameOnlyProperty.setValue(true); + case NONE -> + abbreviationDisabledProperty.setValue(true); } } diff --git a/jabgui/src/main/java/org/jabref/gui/preview/ClipboardContentGenerator.java b/jabgui/src/main/java/org/jabref/gui/preview/ClipboardContentGenerator.java index b3c2ddb774b..930b7f07e97 100644 --- a/jabgui/src/main/java/org/jabref/gui/preview/ClipboardContentGenerator.java +++ b/jabgui/src/main/java/org/jabref/gui/preview/ClipboardContentGenerator.java @@ -35,9 +35,12 @@ public ClipboardContent generate(List selectedEntries, CitationStyleOu if (previewPreferences.getSelectedPreviewLayout() instanceof CitationStylePreviewLayout) { // if it's generated by a citation style take care of each output format return switch (outputFormat) { - case HTML -> processHtml(citations); - case TEXT -> processText(citations); - case MARKDOWN -> processMarkdown(citations); + case HTML -> + processHtml(citations); + case TEXT -> + processText(citations); + case MARKDOWN -> + processMarkdown(citations); }; } else { // if it is not a citation style take care of the preview diff --git a/jabgui/src/main/java/org/jabref/gui/preview/PreviewViewer.java b/jabgui/src/main/java/org/jabref/gui/preview/PreviewViewer.java index 06f7060019c..ae05d601ac8 100644 --- a/jabgui/src/main/java/org/jabref/gui/preview/PreviewViewer.java +++ b/jabgui/src/main/java/org/jabref/gui/preview/PreviewViewer.java @@ -55,26 +55,26 @@ public class PreviewViewer extends ScrollPane implements InvalidationListener { // https://stackoverflow.com/questions/5669448/get-selected-texts-html-in-div/5670825#5670825 private static final String JS_GET_SELECTION_HTML_SCRIPT = """ - function getSelectionHtml() { - var html = ""; - if (typeof window.getSelection != "undefined") { - var sel = window.getSelection(); - if (sel.rangeCount) { - var container = document.createElement("div"); - for (var i = 0, len = sel.rangeCount; i < len; ++i) { - container.appendChild(sel.getRangeAt(i).cloneContents()); + function getSelectionHtml() { + var html = ""; + if (typeof window.getSelection != "undefined") { + var sel = window.getSelection(); + if (sel.rangeCount) { + var container = document.createElement("div"); + for (var i = 0, len = sel.rangeCount; i < len; ++i) { + container.appendChild(sel.getRangeAt(i).cloneContents()); + } + html = container.innerHTML; + } + } else if (typeof document.selection != "undefined") { + if (document.selection.type == "Text") { + html = document.selection.createRange().htmlText; } - html = container.innerHTML; - } - } else if (typeof document.selection != "undefined") { - if (document.selection.type == "Text") { - html = document.selection.createRange().htmlText; } + return html; } - return html; - } - getSelectionHtml(); - """; + getSelectionHtml(); + """; private final ClipBoardManager clipBoardManager; private final DialogService dialogService; diff --git a/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplication.java b/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplication.java index d776f344f57..8a658f9ff43 100644 --- a/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplication.java +++ b/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplication.java @@ -29,6 +29,6 @@ default Action getAction() { } default GuiPushToApplicationSettings getSettings(PushToApplication application, DialogService dialogService, FilePreferences filePreferences, PushToApplicationPreferences pushToApplicationPreferences) { - return new GuiPushToApplicationSettings(application, dialogService, filePreferences, pushToApplicationPreferences); + return new GuiPushToApplicationSettings(application, dialogService, filePreferences, pushToApplicationPreferences); } } diff --git a/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplicationCommand.java b/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplicationCommand.java index 5523e11cc16..b4ccfd84e0f 100644 --- a/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplicationCommand.java +++ b/jabgui/src/main/java/org/jabref/gui/push/GuiPushToApplicationCommand.java @@ -72,9 +72,9 @@ public void registerReconfigurable(Object node) { private void setApplication(String applicationName) { final ActionFactory factory = new ActionFactory(); GuiPushToApplication application = GuiPushToApplications.getGUIApplicationByName( - applicationName, - dialogService, - preferences.getPushToApplicationPreferences()) + applicationName, + dialogService, + preferences.getPushToApplicationPreferences()) .orElseGet(() -> new GuiPushToEmacs(dialogService, preferences.getPushToApplicationPreferences())); preferences.getPushToApplicationPreferences().setActiveApplicationName(application.getDisplayName()); diff --git a/jabgui/src/main/java/org/jabref/gui/search/SearchTextField.java b/jabgui/src/main/java/org/jabref/gui/search/SearchTextField.java index 4cb2b060ba6..9dfe3fbc013 100644 --- a/jabgui/src/main/java/org/jabref/gui/search/SearchTextField.java +++ b/jabgui/src/main/java/org/jabref/gui/search/SearchTextField.java @@ -29,8 +29,8 @@ public static CustomTextField create(KeyBindingRepository keyBindingRepository) // Otherwise, we would have to add a new class for this and handle the case hitting that class in TextInputKeyBindings if (keyBindingRepository.matches(event, KeyBinding.CLEAR_SEARCH)) { - textField.clear(); - event.consume(); + textField.clear(); + event.consume(); } }); diff --git a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePane.java b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePane.java index 1a9ccd5e2c8..a50d1b2082d 100644 --- a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePane.java +++ b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePane.java @@ -64,13 +64,13 @@ public SidePane(LibraryTabContainer tabContainer, updateView(); } - private void updateView() { + private void updateView() { getChildren().clear(); - for (SidePaneType type : stateManager.getVisibleSidePaneComponents()) { - SidePaneComponent view = viewModel.getSidePaneComponent(type); - getChildren().add(view); - } - } + for (SidePaneType type : stateManager.getVisibleSidePaneComponents()) { + SidePaneComponent view = viewModel.getSidePaneComponent(type); + getChildren().add(view); + } + } public BooleanBinding paneVisibleBinding(SidePaneType pane) { BooleanBinding visibility = Bindings.createBooleanBinding( diff --git a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneContentFactory.java b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneContentFactory.java index b8d1dfdc967..a02a28d78c1 100644 --- a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneContentFactory.java +++ b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneContentFactory.java @@ -64,35 +64,38 @@ public SidePaneContentFactory(LibraryTabContainer tabContainer, public Node create(SidePaneType sidePaneType) { return switch (sidePaneType) { - case GROUPS -> new GroupTreeView( - taskExecutor, - stateManager, - adaptVisibleTabs, - preferences, - dialogService, - aiService, - undoManager, - fileUpdateMonitor); - case OPEN_OFFICE -> new OpenOfficePanel( - tabContainer, - preferences, - preferences.getOpenOfficePreferences(Injector.instantiateModelOrService(JournalAbbreviationRepository.class)), - preferences.getExternalApplicationsPreferences(), - preferences.getLayoutFormatterPreferences(), - preferences.getCitationKeyPatternPreferences(), - abbreviationRepository, - (UiTaskExecutor) taskExecutor, - dialogService, - aiService, - stateManager, - fileUpdateMonitor, - entryTypesManager, - clipBoardManager, - undoManager).getContent(); - case WEB_SEARCH -> new WebSearchPaneView( - preferences, - dialogService, - stateManager); + case GROUPS -> + new GroupTreeView( + taskExecutor, + stateManager, + adaptVisibleTabs, + preferences, + dialogService, + aiService, + undoManager, + fileUpdateMonitor); + case OPEN_OFFICE -> + new OpenOfficePanel( + tabContainer, + preferences, + preferences.getOpenOfficePreferences(Injector.instantiateModelOrService(JournalAbbreviationRepository.class)), + preferences.getExternalApplicationsPreferences(), + preferences.getLayoutFormatterPreferences(), + preferences.getCitationKeyPatternPreferences(), + abbreviationRepository, + (UiTaskExecutor) taskExecutor, + dialogService, + aiService, + stateManager, + fileUpdateMonitor, + entryTypesManager, + clipBoardManager, + undoManager).getContent(); + case WEB_SEARCH -> + new WebSearchPaneView( + preferences, + dialogService, + stateManager); }; } } diff --git a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneViewModel.java b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneViewModel.java index ecbeac0e2b9..76b8065059f 100644 --- a/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/sidepane/SidePaneViewModel.java @@ -88,18 +88,21 @@ protected SidePaneComponent getSidePaneComponent(SidePaneType pane) { SidePaneComponent sidePaneComponent = sidePaneComponentLookup.get(pane); if (sidePaneComponent == null) { sidePaneComponent = switch (pane) { - case GROUPS -> new GroupsSidePaneComponent( - new ClosePaneAction(pane), - new MoveUpAction(pane), - new MoveDownAction(pane), - sidePaneContentFactory, - preferences.getGroupsPreferences(), - dialogService); - case WEB_SEARCH, OPEN_OFFICE -> new SidePaneComponent(pane, - new ClosePaneAction(pane), - new MoveUpAction(pane), - new MoveDownAction(pane), - sidePaneContentFactory); + case GROUPS -> + new GroupsSidePaneComponent( + new ClosePaneAction(pane), + new MoveUpAction(pane), + new MoveDownAction(pane), + sidePaneContentFactory, + preferences.getGroupsPreferences(), + dialogService); + case WEB_SEARCH, + OPEN_OFFICE -> + new SidePaneComponent(pane, + new ClosePaneAction(pane), + new MoveUpAction(pane), + new MoveDownAction(pane), + sidePaneContentFactory); }; sidePaneComponentLookup.put(pane, sidePaneComponent); } diff --git a/jabgui/src/main/java/org/jabref/gui/slr/ExistingStudySearchAction.java b/jabgui/src/main/java/org/jabref/gui/slr/ExistingStudySearchAction.java index 809d7ba7a76..e1d66d6e074 100644 --- a/jabgui/src/main/java/org/jabref/gui/slr/ExistingStudySearchAction.java +++ b/jabgui/src/main/java/org/jabref/gui/slr/ExistingStudySearchAction.java @@ -41,7 +41,7 @@ public class ExistingStudySearchAction extends SimpleCommand { private final Supplier openDatabaseActionSupplier; /** - * @param tabContainer Required to close the tab before the study is updated + * @param tabContainer Required to close the tab before the study is updated * @param openDatabaseActionSupplier Required to open the tab after the study is executed */ public ExistingStudySearchAction( diff --git a/jabgui/src/main/java/org/jabref/gui/slr/ManageStudyDefinitionView.java b/jabgui/src/main/java/org/jabref/gui/slr/ManageStudyDefinitionView.java index e2de7631aae..c7fe540cccf 100644 --- a/jabgui/src/main/java/org/jabref/gui/slr/ManageStudyDefinitionView.java +++ b/jabgui/src/main/java/org/jabref/gui/slr/ManageStudyDefinitionView.java @@ -103,7 +103,7 @@ public ManageStudyDefinitionView(Path pathToStudyDataDirectory) { /** * This is used to edit an existing study. * - * @param study the study to edit + * @param study the study to edit * @param studyDirectory the directory of the study */ public ManageStudyDefinitionView(Study study, Path studyDirectory) { @@ -128,10 +128,10 @@ private void setupSaveSurveyButton(boolean isEdit) { saveSurveyButton.disableProperty().bind(Bindings.or(Bindings.or(Bindings.or(Bindings.or(Bindings.or( Bindings.isEmpty(viewModel.getQueries()), Bindings.isEmpty(viewModel.getCatalogs())), - Bindings.isEmpty(viewModel.getAuthors())), - viewModel.getTitle().isEmpty()), - viewModel.getDirectory().isEmpty()), - directoryWarning.visibleProperty())); + Bindings.isEmpty(viewModel.getAuthors())), + viewModel.getTitle().isEmpty()), + viewModel.getDirectory().isEmpty()), + directoryWarning.visibleProperty())); setResultConverter(button -> { if (button == saveSurveyButtonType) { diff --git a/jabgui/src/main/java/org/jabref/gui/slr/StartNewStudyAction.java b/jabgui/src/main/java/org/jabref/gui/slr/StartNewStudyAction.java index 27cc961e3db..58694e310e3 100644 --- a/jabgui/src/main/java/org/jabref/gui/slr/StartNewStudyAction.java +++ b/jabgui/src/main/java/org/jabref/gui/slr/StartNewStudyAction.java @@ -28,9 +28,9 @@ *

  • Let the user input meta data for the study.
  • *
  • Let JabRef do the crawling afterwards.
  • * - * + *

    * Needs to inherit {@link ExistingStudySearchAction}, because that action implements the real crawling. - * + *

    * There is the hook {@link StartNewStudyAction#crawlPreparation(Path)}, which is used by {@link ExistingStudySearchAction#crawl()}. */ public class StartNewStudyAction extends ExistingStudySearchAction { diff --git a/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldValueViewModel.java b/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldValueViewModel.java index e2d3ffda9a6..33f587bb204 100644 --- a/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldValueViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldValueViewModel.java @@ -32,43 +32,75 @@ public String getMenuString() { public String getToolTipText() { return switch (value) { - case PRINTED -> Localization.lang("Toggle print status"); - case CLEAR_PRIORITY -> Localization.lang("No priority information"); - case PRIORITY_HIGH -> Localization.lang("Priority high"); - case PRIORITY_MEDIUM -> Localization.lang("Priority medium"); - case PRIORITY_LOW -> Localization.lang("Priority low"); - case QUALITY_ASSURED -> Localization.lang("Toggle quality assured"); - case CLEAR_RANK -> Localization.lang("No rank information"); - case RANK_1 -> Localization.lang("One star"); - case RANK_2 -> Localization.lang("Two stars"); - case RANK_3 -> Localization.lang("Three stars"); - case RANK_4 -> Localization.lang("Four stars"); - case RANK_5 -> Localization.lang("Five stars"); - case CLEAR_READ_STATUS -> Localization.lang("No read status information"); - case READ -> Localization.lang("Read status read"); - case SKIMMED -> Localization.lang("Read status skimmed"); - case RELEVANT -> Localization.lang("Toggle relevance"); + case PRINTED -> + Localization.lang("Toggle print status"); + case CLEAR_PRIORITY -> + Localization.lang("No priority information"); + case PRIORITY_HIGH -> + Localization.lang("Priority high"); + case PRIORITY_MEDIUM -> + Localization.lang("Priority medium"); + case PRIORITY_LOW -> + Localization.lang("Priority low"); + case QUALITY_ASSURED -> + Localization.lang("Toggle quality assured"); + case CLEAR_RANK -> + Localization.lang("No rank information"); + case RANK_1 -> + Localization.lang("One star"); + case RANK_2 -> + Localization.lang("Two stars"); + case RANK_3 -> + Localization.lang("Three stars"); + case RANK_4 -> + Localization.lang("Four stars"); + case RANK_5 -> + Localization.lang("Five stars"); + case CLEAR_READ_STATUS -> + Localization.lang("No read status information"); + case READ -> + Localization.lang("Read status read"); + case SKIMMED -> + Localization.lang("Read status skimmed"); + case RELEVANT -> + Localization.lang("Toggle relevance"); }; } public Action getAction() { return switch (value) { - case PRINTED -> StandardActions.TOGGLE_PRINTED; - case CLEAR_PRIORITY -> StandardActions.CLEAR_PRIORITY; - case PRIORITY_HIGH -> StandardActions.PRIORITY_HIGH; - case PRIORITY_MEDIUM -> StandardActions.PRIORITY_MEDIUM; - case PRIORITY_LOW -> StandardActions.PRIORITY_LOW; - case QUALITY_ASSURED -> StandardActions.QUALITY_ASSURED; - case CLEAR_RANK -> StandardActions.CLEAR_RANK; - case RANK_1 -> StandardActions.RANK_1; - case RANK_2 -> StandardActions.RANK_2; - case RANK_3 -> StandardActions.RANK_3; - case RANK_4 -> StandardActions.RANK_4; - case RANK_5 -> StandardActions.RANK_5; - case CLEAR_READ_STATUS -> StandardActions.CLEAR_READ_STATUS; - case READ -> StandardActions.READ; - case SKIMMED -> StandardActions.SKIMMED; - case RELEVANT -> StandardActions.RELEVANT; + case PRINTED -> + StandardActions.TOGGLE_PRINTED; + case CLEAR_PRIORITY -> + StandardActions.CLEAR_PRIORITY; + case PRIORITY_HIGH -> + StandardActions.PRIORITY_HIGH; + case PRIORITY_MEDIUM -> + StandardActions.PRIORITY_MEDIUM; + case PRIORITY_LOW -> + StandardActions.PRIORITY_LOW; + case QUALITY_ASSURED -> + StandardActions.QUALITY_ASSURED; + case CLEAR_RANK -> + StandardActions.CLEAR_RANK; + case RANK_1 -> + StandardActions.RANK_1; + case RANK_2 -> + StandardActions.RANK_2; + case RANK_3 -> + StandardActions.RANK_3; + case RANK_4 -> + StandardActions.RANK_4; + case RANK_5 -> + StandardActions.RANK_5; + case CLEAR_READ_STATUS -> + StandardActions.CLEAR_READ_STATUS; + case READ -> + StandardActions.READ; + case SKIMMED -> + StandardActions.SKIMMED; + case RELEVANT -> + StandardActions.RELEVANT; }; } } diff --git a/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldViewModel.java b/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldViewModel.java index e2f4387bb39..ea76a8b9861 100644 --- a/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/specialfields/SpecialFieldViewModel.java @@ -65,12 +65,18 @@ public String getLocalization() { public Action getAction() { return switch (field) { - case PRINTED -> StandardActions.PRINTED; - case PRIORITY -> StandardActions.PRIORITY; - case QUALITY -> StandardActions.QUALITY; - case RANKING -> StandardActions.RANKING; - case READ_STATUS -> StandardActions.READ_STATUS; - case RELEVANCE -> StandardActions.RELEVANCE; + case PRINTED -> + StandardActions.PRINTED; + case PRIORITY -> + StandardActions.PRIORITY; + case QUALITY -> + StandardActions.QUALITY; + case RANKING -> + StandardActions.RANKING; + case READ_STATUS -> + StandardActions.READ_STATUS; + case RELEVANCE -> + StandardActions.RELEVANCE; }; } diff --git a/jabgui/src/main/java/org/jabref/gui/theme/StyleSheetFile.java b/jabgui/src/main/java/org/jabref/gui/theme/StyleSheetFile.java index 515f37854ed..ee1cecd07c1 100644 --- a/jabgui/src/main/java/org/jabref/gui/theme/StyleSheetFile.java +++ b/jabgui/src/main/java/org/jabref/gui/theme/StyleSheetFile.java @@ -20,17 +20,17 @@ final class StyleSheetFile extends StyleSheet { /** * A size limit above which Theme will not attempt to keep a data-embedded URL in memory for the CSS. - * + *

    * It's tolerable for CSS to exceed this limit; the functional benefit of the encoded CSS is in some edge * case error handling. Specifically, having a reference to a data-embedded URL means that the Preview Viewer * isn't impacted if the source CSS file is removed while the application is running. - * + *

    * If the CSS is over this limit, then the user won't see any functional impact, as long as the file exists. Only if * it becomes unavailable, might there be some impact. First, the Preview Viewer when created might not be themed. * Second, there is a very small chance of uncaught exceptions. Theme makes a best effort to avoid this: * it checks for CSS file existence before passing it to the Preview Viewer for theming. Still, as file existence * checks are immediately out of date, it can't be perfectly ruled out. - * + *

    * At the time of writing this comment: * *

      @@ -39,9 +39,9 @@ final class StyleSheetFile extends StyleSheet { *
    • The dark custom theme in the Jabref documentation is 2k, see * Custom themes
    • *
    - * + *

    * So realistic custom themes will fit comfortably within 48k, even if they are modified copies of the base theme. - * + *

    * Note that Base-64 encoding will increase the memory footprint of the URL by a third. */ static final int MAX_IN_MEMORY_CSS_LENGTH = 48000; diff --git a/jabgui/src/main/java/org/jabref/gui/theme/Theme.java b/jabgui/src/main/java/org/jabref/gui/theme/Theme.java index 03e6e414aed..f8a4cc0f496 100644 --- a/jabgui/src/main/java/org/jabref/gui/theme/Theme.java +++ b/jabgui/src/main/java/org/jabref/gui/theme/Theme.java @@ -40,7 +40,7 @@ public Theme(String name) { } } else { this.additionalStylesheet = StyleSheet.create(name); - if (this.additionalStylesheet.isPresent()) { + if (this.additionalStylesheet.isPresent()) { this.type = Type.CUSTOM; this.name = name; } else { diff --git a/jabgui/src/main/java/org/jabref/gui/theme/ThemeTypes.java b/jabgui/src/main/java/org/jabref/gui/theme/ThemeTypes.java index 73523ae9c47..a68bc3b3e37 100644 --- a/jabgui/src/main/java/org/jabref/gui/theme/ThemeTypes.java +++ b/jabgui/src/main/java/org/jabref/gui/theme/ThemeTypes.java @@ -4,17 +4,17 @@ public enum ThemeTypes { - LIGHT(Localization.lang("Light")), - DARK(Localization.lang("Dark")), - CUSTOM(Localization.lang("Custom...")); + LIGHT(Localization.lang("Light")), + DARK(Localization.lang("Dark")), + CUSTOM(Localization.lang("Custom...")); - private final String displayName; + private final String displayName; - ThemeTypes(String displayName) { - this.displayName = displayName; - } + ThemeTypes(String displayName) { + this.displayName = displayName; + } - public String getDisplayName() { - return displayName; - } + public String getDisplayName() { + return displayName; + } } diff --git a/jabgui/src/main/java/org/jabref/gui/util/ControlHelper.java b/jabgui/src/main/java/org/jabref/gui/util/ControlHelper.java index d998764cfb7..ba392ec62ae 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/ControlHelper.java +++ b/jabgui/src/main/java/org/jabref/gui/util/ControlHelper.java @@ -103,11 +103,11 @@ public static void removeDroppingPseudoClasses(Cell cell) { /** * If needed, truncates a given string to maxCharacters, adding ellipsisString instead. * - * @param text text which should be truncated, if needed - * @param maxCharacters maximum amount of characters which the resulting text should have, including the - * ellipsisString; if set to -1, then the default length of 75 characters will be - * used - * @param ellipsisString string which should be used for indicating the truncation + * @param text text which should be truncated, if needed + * @param maxCharacters maximum amount of characters which the resulting text should have, including the + * ellipsisString; if set to -1, then the default length of 75 characters will be + * used + * @param ellipsisString string which should be used for indicating the truncation * @param ellipsisPosition location in the given text where the truncation should be performed * @return the new, truncated string */ @@ -135,7 +135,8 @@ public static String truncateString(String text, int maxCharacters, String ellip int partialLength = (int) Math.floor((maxCharacters - ellipsisString.length()) / 2f); yield text.substring(0, partialLength) + ellipsisString + text.substring(text.length() - partialLength); } - case ENDING -> text.substring(0, maxCharacters - ellipsisString.length()) + ellipsisString; + case ENDING -> + text.substring(0, maxCharacters - ellipsisString.length()) + ellipsisString; }; } diff --git a/jabgui/src/main/java/org/jabref/gui/util/CustomTitledPaneSkin.java b/jabgui/src/main/java/org/jabref/gui/util/CustomTitledPaneSkin.java index 2b85377d971..5e6d8c6cee3 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/CustomTitledPaneSkin.java +++ b/jabgui/src/main/java/org/jabref/gui/util/CustomTitledPaneSkin.java @@ -123,8 +123,13 @@ private void adjustTitleLayout() { textGraphicTranslateBinding = Bindings.createDoubleBinding( () -> switch (getSkinnable().getAlignment()) { - case TOP_CENTER, CENTER, BOTTOM_CENTER, BASELINE_CENTER -> 0.0; - default -> -arrowButton.getWidth(); + case TOP_CENTER, + CENTER, + BOTTOM_CENTER, + BASELINE_CENTER -> + 0.0; + default -> + -arrowButton.getWidth(); }, getSkinnable().alignmentProperty(), arrowButton.widthProperty()); text.translateXProperty().bind(textGraphicTranslateBinding); @@ -194,7 +199,6 @@ public StyleableProperty getStyleableProperty(TitledPane styleable) { } return null; } - }; private static final List> CSS_META_DATA; @@ -205,6 +209,5 @@ public StyleableProperty getStyleableProperty(TitledPane styleable) { list.add(ARROW_SIDE); CSS_META_DATA = Collections.unmodifiableList(list); } - } } diff --git a/jabgui/src/main/java/org/jabref/gui/util/FieldsUtil.java b/jabgui/src/main/java/org/jabref/gui/util/FieldsUtil.java index 67ffcb0b8f0..2998a7d547f 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/FieldsUtil.java +++ b/jabgui/src/main/java/org/jabref/gui/util/FieldsUtil.java @@ -37,11 +37,16 @@ public static String getNameWithType(Field field, CliPreferences preferences, Un case SpecialField specialField -> new SpecialFieldViewModel(specialField, preferences, undoManager).getLocalization() + " (" + Localization.lang("Special") + ")"; - case IEEEField _ -> field.getDisplayName() + " (" + Localization.lang("IEEE") + ")"; - case InternalField _ -> field.getDisplayName() + " (" + Localization.lang("Internal") + ")"; - case UnknownField _ -> field.getDisplayName() + " (" + Localization.lang("Custom") + ")"; - case null -> throw new IllegalArgumentException("Field must not be null"); - default -> field.getDisplayName(); + case IEEEField _ -> + field.getDisplayName() + " (" + Localization.lang("IEEE") + ")"; + case InternalField _ -> + field.getDisplayName() + " (" + Localization.lang("Internal") + ")"; + case UnknownField _ -> + field.getDisplayName() + " (" + Localization.lang("Custom") + ")"; + case null -> + throw new IllegalArgumentException("Field must not be null"); + default -> + field.getDisplayName(); }; } } diff --git a/jabgui/src/main/java/org/jabref/gui/util/FileFilterConverter.java b/jabgui/src/main/java/org/jabref/gui/util/FileFilterConverter.java index 619d656cddf..43b154e1392 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/FileFilterConverter.java +++ b/jabgui/src/main/java/org/jabref/gui/util/FileFilterConverter.java @@ -106,8 +106,8 @@ public static Filter toDirFilter(List extensions) { return _ -> true; } else { return path -> FileUtil.getFileExtension(path) - .map(extensionsCleaned::contains) - .orElse(false); + .map(extensionsCleaned::contains) + .orElse(false); } } } diff --git a/jabgui/src/main/java/org/jabref/gui/util/URLs.java b/jabgui/src/main/java/org/jabref/gui/util/URLs.java index bd6069fc465..f246d7568fc 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/URLs.java +++ b/jabgui/src/main/java/org/jabref/gui/util/URLs.java @@ -30,7 +30,7 @@ public class URLs { public static final String LINK_EXTERNAL_FILE_WALKTHROUGH_EXAMPLE_PDF = "https://nutritionandmetabolism.biomedcentral.com/counter/pdf/10.1186/1743-7075-3-2.pdf"; public static final String ADD_PDF_DOC = "https://docs.jabref.org/collect/add-pdfs-to-an-entry"; public static final String FIND_UNLINKED_FILES_DOC = "https://docs.jabref.org/collect/findunlinkedfiles"; - + // AboutDialogViewModel URLs public static final String HOMEPAGE_URL = "https://www.jabref.org"; public static final String DONATION_URL = "https://donations.jabref.org"; diff --git a/jabgui/src/main/java/org/jabref/gui/util/UiTaskExecutor.java b/jabgui/src/main/java/org/jabref/gui/util/UiTaskExecutor.java index 3001b3f6956..08e68e1980b 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/UiTaskExecutor.java +++ b/jabgui/src/main/java/org/jabref/gui/util/UiTaskExecutor.java @@ -103,8 +103,7 @@ public static void runInJavaFXThread(Runnable runnable) { * The JavaFX task executes the call method a background thread and the onFailed onSucceed on the FX UI thread * * @param task the BackgroundTask to run - * @param The background task type - * + * @param The background task type * @return Future of a JavaFX Task which will execute the call method a background thread */ @Override diff --git a/jabgui/src/main/java/org/jabref/gui/util/ViewModelTextFieldTableCellVisualizationFactory.java b/jabgui/src/main/java/org/jabref/gui/util/ViewModelTextFieldTableCellVisualizationFactory.java index 9ddfaf3b29a..e3abb6379bf 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/ViewModelTextFieldTableCellVisualizationFactory.java +++ b/jabgui/src/main/java/org/jabref/gui/util/ViewModelTextFieldTableCellVisualizationFactory.java @@ -63,8 +63,8 @@ private Optional lookupTextField() { } else { // Could be an HBox with some graphic and a TextField if a graphic is specified for the TableCell if (getGraphic() instanceof HBox hbox - && hbox.getChildren().size() > 1 - && hbox.getChildren().get(1) instanceof TextField textField) { + && hbox.getChildren().size() > 1 + && hbox.getChildren().get(1) instanceof TextField textField) { return Optional.of(textField); } diff --git a/jabgui/src/main/java/org/jabref/gui/util/ZipFileChooser.java b/jabgui/src/main/java/org/jabref/gui/util/ZipFileChooser.java index dd8fd8b63e5..bdaa963932a 100644 --- a/jabgui/src/main/java/org/jabref/gui/util/ZipFileChooser.java +++ b/jabgui/src/main/java/org/jabref/gui/util/ZipFileChooser.java @@ -46,7 +46,7 @@ public ZipFileChooser(FileSystem zipFile) throws IOException { try { return new ReadOnlyStringWrapper( ZonedDateTime.ofInstant(Files.getLastModifiedTime(data.getValue()).toInstant(), - ZoneId.systemDefault()) + ZoneId.systemDefault()) .format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.MEDIUM))); } catch (IOException e) { // Ignore diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughAction.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughAction.java index c8df1a0a76e..b3e075890fc 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughAction.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughAction.java @@ -70,11 +70,14 @@ private Walkthrough getWalkthrough(String name) { switch (name) { case MAIN_FILE_DIRECTORY_WALKTHROUGH_NAME -> createMainFileDirectoryWalkthrough(); - case PDF_LINK_WALKTHROUGH_NAME -> createPdfLinkWalkthrough(); + case PDF_LINK_WALKTHROUGH_NAME -> + createPdfLinkWalkthrough(); case CUSTOMIZE_ENTRY_TABLE_WALKTHROUGH_NAME -> createCustomizeEntryTableWalkthrough(); - case GROUP_WALKTHROUGH_NAME -> createGroupWalkthrough(); - case SEARCH_WALKTHROUGH_NAME -> createSearchWalkthrough(); + case GROUP_WALKTHROUGH_NAME -> + createGroupWalkthrough(); + case SEARCH_WALKTHROUGH_NAME -> + createSearchWalkthrough(); default -> throw new IllegalArgumentException("Unknown walkthrough: " + name); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughHighlighter.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughHighlighter.java index 8d16ee446e8..95ef3c187e4 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughHighlighter.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughHighlighter.java @@ -28,10 +28,10 @@ public class WalkthroughHighlighter { /// Applies the specified highlight configuration. /// /// @param config The highlight configuration to apply. Default to - /// BackdropHighlight on the primary windows if null. + /// BackdropHighlight on the primary windows if null. /// @param scene The primary scene to apply the highlight to. /// @param fallbackTarget The fallback target node to use if no highlight - /// configuration is provided. + /// configuration is provided. public void applyHighlight(@Nullable WalkthroughEffect config, @NonNull Scene scene, @Nullable Node fallbackTarget) { Map newEffects = computeNewEffects(config, scene, fallbackTarget); @@ -54,8 +54,8 @@ public void applyHighlight(@Nullable WalkthroughEffect config, @NonNull Scene sc /// Sets a handler to be called when the user clicks on backdrop or darkened areas. /// /// @param handler The handler to call when the background is clicked. If null, no - /// action will be taken on background clicks. Usually used to - /// support quit walkthrough on clicking the effects. + /// action will be taken on background clicks. Usually used to + /// support quit walkthrough on clicking the effects. public void setOnBackgroundClick(@Nullable Runnable handler) { this.onBackgroundClickHandler = handler; } @@ -166,7 +166,8 @@ private void updateExistingEffect(@NonNull Window window, @NonNull EffectState n case FULL_SCREEN_DARKEN -> { // FullScreenDarken doesn't need updates as it has no target node } - case NONE -> detach(window); + case NONE -> + detach(window); } } @@ -182,8 +183,10 @@ private void applyEffect(@NonNull Window window, @NonNull HighlightEffect effect applyPulseAnimation(window, targetNode); } } - case FULL_SCREEN_DARKEN -> applyFullScreenDarken(window); - case NONE -> detach(window); + case FULL_SCREEN_DARKEN -> + applyFullScreenDarken(window); + case NONE -> + detach(window); } } @@ -219,7 +222,9 @@ private FullScreenDarken getOrCreateFullScreenDarken(@NonNull Window window, @No return fullScreenDarkens.computeIfAbsent(window, _ -> new FullScreenDarken(pane)); } - private record EffectState(HighlightEffect effect, @Nullable Node targetNode) { + private record EffectState( + HighlightEffect effect, + @Nullable Node targetNode) { boolean canTransitionTo(EffectState other) { return effect == other.effect; } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughOverlay.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughOverlay.java index a7dd4c24b5b..f3009f8035a 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughOverlay.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughOverlay.java @@ -59,7 +59,10 @@ public void show(@NonNull WalkthroughStep step) { cleanUp(); switch (step) { - case SideEffect(String title, WalkthroughSideEffect sideEffect) -> { + case SideEffect( + String title, + WalkthroughSideEffect sideEffect + ) -> { LOGGER.debug("Executing side effect for step: {}", title); if (sideEffectExecutor.executeForward(sideEffect, walkthrough)) { @@ -142,8 +145,10 @@ private void displayWalkthroughStep(WalkthroughResult result) { w -> new WindowOverlay(w, WalkthroughPane.getInstance(w), walkthrough)); switch (component) { - case TooltipStep tooltip -> overlay.showTooltip(tooltip, resolvedNode, this::prepareForNavigation); - case PanelStep panel -> overlay.showPanel(panel, resolvedNode, this::prepareForNavigation); + case TooltipStep tooltip -> + overlay.showTooltip(tooltip, resolvedNode, this::prepareForNavigation); + case PanelStep panel -> + overlay.showPanel(panel, resolvedNode, this::prepareForNavigation); } reverter.attach(resolvedWindow, resolvedNode); diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughRenderer.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughRenderer.java index 285ef527166..622686b045d 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughRenderer.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/WalkthroughRenderer.java @@ -168,8 +168,10 @@ private VBox createContent(VisibleComponent component, Walkthrough walkthrough, contentBox.getStyleClass().add("walkthrough-content"); contentBox.getChildren().addAll(component.content().stream().map(block -> switch (block) { - case TextBlock textBlock -> render(textBlock); - case InfoBlock infoBlock -> render(infoBlock); + case TextBlock textBlock -> + render(textBlock); + case InfoBlock infoBlock -> + render(infoBlock); case ArbitraryJFXBlock arbitraryBlock -> render(arbitraryBlock, walkthrough, beforeNavigate); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/WindowOverlay.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/WindowOverlay.java index 835b87e1348..b74d4033b90 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/WindowOverlay.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/WindowOverlay.java @@ -78,15 +78,15 @@ public WindowOverlay(Window window, WalkthroughPane pane, Walkthrough walkthroug /// /// @param step The step to display. /// @param node The node to anchor the tooltip to, or null to show it at - /// the window. The node is expected to be positionable by - /// [WalkthroughUtils#cannotPositionNode(Node)] standard. + /// the window. The node is expected to be positionable by + /// [WalkthroughUtils#cannotPositionNode(Node)] standard. /// @param beforeNavigate A runnable to execute before navigating to the next step. - /// More precisely, the runnable to execute immediately upon - /// the button press before Walkthrough's state change to the - /// next step and before the original button/node's action is - /// executed. Usually used to prevent automatic revert from - /// unexpected reverting to the previous step when the node is - /// not yet ready to be displayed + /// More precisely, the runnable to execute immediately upon + /// the button press before Walkthrough's state change to the + /// next step and before the original button/node's action is + /// executed. Usually used to prevent automatic revert from + /// unexpected reverting to the previous step when the node is + /// not yet ready to be displayed /// @implNote The requirement for the node to be positionable by /// [WalkthroughUtils#cannotPositionNode(Node)] standard is just to make things /// easier to define. This requirement come from @@ -186,15 +186,15 @@ public void showPanel(PanelStep step, Runnable beforeNavigate) { /// /// @param step The step to display. /// @param node The node to anchor highlight to (e.g., BackdropHighlight - /// may poke a hole at the position of the node), or null to - /// use fallback effect of corresponding position. + /// may poke a hole at the position of the node), or null to + /// use fallback effect of corresponding position. /// @param beforeNavigate A runnable to execute before navigating to the next step. - /// More precisely, the runnable to execute immediately upon - /// the button press before Walkthrough's state change to the - /// next step and before the original button/node's action is - /// executed. Usually used to prevent automatic revert from - /// unexpected reverting to the previous step when the node is - /// not yet ready to be displayed + /// More precisely, the runnable to execute immediately upon + /// the button press before Walkthrough's state change to the + /// next step and before the original button/node's action is + /// executed. Usually used to prevent automatic revert from + /// unexpected reverting to the previous step when the node is + /// not yet ready to be displayed /// @see WindowOverlay#showPanel(PanelStep, Runnable) /// @see WindowOverlay#showTooltip(TooltipStep, Node, Runnable) public void showPanel(PanelStep step, @Nullable Node node, Runnable beforeNavigate) { @@ -306,11 +306,16 @@ private void listenKeybindings(EventTarget target, Scene scene) { private Optional mapToArrowLocation(TooltipPosition position) { return Optional.ofNullable(switch (position) { - case TOP -> PopOver.ArrowLocation.BOTTOM_CENTER; - case BOTTOM -> PopOver.ArrowLocation.TOP_CENTER; - case LEFT -> PopOver.ArrowLocation.RIGHT_CENTER; - case RIGHT -> PopOver.ArrowLocation.LEFT_CENTER; - case AUTO -> null; + case TOP -> + PopOver.ArrowLocation.BOTTOM_CENTER; + case BOTTOM -> + PopOver.ArrowLocation.TOP_CENTER; + case LEFT -> + PopOver.ArrowLocation.RIGHT_CENTER; + case RIGHT -> + PopOver.ArrowLocation.LEFT_CENTER; + case AUTO -> + null; }); } @@ -343,9 +348,13 @@ private QuitButtonPosition resolveQuitButtonPosition(VisibleComponent component) QuitButtonPosition position = component.quitButtonPosition(); if (position == QuitButtonPosition.AUTO && component instanceof PanelStep panelStep) { return switch (panelStep.position()) { - case LEFT, BOTTOM -> QuitButtonPosition.TOP_RIGHT; - case RIGHT -> QuitButtonPosition.TOP_LEFT; - case TOP -> QuitButtonPosition.BOTTOM_RIGHT; + case LEFT, + BOTTOM -> + QuitButtonPosition.TOP_RIGHT; + case RIGHT -> + QuitButtonPosition.TOP_LEFT; + case TOP -> + QuitButtonPosition.BOTTOM_RIGHT; }; } return position == QuitButtonPosition.AUTO ? QuitButtonPosition.BOTTOM_RIGHT : position; diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/Trigger.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/Trigger.java index 2bddc55fde8..e49993249a2 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/Trigger.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/Trigger.java @@ -96,7 +96,7 @@ private interface PredicateGenerator { /// /// @param node The node to attach the trigger to. /// @param onNavigate A function that wraps the original event handler. It takes a Supplier representing the - /// original action and returns the result of that action. + /// original action and returns the result of that action. /// @return A cleanup runnable that detaches the trigger. Runnable create(Node node, Function, ?> onNavigate); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/WindowResolver.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/WindowResolver.java index bbbd4710a5f..ac4e0497245 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/WindowResolver.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/WindowResolver.java @@ -35,7 +35,7 @@ static WindowResolver title(@NonNull String key) { /// Creates a resolver that finds a window that's not the window specified. /// /// @param window the window to exclude from the search. Usually this is the current - /// window. + /// window. /// @return a resolver that finds any window except the specified one static WindowResolver not(Window window) { return () -> { diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WalkthroughEffect.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WalkthroughEffect.java index 3e7f0e0bd18..1f5280a177a 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WalkthroughEffect.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WalkthroughEffect.java @@ -5,8 +5,9 @@ import org.jspecify.annotations.NonNull; -public record WalkthroughEffect(@NonNull List windowEffects, - Optional fallbackEffect) { +public record WalkthroughEffect( + @NonNull List windowEffects, + Optional fallbackEffect) { public WalkthroughEffect(WindowEffect windowEffect) { this(windowEffect, HighlightEffect.FULL_SCREEN_DARKEN); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WindowEffect.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WindowEffect.java index 3fb5df99dab..6c188688e16 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WindowEffect.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/effect/WindowEffect.java @@ -8,9 +8,9 @@ import org.jspecify.annotations.NonNull; public record WindowEffect( - @NonNull Optional windowResolver, - @NonNull HighlightEffect effect, - @NonNull Optional targetNodeResolver + @NonNull Optional windowResolver, + @NonNull HighlightEffect effect, + @NonNull Optional targetNodeResolver ) { public WindowEffect(HighlightEffect effect) { this(Optional.empty(), effect, Optional.empty()); diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/PanelStep.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/PanelStep.java index 4a225d32356..6f3120b2079 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/PanelStep.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/PanelStep.java @@ -15,20 +15,21 @@ import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; -public record PanelStep(@NonNull String title, - @NonNull List content, - @Nullable NodeResolver resolverValue, - @Nullable String continueButtonTextValue, - @Nullable String skipButtonTextValue, - @Nullable String backButtonTextValue, - @Nullable Trigger triggerValue, - @NonNull PanelPosition position, - @Nullable Double widthValue, - @Nullable Double heightValue, - @Nullable WalkthroughEffect highlightValue, - @Nullable WindowResolver activeWindowResolverValue, - boolean showQuitButtonValue, - @NonNull QuitButtonPosition quitButtonPositionValue) implements VisibleComponent { +public record PanelStep( + @NonNull String title, + @NonNull List content, + @Nullable NodeResolver resolverValue, + @Nullable String continueButtonTextValue, + @Nullable String skipButtonTextValue, + @Nullable String backButtonTextValue, + @Nullable Trigger triggerValue, + @NonNull PanelPosition position, + @Nullable Double widthValue, + @Nullable Double heightValue, + @Nullable WalkthroughEffect highlightValue, + @Nullable WindowResolver activeWindowResolverValue, + boolean showQuitButtonValue, + @NonNull QuitButtonPosition quitButtonPositionValue) implements VisibleComponent { @Override public Optional nodeResolver() { diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/SideEffect.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/SideEffect.java index e6740e8e090..c1ca61e2a85 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/SideEffect.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/SideEffect.java @@ -5,8 +5,9 @@ import org.jspecify.annotations.NonNull; /// A walkthrough step that executes side effects without displaying any UI. -public record SideEffect(@NonNull String title, - @NonNull WalkthroughSideEffect sideEffect) implements WalkthroughStep { +public record SideEffect( + @NonNull String title, + @NonNull WalkthroughSideEffect sideEffect) implements WalkthroughStep { public static Builder builder(@NonNull String title) { return new Builder(title); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/TooltipStep.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/TooltipStep.java index 8b60aa734f4..62c50531dc8 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/TooltipStep.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/declarative/step/TooltipStep.java @@ -15,20 +15,21 @@ import org.jspecify.annotations.NonNull; import org.jspecify.annotations.Nullable; -public record TooltipStep(@NonNull String title, - @NonNull List content, - @NonNull NodeResolver resolverValue, - @Nullable String continueButtonTextValue, - @Nullable String skipButtonTextValue, - @Nullable String backButtonTextValue, - @Nullable Trigger triggerValue, - @NonNull TooltipPosition position, - @Nullable Double widthValue, - @Nullable Double heightValue, - @Nullable WalkthroughEffect highlightValue, - @Nullable WindowResolver activeWindowResolverValue, - boolean showQuitButtonValue, - @NonNull QuitButtonPosition quitButtonPositionValue) implements VisibleComponent { +public record TooltipStep( + @NonNull String title, + @NonNull List content, + @NonNull NodeResolver resolverValue, + @Nullable String continueButtonTextValue, + @Nullable String skipButtonTextValue, + @Nullable String backButtonTextValue, + @Nullable Trigger triggerValue, + @NonNull TooltipPosition position, + @Nullable Double widthValue, + @Nullable Double heightValue, + @Nullable WalkthroughEffect highlightValue, + @Nullable WindowResolver activeWindowResolverValue, + boolean showQuitButtonValue, + @NonNull QuitButtonPosition quitButtonPositionValue) implements VisibleComponent { public static final double DEFAULT_WIDTH = 384; @Override diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/effects/BaseWindowEffect.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/effects/BaseWindowEffect.java index 6f2b22d8548..8e13546762e 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/effects/BaseWindowEffect.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/effects/BaseWindowEffect.java @@ -25,7 +25,7 @@ public sealed abstract class BaseWindowEffect permits Spotlight, FullScreenDarke /// pane until [#attach(Node)] is called. /// /// @param pane The pane where the effect will be applied. Usually obtained from [Window#getScene()] and - /// [Scene#getRoot()] + /// [Scene#getRoot()] protected BaseWindowEffect(@NonNull Pane pane) { this.pane = pane; this.debouncedUpdater = WalkthroughUtils.debounced(_ -> this.updateLayout()); diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughResolver.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughResolver.java index e01bfc52893..1e20c2708e3 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughResolver.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughResolver.java @@ -25,7 +25,7 @@ public class WalkthroughResolver { private static final Logger LOGGER = LoggerFactory.getLogger(WalkthroughResolver.class); private static final Duration RESOLVE_TIMEOUT = Duration.millis(2_500); -private static final Duration NODE_IDLE_TIMEOUT = Duration.millis(250); + private static final Duration NODE_IDLE_TIMEOUT = Duration.millis(250); private final WindowResolver windowResolver; private final @Nullable NodeResolver nodeResolver; @@ -199,7 +199,9 @@ private void detachChildrenListener() { } } - public record WalkthroughResult(Window windowValue, Node nodeValue) { + public record WalkthroughResult( + Window windowValue, + Node nodeValue) { public Optional window() { return Optional.ofNullable(windowValue); } diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughReverter.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughReverter.java index 02087e68f52..4269b9fc68e 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughReverter.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughReverter.java @@ -140,7 +140,8 @@ private void undoTo(int from) { return; } } - case SideEffect _ -> undo(i); + case SideEffect _ -> + undo(i); } } @@ -151,7 +152,8 @@ private void undoTo(int from) { private void undo(int stepIndex) { WalkthroughStep step = walkthrough.getStepAtIndex(stepIndex); if (step instanceof SideEffect( - String title, WalkthroughSideEffect sideEffect + String title, + WalkthroughSideEffect sideEffect )) { if (!sideEffectExecutor.executeBackward(sideEffect, walkthrough)) { LOGGER.warn("Failed to revert side effect {}: {}", title, sideEffect.description()); diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughScroller.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughScroller.java index 95c2a2b2da9..0e31256d363 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughScroller.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughScroller.java @@ -76,10 +76,14 @@ private void scrollNodeIntoViewForParent(@NonNull Node targetNode, @NonNull Node Bounds targetBounds = targetNode.localToScene(targetNode.getBoundsInLocal()); scrollIntoScrollPane(scrollPane, targetBounds); } - case ListView listView -> scrollIntoListView(targetNode, listView); - case TableView tableView -> scrollIntoTableView(targetNode, tableView); - case TreeView treeView -> scrollIntoTreeView(targetNode, treeView); - default -> LOGGER.warn("Unsupported scrollable type: {}", scrollableParent.getClass().getSimpleName()); + case ListView listView -> + scrollIntoListView(targetNode, listView); + case TableView tableView -> + scrollIntoTableView(targetNode, tableView); + case TreeView treeView -> + scrollIntoTreeView(targetNode, treeView); + default -> + LOGGER.warn("Unsupported scrollable type: {}", scrollableParent.getClass().getSimpleName()); } } catch (RuntimeException e) { LOGGER.warn("Failed to scroll node into view for parent {}", scrollableParent.getClass().getSimpleName(), e); diff --git a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughUtils.java b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughUtils.java index 30bfcd8809c..6302b6d1d08 100644 --- a/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughUtils.java +++ b/jabgui/src/main/java/org/jabref/gui/walkthrough/utils/WalkthroughUtils.java @@ -145,8 +145,8 @@ private static void scheduleExecution(Timeline timeline, long intervalMs, Runnab /// until a stop condition is met. /// /// @param stopCondition A supplier that should return true when the listener should - /// be detached (as well as run anything interesting for the - /// actual callee). + /// be detached (as well as run anything interesting for the + /// actual callee). /// @return A runnable that can be used to detach the listener prematurely. public static Runnable onWindowChangedUntil(@NonNull BooleanSupplier stopCondition) { ListChangeListener listener = new ListChangeListener<>() { diff --git a/jabgui/src/main/java/org/jabref/gui/welcome/WelcomeTab.java b/jabgui/src/main/java/org/jabref/gui/welcome/WelcomeTab.java index edfa9f40a95..f3985aa4be2 100644 --- a/jabgui/src/main/java/org/jabref/gui/welcome/WelcomeTab.java +++ b/jabgui/src/main/java/org/jabref/gui/welcome/WelcomeTab.java @@ -358,15 +358,24 @@ private Hyperlink createFooterLink(String text, StandardActions action, IconThem Hyperlink link = new Hyperlink(text); link.getStyleClass().add("welcome-community-link"); String url = switch (action) { - case HELP -> URLs.HELP_URL; - case OPEN_FORUM -> URLs.FORUM_URL; - case OPEN_MASTODON -> URLs.MASTODON_URL; - case OPEN_LINKEDIN -> URLs.LINKEDIN_URL; - case DONATE -> URLs.DONATE_URL; - case OPEN_DEV_VERSION_LINK -> URLs.DEV_VERSION_LINK_URL; - case OPEN_CHANGELOG -> URLs.CHANGELOG_URL; - case OPEN_PRIVACY_POLICY -> URLs.PRIVACY_POLICY_URL; - default -> null; + case HELP -> + URLs.HELP_URL; + case OPEN_FORUM -> + URLs.FORUM_URL; + case OPEN_MASTODON -> + URLs.MASTODON_URL; + case OPEN_LINKEDIN -> + URLs.LINKEDIN_URL; + case DONATE -> + URLs.DONATE_URL; + case OPEN_DEV_VERSION_LINK -> + URLs.DEV_VERSION_LINK_URL; + case OPEN_CHANGELOG -> + URLs.CHANGELOG_URL; + case OPEN_PRIVACY_POLICY -> + URLs.PRIVACY_POLICY_URL; + default -> + null; }; if (url != null) { link.setOnAction(_ -> new OpenBrowserAction(url, dialogService, preferences.getExternalApplicationsPreferences()).execute()); diff --git a/jabgui/src/main/java/org/jabref/gui/welcome/components/QuickSettings.java b/jabgui/src/main/java/org/jabref/gui/welcome/components/QuickSettings.java index e3ff23fce4b..dd02329b7db 100644 --- a/jabgui/src/main/java/org/jabref/gui/welcome/components/QuickSettings.java +++ b/jabgui/src/main/java/org/jabref/gui/welcome/components/QuickSettings.java @@ -88,11 +88,11 @@ private VBox createContent() { this::showEntryTableConfigurationDialog); VBox newContent = new VBox(mainFileDirButton, - themeButton, - largeLibraryButton, - entryTableButton, - pushApplicationButton, - onlineServicesButton); + themeButton, + largeLibraryButton, + entryTableButton, + pushApplicationButton, + onlineServicesButton); newContent.getStyleClass().add("quick-settings-container"); return newContent; } diff --git a/jabgui/src/main/java/org/jabref/gui/welcome/components/ThemeWireFrame.java b/jabgui/src/main/java/org/jabref/gui/welcome/components/ThemeWireFrame.java index de560bbffdf..272b669a2be 100644 --- a/jabgui/src/main/java/org/jabref/gui/welcome/components/ThemeWireFrame.java +++ b/jabgui/src/main/java/org/jabref/gui/welcome/components/ThemeWireFrame.java @@ -26,9 +26,12 @@ public void setThemeType(@NonNull ThemeTypes themeType) { styleClass.startsWith("wireframe-custom")); String themeClassName = switch (themeType) { - case LIGHT -> "wireframe-light"; - case DARK -> "wireframe-dark"; - case CUSTOM -> "wireframe-custom"; + case LIGHT -> + "wireframe-light"; + case DARK -> + "wireframe-dark"; + case CUSTOM -> + "wireframe-custom"; }; getStyleClass().add(themeClassName); } diff --git a/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/ThemeDialog.java b/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/ThemeDialog.java index 3deb62fbceb..8f9fe431909 100644 --- a/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/ThemeDialog.java +++ b/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/ThemeDialog.java @@ -86,9 +86,12 @@ private void initialize() { private void selectInitialTheme() { switch (viewModel.getSelectedTheme()) { - case LIGHT -> lightRadio.setSelected(true); - case DARK -> darkRadio.setSelected(true); - case CUSTOM -> customRadio.setSelected(true); + case LIGHT -> + lightRadio.setSelected(true); + case DARK -> + darkRadio.setSelected(true); + case CUSTOM -> + customRadio.setSelected(true); } } diff --git a/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/viewmodel/ThemeDialogViewModel.java b/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/viewmodel/ThemeDialogViewModel.java index 5db3522814e..c894e04a8ba 100644 --- a/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/viewmodel/ThemeDialogViewModel.java +++ b/jabgui/src/main/java/org/jabref/gui/welcome/quicksettings/viewmodel/ThemeDialogViewModel.java @@ -36,8 +36,10 @@ public ThemeDialogViewModel(GuiPreferences preferences, DialogService dialogServ private void initializeFromCurrentTheme() { Theme currentTheme = workspacePreferences.getTheme(); switch (currentTheme.getType()) { - case DEFAULT -> selectedThemeProperty.set(ThemeTypes.LIGHT); - case EMBEDDED -> selectedThemeProperty.set(ThemeTypes.DARK); + case DEFAULT -> + selectedThemeProperty.set(ThemeTypes.LIGHT); + case EMBEDDED -> + selectedThemeProperty.set(ThemeTypes.DARK); case CUSTOM -> { selectedThemeProperty.set(ThemeTypes.CUSTOM); customPathProperty.set(currentTheme.getName()); @@ -86,9 +88,12 @@ public boolean isValidConfiguration() { public void saveSettings() { Theme newTheme = switch (selectedThemeProperty.get()) { - case LIGHT -> Theme.light(); - case DARK -> Theme.dark(); - case CUSTOM -> Theme.custom(customPathProperty.get().trim()); + case LIGHT -> + Theme.light(); + case DARK -> + Theme.dark(); + case CUSTOM -> + Theme.custom(customPathProperty.get().trim()); }; workspacePreferences.setTheme(newTheme); } diff --git a/jabgui/src/main/java/org/jabref/migrations/PerformLoadDatabaseMigrations.java b/jabgui/src/main/java/org/jabref/migrations/PerformLoadDatabaseMigrations.java index e53b5b14ecc..2fa91401f04 100644 --- a/jabgui/src/main/java/org/jabref/migrations/PerformLoadDatabaseMigrations.java +++ b/jabgui/src/main/java/org/jabref/migrations/PerformLoadDatabaseMigrations.java @@ -10,7 +10,7 @@ public class PerformLoadDatabaseMigrations { // FIXME: Should be called somewhere // Typical call: performLoadDatabaseMigrations(result, importFormatPreferences.bibEntryPreferences().getKeywordSeparator()); public static void performLoadDatabaseMigrations(ParserResult parserResult, - Character keywordDelimited) { + Character keywordDelimited) { List postOpenMigrations = Arrays.asList( new ConvertLegacyExplicitGroups(), new ConvertMarkingToGroups(), diff --git a/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java b/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java index 2d6e6aaf64d..a8dff84eb0a 100644 --- a/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java +++ b/jabgui/src/main/java/org/jabref/migrations/PreferencesMigrations.java @@ -272,13 +272,13 @@ static void upgradeImportFileAndDirePatterns(JabRefCliPreferences prefs, Prefere // Migrate Import patterns // Check for prefs node for Version <= 4.0 if (mainPrefsNode.get(JabRefCliPreferences.IMPORT_FILENAMEPATTERN, null) != null) { - String[] oldStylePatterns = new String[]{ + String[] oldStylePatterns = new String[] { "\\bibtexkey", "\\bibtexkey\\begin{title} - \\format[RemoveBrackets]{\\title}\\end{title}"}; - String[] newStylePatterns = new String[]{"[citationkey]", + String[] newStylePatterns = new String[] {"[citationkey]", "[citationkey] - [title]"}; - String[] oldDisplayStylePattern = new String[]{"bibtexkey", "bibtexkey - title"}; + String[] oldDisplayStylePattern = new String[] {"bibtexkey", "bibtexkey - title"}; for (int i = 0; i < oldStylePatterns.length; i++) { migrateFileImportPattern(oldStylePatterns[i], newStylePatterns[i], prefs, mainPrefsNode); @@ -571,8 +571,8 @@ static void moveApiKeysToKeyring(JabRefCliPreferences preferences) { * and only then does the update. *

    * - * @implNote The default fields for the "General" tab are defined by {@link FieldFactory#getDefaultGeneralFields()}. * @param preferences the user's current preferences + * @implNote The default fields for the "General" tab are defined by {@link FieldFactory#getDefaultGeneralFields()}. */ static void addICORERankingFieldToGeneralTab(GuiPreferences preferences) { Map> entryEditorPrefs = preferences.getEntryEditorPreferences().getEntryEditorTabs(); diff --git a/jabgui/src/main/resources/org/jabref/gui/ai/components/aichat/AiChatComponent.fxml b/jabgui/src/main/resources/org/jabref/gui/ai/components/aichat/AiChatComponent.fxml index 49a9123084a..ad44895662b 100644 --- a/jabgui/src/main/resources/org/jabref/gui/ai/components/aichat/AiChatComponent.fxml +++ b/jabgui/src/main/resources/org/jabref/gui/ai/components/aichat/AiChatComponent.fxml @@ -12,23 +12,44 @@ - + - + - - + + - -