diff --git a/src/main/java/org/jabref/gui/JabRefFrame.java b/src/main/java/org/jabref/gui/JabRefFrame.java index 561f7504926..a12403321ed 100644 --- a/src/main/java/org/jabref/gui/JabRefFrame.java +++ b/src/main/java/org/jabref/gui/JabRefFrame.java @@ -764,7 +764,8 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.IMPORT_INTO_NEW_LIBRARY, new ImportCommand(this, false)), factory.createMenuItem(StandardActions.EXPORT_ALL, new ExportCommand(this, false)), factory.createMenuItem(StandardActions.EXPORT_SELECTED, new ExportCommand(this, true)), - factory.createMenuItem(StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX, new OldDatabaseCommandWrapper(Actions.SAVE_SELECTED_AS_PLAIN, this, Globals.stateManager))), + factory.createMenuItem(StandardActions.SAVE_SELECTED_AS_PLAIN_BIBTEX, new OldDatabaseCommandWrapper(Actions.SAVE_SELECTED_AS_PLAIN, this, Globals.stateManager)) + ), new SeparatorMenuItem(), @@ -778,7 +779,9 @@ private MenuBar createMenu() { new SeparatorMenuItem(), factory.createMenuItem(StandardActions.CLOSE_LIBRARY, new CloseDatabaseAction()), - factory.createMenuItem(StandardActions.QUIT, new CloseAction())); + factory.createMenuItem(StandardActions.QUIT, new CloseAction()) + + ); edit.getItems().addAll( factory.createMenuItem(StandardActions.UNDO, new OldDatabaseCommandWrapper(Actions.UNDO, this, Globals.stateManager)), @@ -804,7 +807,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.SEND_AS_EMAIL, new OldDatabaseCommandWrapper(Actions.SEND_AS_EMAIL, this, Globals.stateManager)), - new SeparatorMenuItem()); + new SeparatorMenuItem() + + ); /* edit.add(mark); for (int i = 0; i < EntryMarker.MAX_MARKING_LEVEL; i++) { @@ -857,7 +862,9 @@ private MenuBar createMenu() { edit.getItems().addAll( factory.createMenuItem(StandardActions.MANAGE_KEYWORDS, new ManageKeywordsAction(this)), factory.createMenuItem(StandardActions.REPLACE_ALL, new OldDatabaseCommandWrapper(Actions.REPLACE_ALL, this, Globals.stateManager)), - factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldAction(this))); + factory.createMenuItem(StandardActions.MASS_SET_FIELDS, new MassSetFieldAction(this)) + + ); library.getItems().addAll( factory.createMenuItem(StandardActions.NEW_ARTICLE, new NewEntryAction(this, BibtexEntryTypes.ARTICLE)), @@ -872,7 +879,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.LIBRARY_PROPERTIES, new LibraryPropertiesAction(this)), factory.createMenuItem(StandardActions.EDIT_PREAMBLE, new OldDatabaseCommandWrapper(Actions.EDIT_PREAMBLE, this, Globals.stateManager)), - factory.createMenuItem(StandardActions.EDIT_STRINGS, new OldDatabaseCommandWrapper(Actions.EDIT_STRINGS, this, Globals.stateManager))); + factory.createMenuItem(StandardActions.EDIT_STRINGS, new OldDatabaseCommandWrapper(Actions.EDIT_STRINGS, this, Globals.stateManager)) + + ); Menu lookupIdentifiers = factory.createSubMenu(StandardActions.LOOKUP_DOC_IDENTIFIER); for (IdFetcher fetcher : WebFetchers.getIdFetchers(Globals.prefs.getImportFormatPreferences())) { @@ -896,7 +905,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.SET_FILE_LINKS, new AutoLinkFilesAction()), factory.createMenuItem(StandardActions.FIND_UNLINKED_FILES, new FindUnlinkedFilesAction(this)), lookupIdentifiers, - factory.createMenuItem(StandardActions.DOWNLOAD_FULL_TEXT, new OldDatabaseCommandWrapper(Actions.DOWNLOAD_FULL_TEXT, this, Globals.stateManager))); + factory.createMenuItem(StandardActions.DOWNLOAD_FULL_TEXT, new OldDatabaseCommandWrapper(Actions.DOWNLOAD_FULL_TEXT, this, Globals.stateManager)) + + ); SidePaneComponent webSearch = sidePaneManager.getComponent(SidePaneType.WEB_SEARCH); SidePaneComponent groups = sidePaneManager.getComponent(SidePaneType.GROUPS); @@ -916,7 +927,9 @@ private MenuBar createMenu() { new SeparatorMenuItem(), factory.createMenuItem(StandardActions.NEXT_PREVIEW_STYLE, new OldDatabaseCommandWrapper(Actions.NEXT_PREVIEW_STYLE, this, Globals.stateManager)), - factory.createMenuItem(StandardActions.PREVIOUS_PREVIEW_STYLE, new OldDatabaseCommandWrapper(Actions.PREVIOUS_PREVIEW_STYLE, this, Globals.stateManager))); + factory.createMenuItem(StandardActions.PREVIOUS_PREVIEW_STYLE, new OldDatabaseCommandWrapper(Actions.PREVIOUS_PREVIEW_STYLE, this, Globals.stateManager)) + + ); PushToApplicationButton pushToExternal = new PushToApplicationButton(this, pushApplications.getApplications()); tools.getItems().addAll( @@ -940,7 +953,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.ABBREVIATE_ISO, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_ISO, this, Globals.stateManager)), factory.createMenuItem(StandardActions.ABBREVIATE_MEDLINE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_MEDLINE, this, Globals.stateManager)), - factory.createMenuItem(StandardActions.UNABBREVIATE, new OldDatabaseCommandWrapper(Actions.UNABBREVIATE, this, Globals.stateManager))); + factory.createMenuItem(StandardActions.UNABBREVIATE, new OldDatabaseCommandWrapper(Actions.UNABBREVIATE, this, Globals.stateManager)) + + ); options.getItems().addAll( factory.createMenuItem(StandardActions.SHOW_PREFS, new ShowPreferencesAction(this)), @@ -959,7 +974,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.MANAGE_CONTENT_SELECTORS, new OldDatabaseCommandWrapper(Actions.MANAGE_SELECTORS, this, Globals.stateManager)), factory.createMenuItem(StandardActions.CUSTOMIZE_ENTRY_TYPES, new CustomizeEntryAction(this)), - factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this))); + factory.createMenuItem(StandardActions.MANAGE_CITE_KEY_PATTERNS, new BibtexKeyPatternAction(this)) + + ); help.getItems().addAll( factory.createMenuItem(StandardActions.HELP, HelpAction.getCommand()), @@ -989,7 +1006,9 @@ private MenuBar createMenu() { factory.createMenuItem(StandardActions.DONATE, new OpenBrowserAction("https://donations.jabref.org")) ), - factory.createMenuItem(StandardActions.ABOUT, new AboutAction())); + factory.createMenuItem(StandardActions.ABOUT, new AboutAction()) + + ); MenuBar menu = new MenuBar(); menu.getStyleClass().add("mainMenu"); diff --git a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabViewModel.java b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabViewModel.java index 67f2cf8bad0..ec828e67840 100644 --- a/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabViewModel.java +++ b/src/main/java/org/jabref/gui/entryeditor/fileannotationtab/FileAnnotationTabViewModel.java @@ -49,6 +49,7 @@ public FileAnnotationTabViewModel(FileAnnotationCache cache, BibEntry entry, Fil this.cache = cache; this.entry = entry; this.fileMonitor = fileMonitor; + fileAnnotations = this.cache.getFromCache(this.entry); files.setAll(fileAnnotations.keySet()); } diff --git a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java index e90add0e588..a9ef705e068 100644 --- a/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java +++ b/src/main/java/org/jabref/gui/util/DefaultFileUpdateMonitor.java @@ -2,7 +2,6 @@ import java.io.IOException; import java.nio.file.FileSystems; -import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardWatchEventKinds; import java.nio.file.WatchEvent; @@ -71,17 +70,9 @@ private void notifyAboutChange(Path path) { @Override public void addListenerForFile(Path file, FileUpdateListener listener) throws IOException { // We can't watch files directly, so monitor their parent directory for updates - Path directory = file.toAbsolutePath().getParent(); - System.out.println(directory); - if ((directory != null) && Files.exists(directory)) { - directory.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); - - listeners.put(file, listener); - } - else { - System.out.println("Dir not exist " + directory); - } + directory.register(watcher, StandardWatchEventKinds.ENTRY_MODIFY); + listeners.put(file, listener); } @Override