";
+ String myText = "" + JS_HIGHLIGHT_FUNCTION + "
" + text + "
";
previewView.getEngine().setJavaScriptEnabled(true);
previewView.getEngine().loadContent(myText);
diff --git a/src/main/java/org/jabref/gui/util/BindingsHelper.java b/src/main/java/org/jabref/gui/util/BindingsHelper.java
index f594c680607..a64c6a73f7f 100644
--- a/src/main/java/org/jabref/gui/util/BindingsHelper.java
+++ b/src/main/java/org/jabref/gui/util/BindingsHelper.java
@@ -24,6 +24,7 @@
import org.fxmisc.easybind.EasyBind;
import org.fxmisc.easybind.PreboundBinding;
+import org.fxmisc.easybind.Subscription;
/**
* Helper methods for javafx binding.
@@ -43,12 +44,13 @@ public static
BooleanBinding all(ObservableList source, Predicate pred
return Bindings.createBooleanBinding(() -> !source.isEmpty() && source.stream().allMatch(predicate), source);
}
- public static void includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue extends Boolean> condition) {
+ public static Subscription includePseudoClassWhen(Node node, PseudoClass pseudoClass, ObservableValue extends Boolean> condition) {
Consumer changePseudoClass = value -> node.pseudoClassStateChanged(pseudoClass, value);
- EasyBind.subscribe(condition, changePseudoClass);
+ Subscription subscription = EasyBind.subscribe(condition, changePseudoClass);
// Put the pseudo class there depending on the current value
changePseudoClass.accept(condition.getValue());
+ return subscription;
}
/**
diff --git a/src/main/java/org/jabref/gui/util/ThemeLoader.java b/src/main/java/org/jabref/gui/util/ThemeLoader.java
index 567bd939c4f..17065eb74a1 100644
--- a/src/main/java/org/jabref/gui/util/ThemeLoader.java
+++ b/src/main/java/org/jabref/gui/util/ThemeLoader.java
@@ -88,23 +88,20 @@ private void addAndWatchForChanges(Scene scene, URL cssFile, int index) {
scene.getStylesheets().add(index, cssFile.toExternalForm());
try {
-
+ // If the file is an ordinary file (i.e. not part of a java runtime bundle), we watch it for changes and turn on live reloading
URI cssUri = cssFile.toURI();
- if (!cssUri.toString().contains("jar")) {
+ if (!cssUri.toString().contains("jrt")) {
LOGGER.debug("CSS URI {}", cssUri);
Path cssPath = Paths.get(cssUri).toAbsolutePath();
- // If the file is an ordinary file (i.e. not a resource part of a .jar bundle), we watch it for changes and turn on live reloading
- if (!cssUri.toString().contains("jar")) {
- LOGGER.info("Enabling live reloading of {}", cssPath);
- fileUpdateMonitor.addListenerForFile(cssPath, () -> {
- LOGGER.info("Reload css file " + cssFile);
- DefaultTaskExecutor.runInJavaFXThread(() -> {
- scene.getStylesheets().remove(cssFile.toExternalForm());
- scene.getStylesheets().add(index, cssFile.toExternalForm());
- });
+ LOGGER.info("Enabling live reloading of {}", cssPath);
+ fileUpdateMonitor.addListenerForFile(cssPath, () -> {
+ LOGGER.info("Reload css file {}", cssFile);
+ DefaultTaskExecutor.runInJavaFXThread(() -> {
+ scene.getStylesheets().remove(cssFile.toExternalForm());
+ scene.getStylesheets().add(index, cssFile.toExternalForm());
});
- }
+ });
}
} catch (IOException | URISyntaxException | UnsupportedOperationException e) {
LOGGER.error("Could not watch css file for changes " + cssFile, e);
diff --git a/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java b/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java
index c0ce703dee0..72188027e8a 100644
--- a/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java
+++ b/src/main/java/org/jabref/gui/util/ViewModelListCellFactory.java
@@ -1,6 +1,8 @@
package org.jabref.gui.util;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.function.BiConsumer;
@@ -20,6 +22,8 @@
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.model.strings.StringUtil;
+import org.fxmisc.easybind.Subscription;
+
/**
* Constructs a {@link ListCell} based on the view model of the row and a bunch of specified converter methods.
*
@@ -144,10 +148,16 @@ public ListCell call(ListView param) {
return new ListCell() {
+ List subscriptions = new ArrayList<>();
+
@Override
protected void updateItem(T item, boolean empty) {
super.updateItem(item, empty);
+ // Remove previous subscriptions
+ subscriptions.forEach(Subscription::unsubscribe);
+ subscriptions.clear();
+
T viewModel = getItem();
if (empty || (viewModel == null)) {
setText(null);
@@ -190,10 +200,10 @@ protected void updateItem(T item, boolean empty) {
}
for (Map.Entry>> pseudoClassWithCondition : pseudoClasses.entrySet()) {
ObservableValue condition = pseudoClassWithCondition.getValue().call(viewModel);
- BindingsHelper.includePseudoClassWhen(this, pseudoClassWithCondition.getKey(), condition);
+ Subscription subscription = BindingsHelper.includePseudoClassWhen(this, pseudoClassWithCondition.getKey(), condition);
+ subscriptions.add(subscription);
}
}
- getListView().refresh();
}
};
}
diff --git a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java
index f1ebe894836..05285948ccd 100644
--- a/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java
+++ b/src/main/java/org/jabref/logic/citationstyle/CitationStyle.java
@@ -7,6 +7,7 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.nio.file.FileSystem;
+import java.nio.file.FileSystemAlreadyExistsException;
import java.nio.file.FileSystems;
import java.nio.file.Files;
import java.nio.file.NoSuchFileException;
@@ -147,6 +148,11 @@ public static List discoverCitationStyles() {
try (FileSystem fs = FileSystems.newFileSystem(uri, Collections.emptyMap())) {
Path path = fs.getPath(STYLES_ROOT);
STYLES.addAll(discoverCitationStylesInPath(path));
+ } catch (FileSystemAlreadyExistsException e) {
+ try (FileSystem fs = FileSystems.getFileSystem(uri)) {
+ Path path = fs.getPath(STYLES_ROOT);
+ STYLES.addAll(discoverCitationStylesInPath(path));
+ }
}
} else {
STYLES.addAll(discoverCitationStylesInPath(Paths.get(uri)));
diff --git a/src/main/java/org/jabref/logic/importer/FulltextFetchers.java b/src/main/java/org/jabref/logic/importer/FulltextFetchers.java
index 4ba2cb69b63..52f2dcbd8d6 100644
--- a/src/main/java/org/jabref/logic/importer/FulltextFetchers.java
+++ b/src/main/java/org/jabref/logic/importer/FulltextFetchers.java
@@ -3,11 +3,12 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.ArrayList;
import java.util.Comparator;
+import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.CancellationException;
import java.util.concurrent.ExecutionException;
@@ -34,7 +35,7 @@ public class FulltextFetchers {
// Timeout in seconds
private static final int FETCHER_TIMEOUT = 10;
- private final List finders = new ArrayList<>();
+ private final Set finders = new HashSet<>();
private final Predicate isPDF = url -> {
try {
@@ -49,7 +50,7 @@ public FulltextFetchers(ImportFormatPreferences importFormatPreferences) {
this(WebFetchers.getFullTextFetchers(importFormatPreferences));
}
- FulltextFetchers(List fetcher) {
+ FulltextFetchers(Set fetcher) {
finders.addAll(fetcher);
}
@@ -108,7 +109,7 @@ private Callable> getCallable(BibEntry entry, FulltextFe
};
}
- private List>> getCallables(BibEntry entry, List fetchers) {
+ private List>> getCallables(BibEntry entry, Set fetchers) {
return fetchers.stream()
.map(f -> getCallable(entry, f))
.collect(Collectors.toList());
diff --git a/src/main/java/org/jabref/logic/importer/WebFetchers.java b/src/main/java/org/jabref/logic/importer/WebFetchers.java
index 604cd750541..66319f5e6b4 100644
--- a/src/main/java/org/jabref/logic/importer/WebFetchers.java
+++ b/src/main/java/org/jabref/logic/importer/WebFetchers.java
@@ -1,9 +1,11 @@
package org.jabref.logic.importer;
-import java.util.ArrayList;
import java.util.Comparator;
-import java.util.List;
+import java.util.HashSet;
import java.util.Optional;
+import java.util.Set;
+import java.util.SortedSet;
+import java.util.TreeSet;
import org.jabref.logic.importer.fetcher.ACMPortalFetcher;
import org.jabref.logic.importer.fetcher.ACS;
@@ -76,66 +78,77 @@ public static Optional> getIdFetcherForField(Fie
return Optional.empty();
}
- public static List getSearchBasedFetchers(ImportFormatPreferences importFormatPreferences) {
- ArrayList list = new ArrayList<>();
- list.add(new ArXiv(importFormatPreferences));
- list.add(new INSPIREFetcher(importFormatPreferences));
- list.add(new GvkFetcher());
- list.add(new MedlineFetcher());
- list.add(new AstrophysicsDataSystem(importFormatPreferences));
- list.add(new MathSciNet(importFormatPreferences));
- list.add(new ZbMATH(importFormatPreferences));
- list.add(new ACMPortalFetcher(importFormatPreferences));
- list.add(new GoogleScholar(importFormatPreferences));
- list.add(new DBLPFetcher(importFormatPreferences));
- list.add(new SpringerFetcher());
- list.add(new CrossRef());
- list.add(new CiteSeer());
- list.add(new DOAJFetcher(importFormatPreferences));
- list.add(new IEEE(importFormatPreferences));
- list.sort(Comparator.comparing(WebFetcher::getName));
- return list;
+ /**
+ * @return sorted set containing search based fetchers
+ */
+ public static SortedSet getSearchBasedFetchers(ImportFormatPreferences importFormatPreferences) {
+ SortedSet set = new TreeSet<>(Comparator.comparing(WebFetcher::getName));
+ set.add(new ArXiv(importFormatPreferences));
+ set.add(new INSPIREFetcher(importFormatPreferences));
+ set.add(new GvkFetcher());
+ set.add(new MedlineFetcher());
+ set.add(new AstrophysicsDataSystem(importFormatPreferences));
+ set.add(new MathSciNet(importFormatPreferences));
+ set.add(new ZbMATH(importFormatPreferences));
+ set.add(new ACMPortalFetcher(importFormatPreferences));
+ set.add(new GoogleScholar(importFormatPreferences));
+ set.add(new DBLPFetcher(importFormatPreferences));
+ set.add(new SpringerFetcher());
+ set.add(new CrossRef());
+ set.add(new CiteSeer());
+ set.add(new DOAJFetcher(importFormatPreferences));
+ set.add(new IEEE(importFormatPreferences));
+ return set;
}
- public static List getIdBasedFetchers(ImportFormatPreferences importFormatPreferences) {
- ArrayList list = new ArrayList<>();
- list.add(new ArXiv(importFormatPreferences));
- list.add(new AstrophysicsDataSystem(importFormatPreferences));
- list.add(new IsbnFetcher(importFormatPreferences));
- list.add(new DiVA(importFormatPreferences));
- list.add(new DoiFetcher(importFormatPreferences));
- list.add(new MedlineFetcher());
- list.add(new TitleFetcher(importFormatPreferences));
- list.add(new MathSciNet(importFormatPreferences));
- list.add(new CrossRef());
- list.add(new LibraryOfCongress(importFormatPreferences));
- list.add(new IacrEprintFetcher(importFormatPreferences));
- list.add(new RfcFetcher(importFormatPreferences));
- list.sort(Comparator.comparing(WebFetcher::getName));
- return list;
+ /**
+ * @return sorted set containing id based fetchers
+ */
+ public static SortedSet getIdBasedFetchers(ImportFormatPreferences importFormatPreferences) {
+ SortedSet set = new TreeSet<>(Comparator.comparing(WebFetcher::getName));
+ set.add(new ArXiv(importFormatPreferences));
+ set.add(new AstrophysicsDataSystem(importFormatPreferences));
+ set.add(new IsbnFetcher(importFormatPreferences));
+ set.add(new DiVA(importFormatPreferences));
+ set.add(new DoiFetcher(importFormatPreferences));
+ set.add(new MedlineFetcher());
+ set.add(new TitleFetcher(importFormatPreferences));
+ set.add(new MathSciNet(importFormatPreferences));
+ set.add(new CrossRef());
+ set.add(new LibraryOfCongress(importFormatPreferences));
+ set.add(new IacrEprintFetcher(importFormatPreferences));
+ set.add(new RfcFetcher(importFormatPreferences));
+ return set;
}
- public static List getEntryBasedFetchers(ImportFormatPreferences importFormatPreferences) {
- ArrayList list = new ArrayList<>();
- list.add(new AstrophysicsDataSystem(importFormatPreferences));
- list.add(new DoiFetcher(importFormatPreferences));
- list.add(new IsbnFetcher(importFormatPreferences));
- list.add(new MathSciNet(importFormatPreferences));
- list.add(new CrossRef());
- list.sort(Comparator.comparing(WebFetcher::getName));
- return list;
+ /**
+ * @return sorted set containing entry based fetchers
+ */
+ public static SortedSet getEntryBasedFetchers(ImportFormatPreferences importFormatPreferences) {
+ SortedSet set = new TreeSet<>(Comparator.comparing(WebFetcher::getName));
+ set.add(new AstrophysicsDataSystem(importFormatPreferences));
+ set.add(new DoiFetcher(importFormatPreferences));
+ set.add(new IsbnFetcher(importFormatPreferences));
+ set.add(new MathSciNet(importFormatPreferences));
+ set.add(new CrossRef());
+ return set;
}
- public static List getIdFetchers(ImportFormatPreferences importFormatPreferences) {
- ArrayList list = new ArrayList<>();
- list.add(new CrossRef());
- list.add(new ArXiv(importFormatPreferences));
- list.sort(Comparator.comparing(WebFetcher::getName));
- return list;
+ /**
+ * @return sorted set containing id fetchers
+ */
+ public static SortedSet getIdFetchers(ImportFormatPreferences importFormatPreferences) {
+ SortedSet set = new TreeSet<>(Comparator.comparing(WebFetcher::getName));
+ set.add(new CrossRef());
+ set.add(new ArXiv(importFormatPreferences));
+ return set;
}
- public static List getFullTextFetchers(ImportFormatPreferences importFormatPreferences) {
- List fetchers = new ArrayList<>();
+ /**
+ * @return set containing fulltext fetchers
+ */
+ public static Set getFullTextFetchers(ImportFormatPreferences importFormatPreferences) {
+ Set fetchers = new HashSet<>();
// Original
fetchers.add(new DoiResolution());
// Publishers
diff --git a/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java b/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java
index 38452bbeab5..50e9da651ac 100644
--- a/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java
+++ b/src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java
@@ -51,7 +51,7 @@ public String getName() {
@Override
public URL getURLForEntry(BibEntry entry) throws URISyntaxException, MalformedURLException, FetcherException {
URIBuilder uriBuilder = new URIBuilder(API_URL);
- entry.getLatexFreeField(StandardField.TITLE).ifPresent(title -> uriBuilder.addParameter("query.title", title));
+ entry.getLatexFreeField(StandardField.TITLE).ifPresent(title -> uriBuilder.addParameter("query.bibliographic", title));
entry.getLatexFreeField(StandardField.AUTHOR).ifPresent(author -> uriBuilder.addParameter("query.author", author));
entry.getLatexFreeField(StandardField.YEAR).ifPresent(year ->
uriBuilder.addParameter("filter", "from-pub-date:" + year)
diff --git a/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java b/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java
index b42252ac914..6b2156047ee 100644
--- a/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java
+++ b/src/main/java/org/jabref/logic/openoffice/OOBibStyle.java
@@ -122,6 +122,7 @@ public class OOBibStyle implements Comparable {
private File styleFile;
private long styleFileModificationTime = Long.MIN_VALUE;
private String localCopy;
+ private boolean isDefaultLayoutPresent;
public OOBibStyle(File styleFile, LayoutFormatterPreferences prefs,
Charset encoding) throws IOException {
this.prefs = Objects.requireNonNull(prefs);
@@ -321,13 +322,11 @@ private void readFormatFile(Reader in) throws IOException {
}
}
-
// Set validity boolean based on whether we found anything interesting
// in the file:
- if (mode != BibStyleMode.NONE) {
+ if ((mode != BibStyleMode.NONE) && isDefaultLayoutPresent) {
valid = true;
}
-
}
/**
@@ -350,11 +349,11 @@ private void handleStructureLine(String line) {
int index = line.indexOf('=');
if ((index > 0) && (index < (line.length() - 1))) {
String formatString = line.substring(index + 1);
- boolean setDefault = line.substring(0, index).equals(OOBibStyle.DEFAULT_MARK);
+ isDefaultLayoutPresent = line.substring(0, index).equals(OOBibStyle.DEFAULT_MARK);
EntryType type = EntryTypeFactory.parse(line.substring(0, index));
try {
Layout layout = new LayoutHelper(new StringReader(formatString), this.prefs).getLayoutFromText();
- if (setDefault) {
+ if (isDefaultLayoutPresent) {
defaultBibLayout = layout;
} else {
bibLayout.put(type, layout);
diff --git a/src/main/java/org/jabref/model/bibtexkeypattern/GlobalBibtexKeyPattern.java b/src/main/java/org/jabref/model/bibtexkeypattern/GlobalBibtexKeyPattern.java
index 1203bd1a518..350323bd129 100644
--- a/src/main/java/org/jabref/model/bibtexkeypattern/GlobalBibtexKeyPattern.java
+++ b/src/main/java/org/jabref/model/bibtexkeypattern/GlobalBibtexKeyPattern.java
@@ -6,10 +6,8 @@
public class GlobalBibtexKeyPattern extends AbstractBibtexKeyPattern {
- private List defaultBibtexKeyPattern;
-
public GlobalBibtexKeyPattern(List bibtexKeyPattern) {
- defaultBibtexKeyPattern = bibtexKeyPattern;
+ defaultPattern = bibtexKeyPattern;
}
public static GlobalBibtexKeyPattern fromPattern(String pattern) {
@@ -18,6 +16,6 @@ public static GlobalBibtexKeyPattern fromPattern(String pattern) {
@Override
public List getLastLevelBibtexKeyPattern(EntryType entryType) {
- return defaultBibtexKeyPattern;
+ return defaultPattern;
}
}
diff --git a/src/main/java/org/jabref/model/database/BibDatabase.java b/src/main/java/org/jabref/model/database/BibDatabase.java
index a970dd438e6..e23e2b7d33a 100644
--- a/src/main/java/org/jabref/model/database/BibDatabase.java
+++ b/src/main/java/org/jabref/model/database/BibDatabase.java
@@ -21,6 +21,7 @@
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
+import org.jabref.model.database.event.AllInsertsFinishedEvent;
import org.jabref.model.database.event.EntryAddedEvent;
import org.jabref.model.database.event.EntryRemovedEvent;
import org.jabref.model.entry.BibEntry;
@@ -219,6 +220,7 @@ public synchronized void insertEntries(List entries) throws KeyCollisi
private synchronized void insertEntries(List newEntries, EntryEventSource eventSource) throws KeyCollisionException {
Objects.requireNonNull(newEntries);
+ BibEntry firstEntry = null;
for (BibEntry entry : newEntries) {
String id = entry.getId();
if (containsEntryWithId(id)) {
@@ -229,8 +231,15 @@ private synchronized void insertEntries(List newEntries, EntryEventSou
entry.registerListener(this);
eventBus.post(new EntryAddedEvent(entry, eventSource));
+
+ if (firstEntry == null) {
+ firstEntry = entry;
+ }
}
entries.addAll(newEntries);
+ if (firstEntry != null) {
+ eventBus.post(new AllInsertsFinishedEvent(firstEntry, eventSource));
+ }
}
/**
@@ -563,6 +572,7 @@ public void setEpilog(String epilog) {
* - {@link EntryAddedEvent}
* - {@link EntryChangedEvent}
* - {@link EntryRemovedEvent}
+ * - {@link AllInsertsFinishedEvent}
*
* @param listener listener (subscriber) to add
*/
diff --git a/src/main/java/org/jabref/model/database/event/AllInsertsFinishedEvent.java b/src/main/java/org/jabref/model/database/event/AllInsertsFinishedEvent.java
new file mode 100644
index 00000000000..07ba5c92cef
--- /dev/null
+++ b/src/main/java/org/jabref/model/database/event/AllInsertsFinishedEvent.java
@@ -0,0 +1,27 @@
+package org.jabref.model.database.event;
+
+import org.jabref.model.database.BibDatabase;
+import org.jabref.model.entry.BibEntry;
+import org.jabref.model.entry.event.EntryEvent;
+import org.jabref.model.entry.event.EntryEventSource;
+
+/**
+ * {@link AllInsertsFinishedEvent} is fired when insertion of {@link BibEntry} to the {@link BibDatabase} was finished.
+ */
+public class AllInsertsFinishedEvent extends EntryEvent {
+
+ /**
+ * @param bibEntry the entry which has been added
+ */
+ public AllInsertsFinishedEvent(BibEntry bibEntry) {
+ super(bibEntry);
+ }
+
+ /**
+ * @param bibEntry BibEntry
object which has been added.
+ * @param location Location affected by this event
+ */
+ public AllInsertsFinishedEvent(BibEntry bibEntry, EntryEventSource location) {
+ super(bibEntry, location);
+ }
+}
diff --git a/src/main/java/org/jabref/preferences/JabRefPreferences.java b/src/main/java/org/jabref/preferences/JabRefPreferences.java
index 3fa059ee529..ea711be51a6 100644
--- a/src/main/java/org/jabref/preferences/JabRefPreferences.java
+++ b/src/main/java/org/jabref/preferences/JabRefPreferences.java
@@ -127,7 +127,6 @@ public class JabRefPreferences implements PreferencesService {
public static final String LYXPIPE = "lyxpipe";
public static final String EXTERNAL_FILE_TYPES = "externalFileTypes";
public static final String FONT_FAMILY = "fontFamily";
- public static final String FX_FONT_RENDERING_TWEAK = "fxFontRenderingTweak";
public static final String FX_THEME = "fxTheme";
public static final String LANGUAGE = "language";
public static final String NAMES_LAST_ONLY = "namesLastOnly";
@@ -366,7 +365,7 @@ public class JabRefPreferences implements PreferencesService {
private static final String CYCLE_PREVIEW_POS = "cyclePreviewPos";
private static final String CYCLE_PREVIEW = "cyclePreview";
private static final String PREVIEW_PANEL_HEIGHT = "previewPanelHeightFX";
- private static final String PREVIEW_ENABLED = "previewEnabled";
+ private static final String PREVIEW_AS_TAB = "previewAsTab";
// Auto completion
private static final String AUTO_COMPLETE = "autoComplete";
@@ -471,7 +470,6 @@ private JabRefPreferences() {
defaults.put(EMACS_PATH, "emacsclient");
}
- defaults.put(FX_FONT_RENDERING_TWEAK, OS.LINUX); //we turn this on per default on Linux
defaults.put(EMACS_ADDITIONAL_PARAMETERS, "-n -e");
defaults.put(PUSH_TO_APPLICATION, "TeXstudio");
@@ -747,7 +745,7 @@ private JabRefPreferences() {
defaults.put(CYCLE_PREVIEW, "Preview;" + CitationStyle.DEFAULT);
defaults.put(CYCLE_PREVIEW_POS, 0);
defaults.put(PREVIEW_PANEL_HEIGHT, 0.65);
- defaults.put(PREVIEW_ENABLED, Boolean.TRUE);
+ defaults.put(PREVIEW_AS_TAB, Boolean.FALSE);
defaults.put(PREVIEW_STYLE,
""
+ "\\bibtextype\\begin{bibtexkey} (\\bibtexkey)"
@@ -1597,7 +1595,7 @@ public JabRefPreferences storePreviewPreferences(PreviewPreferences previewPrefe
}).collect(Collectors.toList()));
putDouble(PREVIEW_PANEL_HEIGHT, previewPreferences.getPreviewPanelDividerPosition().doubleValue());
put(PREVIEW_STYLE, previewPreferences.getPreviewStyle());
- putBoolean(PREVIEW_ENABLED, previewPreferences.isPreviewPanelEnabled());
+ putBoolean(PREVIEW_AS_TAB, previewPreferences.showPreviewAsExtraTab());
return this;
}
@@ -1607,7 +1605,7 @@ public PreviewPreferences getPreviewPreferences() {
double panelHeight = getDouble(PREVIEW_PANEL_HEIGHT);
String style = get(PREVIEW_STYLE);
String styleDefault = (String) defaults.get(PREVIEW_STYLE);
- boolean enabled = getBoolean(PREVIEW_ENABLED);
+ boolean showAsTab = getBoolean(PREVIEW_AS_TAB);
// For backwards compatibility always add at least the default preview to the cycle
if (cycle.isEmpty()) {
@@ -1635,7 +1633,7 @@ public PreviewPreferences getPreviewPreferences() {
cyclePos = 0; // fallback if stored position is no longer valid
}
- return new PreviewPreferences(layouts, cyclePos, panelHeight, enabled, style, styleDefault);
+ return new PreviewPreferences(layouts, cyclePos, panelHeight, style, styleDefault, showAsTab);
}
public void storeProxyPreferences(ProxyPreferences proxyPreferences) {
diff --git a/src/main/java/org/jabref/preferences/PreviewPreferences.java b/src/main/java/org/jabref/preferences/PreviewPreferences.java
index 38473567104..efec4035934 100644
--- a/src/main/java/org/jabref/preferences/PreviewPreferences.java
+++ b/src/main/java/org/jabref/preferences/PreviewPreferences.java
@@ -12,17 +12,17 @@ public class PreviewPreferences {
private final List previewCycle;
private final int previewCyclePosition;
private final Number previewPanelDividerPosition;
- private final boolean previewPanelEnabled;
private final String previewStyle;
private final String previewStyleDefault;
+ private final boolean showPreviewAsExtraTab;
- public PreviewPreferences(List previewCycle, int previewCyclePosition, Number previewPanelDividerPosition, boolean previewPanelEnabled, String previewStyle, String previewStyleDefault) {
+ public PreviewPreferences(List previewCycle, int previewCyclePosition, Number previewPanelDividerPosition, String previewStyle, String previewStyleDefault, boolean showPreviewAsExtraTab) {
this.previewCycle = previewCycle;
this.previewCyclePosition = previewCyclePosition;
this.previewPanelDividerPosition = previewPanelDividerPosition;
- this.previewPanelEnabled = previewPanelEnabled;
this.previewStyle = previewStyle;
this.previewStyleDefault = previewStyleDefault;
+ this.showPreviewAsExtraTab = showPreviewAsExtraTab;
}
public List getPreviewCycle() {
@@ -37,10 +37,6 @@ public Number getPreviewPanelDividerPosition() {
return previewPanelDividerPosition;
}
- public boolean isPreviewPanelEnabled() {
- return previewPanelEnabled;
- }
-
public String getPreviewStyle() {
return previewStyle;
}
@@ -65,12 +61,16 @@ public PreviewLayout getTextBasedPreviewLayout() {
return new TextBasedPreviewLayout(getPreviewStyle(), getLayoutFormatterPreferences());
}
+ public boolean showPreviewAsExtraTab() {
+ return showPreviewAsExtraTab;
+ }
+
public static class Builder {
+ private boolean showPreviewAsExtraTab;
private List previewCycle;
private int previewCyclePosition;
private Number previewPanelDividerPosition;
- private boolean previewPanelEnabled;
private String previewStyle;
private final String previewStyleDefault;
@@ -78,9 +78,14 @@ public Builder(PreviewPreferences previewPreferences) {
this.previewCycle = previewPreferences.getPreviewCycle();
this.previewCyclePosition = previewPreferences.getPreviewCyclePosition();
this.previewPanelDividerPosition = previewPreferences.getPreviewPanelDividerPosition();
- this.previewPanelEnabled = previewPreferences.isPreviewPanelEnabled();
this.previewStyle = previewPreferences.getPreviewStyle();
this.previewStyleDefault = previewPreferences.getDefaultPreviewStyle();
+ this.showPreviewAsExtraTab = previewPreferences.showPreviewAsExtraTab();
+ }
+
+ public Builder withShowAsExtraTab(boolean showAsExtraTab) {
+ this.showPreviewAsExtraTab = showAsExtraTab;
+ return this;
}
public Builder withPreviewCycle(List previewCycle) {
@@ -106,18 +111,13 @@ public Builder withPreviewPanelDividerPosition(Number previewPanelDividerPositio
return this;
}
- public Builder withPreviewPanelEnabled(boolean previewPanelEnabled) {
- this.previewPanelEnabled = previewPanelEnabled;
- return this;
- }
-
public Builder withPreviewStyle(String previewStyle) {
this.previewStyle = previewStyle;
return this;
}
public PreviewPreferences build() {
- return new PreviewPreferences(previewCycle, previewCyclePosition, previewPanelDividerPosition, previewPanelEnabled, previewStyle, previewStyleDefault);
+ return new PreviewPreferences(previewCycle, previewCyclePosition, previewPanelDividerPosition, previewStyle, previewStyleDefault, showPreviewAsExtraTab);
}
}
diff --git a/src/main/resources/csl-styles b/src/main/resources/csl-styles
index 6169061a140..c3fd4bdeadb 160000
--- a/src/main/resources/csl-styles
+++ b/src/main/resources/csl-styles
@@ -1 +1 @@
-Subproject commit 6169061a140068e897337de95f917008037fcd3b
+Subproject commit c3fd4bdeadbfc4a713284ad15cca64c8198a7dc7
diff --git a/src/main/resources/l10n/JabRef_en.properties b/src/main/resources/l10n/JabRef_en.properties
index 283a0fd5ddc..5b9d9f3027c 100644
--- a/src/main/resources/l10n/JabRef_en.properties
+++ b/src/main/resources/l10n/JabRef_en.properties
@@ -221,7 +221,6 @@ Default\ encoding=Default encoding
Default\ grouping\ field=Default grouping field
-Default\ pattern=Default pattern
Execute\ default\ action\ in\ dialog=Execute default action in dialog
Delete=Delete
@@ -261,8 +260,6 @@ Do\ not\ import\ entry=Do not import entry
Do\ not\ open\ any\ files\ at\ startup=Do not open any files at startup
-Do\ not\ overwrite\ existing\ keys=Do not overwrite existing keys
-
Do\ not\ wrap\ the\ following\ fields\ when\ saving=Do not wrap the following fields when saving
Do\ not\ write\ the\ following\ fields\ to\ XMP\ Metadata=Do not write the following fields to XMP Metadata
@@ -501,8 +498,6 @@ Key\ bindings=Key bindings
Key\ bindings\ changed=Key bindings changed
-Key\ generator\ settings=Key generator settings
-
Key\ pattern=Key pattern
keys\ in\ library=keys in library
@@ -872,8 +867,6 @@ Skipped\ -\ PDF\ does\ not\ exist=Skipped - PDF does not exist
Skipped\ entry.=Skipped entry.
-Some\ appearance\ settings\ you\ changed\ require\ to\ restart\ JabRef\ to\ come\ into\ effect.=Some appearance settings you changed require to restart JabRef to come into effect.
-
source\ edit=source edit
Special\ name\ formatters=Special name formatters
@@ -954,7 +947,6 @@ Upgrade\ external\ PDF/PS\ links\ to\ use\ the\ '%0'\ field.=Upgrade external PD
usage=usage
Use\ autocompletion=Use autocompletion
-Tweak\ font\ rendering\ for\ entry\ editor\ on\ Linux=Tweak font rendering for entry editor on Linux
Use\ regular\ expression\ search=Use regular expression search
Username=Username
@@ -1084,10 +1076,7 @@ Waiting\ for\ save\ operation\ to\ finish=Waiting for save operation to finish
Find\ and\ remove\ duplicate\ BibTeX\ keys=Find and remove duplicate BibTeX keys
Expected\ syntax\ for\ --fetch\='\:'=Expected syntax for --fetch=':'
Duplicate\ BibTeX\ key=Duplicate BibTeX key
-Always\ add\ letter\ (a,\ b,\ ...)\ to\ generated\ keys=Always add letter (a, b, ...) to generated keys
-Ensure\ unique\ keys\ using\ letters\ (a,\ b,\ ...)=Ensure unique keys using letters (a, b, ...)
-Ensure\ unique\ keys\ using\ letters\ (b,\ c,\ ...)=Ensure unique keys using letters (b, c, ...)
General\ file\ directory=General file directory
User-specific\ file\ directory=User-specific file directory
@@ -1970,7 +1959,6 @@ View\ event\ log=View event log
Website=Website
Write\ XMP-metadata\ to\ PDFs=Write XMP-metadata to PDFs
-Font\ size\:=Font size\:
Override\ default\ font\ settings=Override default font settings
Clear\ search=Clear search
@@ -2116,3 +2104,22 @@ New\ column=New column
Open\ files...=Open files...
Affected\ fields\:=Affected fields:
+Show\ preview\ as\ a\ tab\ in\ entry\ editor=Show preview as a tab in entry editor
+Font=Font
+Visual\ theme=Visual theme
+Light\ theme=Light theme
+Dark\ theme=Dark theme
+Overwrite\ existing\ keys=Overwrite existing keys
+Key\ patterns=Key patterns
+Size\:=Size:
+Font\ settings=Font settings
+Override\ font\ settings=Override font settings
+Override\ font\ size=Override font size
+Theme\ changed\:=Theme changed\:
+You\ must\ enter\ an\ integer\ value\ higher\ than\ 8.=You must enter an integer value higher than 8.
+Letters\ after\ duplicate\ generated\ keys=Letters after duplicate generated keys
+Start\ on\ second\ duplicate\ key\ with\ letter\ A\ (a,\ b,\ ...)=Start on second duplicate key with letter A (a, b, ...)
+Start\ on\ second\ duplicate\ key\ with\ letter\ B\ (b,\ c,\ ...)=Start on second duplicate key with letter B (b, c, ...)
+Always\ add\ letter\ (a,\ b,\ ...)\ to\ generated\ keys=Always add letter (a, b, ...) to generated keys
+Default\ pattern=Default pattern
+Reset\ %s\ to\ default\ value=Reset %s to default value
diff --git a/src/test/java/module-info.test b/src/test/java/module-info.test
index 61209986e75..a46242d0d34 100644
--- a/src/test/java/module-info.test
+++ b/src/test/java/module-info.test
@@ -34,3 +34,9 @@
--add-opens
// Needed for localization tests
javafx.fxml/javafx.fxml=org.jabref
+
+--add-modules
+ io.github.classgraph
+
+--add-reads
+ org.jabref=io.github.classgraph
diff --git a/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java b/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java
index 1f3cc1a5f6d..986165ad0ee 100644
--- a/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java
+++ b/src/test/java/org/jabref/logic/importer/FulltextFetchersTest.java
@@ -3,8 +3,8 @@
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
-import java.util.Arrays;
import java.util.Optional;
+import java.util.Set;
import org.jabref.logic.importer.fetcher.TrustLevel;
import org.jabref.model.entry.BibEntry;
@@ -34,8 +34,7 @@ public void tearDown() {
public void acceptPdfUrls() throws MalformedURLException {
URL pdfUrl = new URL("http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.pdf");
FulltextFetcher finder = (e) -> Optional.of(pdfUrl);
- FulltextFetchers fetcher = new FulltextFetchers(Arrays.asList(finder));
-
+ FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder));
assertEquals(Optional.of(pdfUrl), fetcher.findFullTextPDF(entry));
}
@@ -43,7 +42,7 @@ public void acceptPdfUrls() throws MalformedURLException {
public void rejectNonPdfUrls() throws MalformedURLException {
URL pdfUrl = new URL("https://github.com/JabRef/jabref/blob/master/README.md");
FulltextFetcher finder = (e) -> Optional.of(pdfUrl);
- FulltextFetchers fetcher = new FulltextFetchers(Arrays.asList(finder));
+ FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder));
assertEquals(Optional.empty(), fetcher.findFullTextPDF(entry));
}
@@ -52,7 +51,7 @@ public void rejectNonPdfUrls() throws MalformedURLException {
public void noTrustLevel() throws MalformedURLException {
URL pdfUrl = new URL("http://docs.oasis-open.org/wsbpel/2.0/OS/wsbpel-v2.0-OS.pdf");
FulltextFetcher finder = (e) -> Optional.of(pdfUrl);
- FulltextFetchers fetcher = new FulltextFetchers(Arrays.asList(finder));
+ FulltextFetchers fetcher = new FulltextFetchers(Set.of(finder));
assertEquals(Optional.of(pdfUrl), fetcher.findFullTextPDF(entry));
}
@@ -69,7 +68,7 @@ public void higherTrustLevelWins() throws MalformedURLException, IOException, Fe
when(finderHigh.findFullText(entry)).thenReturn(Optional.of(highUrl));
when(finderLow.findFullText(entry)).thenReturn(Optional.of(lowUrl));
- FulltextFetchers fetcher = new FulltextFetchers(Arrays.asList(finderLow, finderHigh));
+ FulltextFetchers fetcher = new FulltextFetchers(Set.of(finderLow, finderHigh));
assertEquals(Optional.of(highUrl), fetcher.findFullTextPDF(entry));
}
diff --git a/src/test/java/org/jabref/logic/importer/WebFetchersTest.java b/src/test/java/org/jabref/logic/importer/WebFetchersTest.java
index 52eb02bbc46..b5d93a2be54 100644
--- a/src/test/java/org/jabref/logic/importer/WebFetchersTest.java
+++ b/src/test/java/org/jabref/logic/importer/WebFetchersTest.java
@@ -1,6 +1,6 @@
package org.jabref.logic.importer;
-import java.util.List;
+import java.util.Collection;
import java.util.Set;
import java.util.stream.Collectors;
@@ -10,20 +10,19 @@
import org.jabref.logic.importer.fetcher.IsbnViaOttoBibFetcher;
import org.jabref.logic.importer.fetcher.MrDLibFetcher;
+import io.github.classgraph.ClassGraph;
+import io.github.classgraph.ClassInfoList;
+import io.github.classgraph.ScanResult;
import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
-import org.reflections.Reflections;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.mockito.Mockito.mock;
-// TODO: Reenable as soon as https://github.com/ronmamo/reflections/issues/202 is fixed
-@Disabled
class WebFetchersTest {
- private Reflections reflections = new Reflections("org.jabref");
private ImportFormatPreferences importFormatPreferences;
+ private ClassGraph classGraph = new ClassGraph().enableAllInfo().whitelistPackages("org.jabref");
@BeforeEach
void setUp() throws Exception {
@@ -32,55 +31,74 @@ void setUp() throws Exception {
@Test
void getIdBasedFetchersReturnsAllFetcherDerivingFromIdBasedFetcher() throws Exception {
- List idFetchers = WebFetchers.getIdBasedFetchers(importFormatPreferences);
-
- Set> expected = reflections.getSubTypesOf(IdBasedFetcher.class);
- expected.remove(AbstractIsbnFetcher.class);
- expected.remove(IdBasedParserFetcher.class);
- // Remove special ISBN fetcher since we don't want to expose them to the user
- expected.remove(IsbnViaChimboriFetcher.class);
- expected.remove(IsbnViaEbookDeFetcher.class);
- expected.remove(IsbnViaOttoBibFetcher.class);
- assertEquals(expected, getClasses(idFetchers));
+ Set idFetchers = WebFetchers.getIdBasedFetchers(importFormatPreferences);
+
+ try (ScanResult scanResult = classGraph.scan()) {
+
+ ClassInfoList controlClasses = scanResult.getClassesImplementing(IdBasedFetcher.class.getCanonicalName());
+ Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet());
+
+ expected.remove(AbstractIsbnFetcher.class);
+ expected.remove(IdBasedParserFetcher.class);
+ // Remove special ISBN fetcher since we don't want to expose them to the user
+ expected.remove(IsbnViaChimboriFetcher.class);
+ expected.remove(IsbnViaEbookDeFetcher.class);
+ expected.remove(IsbnViaOttoBibFetcher.class);
+ assertEquals(expected, getClasses(idFetchers));
+ }
}
@Test
void getEntryBasedFetchersReturnsAllFetcherDerivingFromEntryBasedFetcher() throws Exception {
- List idFetchers = WebFetchers.getEntryBasedFetchers(importFormatPreferences);
+ Set idFetchers = WebFetchers.getEntryBasedFetchers(importFormatPreferences);
- Set> expected = reflections.getSubTypesOf(EntryBasedFetcher.class);
- expected.remove(EntryBasedParserFetcher.class);
- expected.remove(MrDLibFetcher.class);
- assertEquals(expected, getClasses(idFetchers));
+ try (ScanResult scanResult = classGraph.scan()) {
+ ClassInfoList controlClasses = scanResult.getClassesImplementing(EntryBasedFetcher.class.getCanonicalName());
+ Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet());
+
+ expected.remove(EntryBasedParserFetcher.class);
+ expected.remove(MrDLibFetcher.class);
+ assertEquals(expected, getClasses(idFetchers));
+ }
}
@Test
void getSearchBasedFetchersReturnsAllFetcherDerivingFromSearchBasedFetcher() throws Exception {
- List searchBasedFetchers = WebFetchers.getSearchBasedFetchers(importFormatPreferences);
-
- Set> expected = reflections.getSubTypesOf(SearchBasedFetcher.class);
- expected.remove(SearchBasedParserFetcher.class);
- assertEquals(expected, getClasses(searchBasedFetchers));
+ Set searchBasedFetchers = WebFetchers.getSearchBasedFetchers(importFormatPreferences);
+ try (ScanResult scanResult = classGraph.scan()) {
+ ClassInfoList controlClasses = scanResult.getClassesImplementing(SearchBasedFetcher.class.getCanonicalName());
+ Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet());
+
+ expected.remove(SearchBasedParserFetcher.class);
+ assertEquals(expected, getClasses(searchBasedFetchers));
+ }
}
@Test
void getFullTextFetchersReturnsAllFetcherDerivingFromFullTextFetcher() throws Exception {
- List fullTextFetchers = WebFetchers.getFullTextFetchers(importFormatPreferences);
+ Set fullTextFetchers = WebFetchers.getFullTextFetchers(importFormatPreferences);
- Set> expected = reflections.getSubTypesOf(FulltextFetcher.class);
- assertEquals(expected, getClasses(fullTextFetchers));
+ try (ScanResult scanResult = classGraph.scan()) {
+ ClassInfoList controlClasses = scanResult.getClassesImplementing(FulltextFetcher.class.getCanonicalName());
+ Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet());
+ assertEquals(expected, getClasses(fullTextFetchers));
+ }
}
@Test
void getIdFetchersReturnsAllFetcherDerivingFromIdFetcher() throws Exception {
- List idFetchers = WebFetchers.getIdFetchers(importFormatPreferences);
+ Set idFetchers = WebFetchers.getIdFetchers(importFormatPreferences);
+
+ try (ScanResult scanResult = classGraph.scan()) {
+ ClassInfoList controlClasses = scanResult.getClassesImplementing(IdFetcher.class.getCanonicalName());
+ Set> expected = controlClasses.loadClasses().stream().collect(Collectors.toSet());
- Set> expected = reflections.getSubTypesOf(IdFetcher.class);
- expected.remove(IdParserFetcher.class);
- assertEquals(expected, getClasses(idFetchers));
+ expected.remove(IdParserFetcher.class);
+ assertEquals(expected, getClasses(idFetchers));
+ }
}
- private Set extends Class>> getClasses(List> objects) {
+ private Set extends Class>> getClasses(Collection> objects) {
return objects.stream().map(Object::getClass).collect(Collectors.toSet());
}
}
diff --git a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java
index 20e70601800..183e011a84b 100644
--- a/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java
+++ b/src/test/java/org/jabref/logic/importer/fetcher/FulltextFetcherTest.java
@@ -1,7 +1,7 @@
package org.jabref.logic.importer.fetcher;
-import java.util.List;
import java.util.Optional;
+import java.util.Set;
import org.jabref.logic.importer.FulltextFetcher;
import org.jabref.logic.importer.ImportFormatPreferences;
@@ -18,7 +18,7 @@
class FulltextFetcherTest {
@SuppressWarnings("unused")
- private static List fetcherProvider() {
+ private static Set fetcherProvider() {
return WebFetchers.getFullTextFetchers(mock(ImportFormatPreferences.class));
}
diff --git a/src/test/java/org/jabref/model/database/BibDatabaseTest.java b/src/test/java/org/jabref/model/database/BibDatabaseTest.java
index a790027e58b..4d747877e31 100644
--- a/src/test/java/org/jabref/model/database/BibDatabaseTest.java
+++ b/src/test/java/org/jabref/model/database/BibDatabaseTest.java
@@ -174,8 +174,19 @@ public void insertEntryPostsAddedEntryEvent() {
TestEventListener tel = new TestEventListener();
database.registerListener(tel);
database.insertEntry(expectedEntry);
- BibEntry actualEntry = tel.getBibEntry();
- assertEquals(expectedEntry, actualEntry);
+ assertEquals(expectedEntry, tel.getAddedEntry());
+ assertEquals(expectedEntry, tel.getFirstInsertedEntry());
+ }
+
+ @Test
+ public void insertMultipleEntriesPostsAddedEntryEvent() {
+ BibEntry firstEntry = new BibEntry();
+ BibEntry secondEntry = new BibEntry();
+ TestEventListener tel = new TestEventListener();
+ database.registerListener(tel);
+ database.insertEntries(firstEntry, secondEntry);
+ assertEquals(firstEntry, tel.getFirstInsertedEntry());
+ assertEquals(secondEntry, tel.getAddedEntry());
}
@Test
@@ -185,7 +196,7 @@ public void removeEntryPostsRemovedEntryEvent() {
database.insertEntry(expectedEntry);
database.registerListener(tel);
database.removeEntry(expectedEntry);
- BibEntry actualEntry = tel.getBibEntry();
+ BibEntry actualEntry = tel.getRemovedEntry();
assertEquals(expectedEntry, actualEntry);
}
@@ -198,7 +209,7 @@ public void changingEntryPostsChangeEntryEvent() {
entry.setField(new UnknownField("test"), "some value");
- assertEquals(entry, tel.getBibEntry());
+ assertEquals(entry, tel.getChangedEntry());
}
@Test
diff --git a/src/test/java/org/jabref/model/event/TestEventListener.java b/src/test/java/org/jabref/model/event/TestEventListener.java
index c8e3b2cd1d5..98cd144dd0d 100644
--- a/src/test/java/org/jabref/model/event/TestEventListener.java
+++ b/src/test/java/org/jabref/model/event/TestEventListener.java
@@ -1,5 +1,6 @@
package org.jabref.model.event;
+import org.jabref.model.database.event.AllInsertsFinishedEvent;
import org.jabref.model.database.event.EntryAddedEvent;
import org.jabref.model.database.event.EntryRemovedEvent;
import org.jabref.model.entry.BibEntry;
@@ -9,24 +10,44 @@
public class TestEventListener {
- private BibEntry bibEntry;
+ private BibEntry addedEntry;
+ private BibEntry firstInsertedEntry;
+ private BibEntry removedEntry;
+ private BibEntry changedEntry;
@Subscribe
public void listen(EntryAddedEvent event) {
- this.bibEntry = event.getBibEntry();
+ this.addedEntry = event.getBibEntry();
+ }
+
+ @Subscribe
+ public void listen(AllInsertsFinishedEvent event) {
+ this.firstInsertedEntry = event.getBibEntry();
}
@Subscribe
public void listen(EntryRemovedEvent event) {
- this.bibEntry = event.getBibEntry();
+ this.removedEntry = event.getBibEntry();
}
@Subscribe
public void listen(EntryChangedEvent event) {
- this.bibEntry = event.getBibEntry();
+ this.changedEntry = event.getBibEntry();
+ }
+
+ public BibEntry getAddedEntry() {
+ return addedEntry;
+ }
+
+ public BibEntry getFirstInsertedEntry() {
+ return firstInsertedEntry;
+ }
+
+ public BibEntry getRemovedEntry() {
+ return removedEntry;
}
- public BibEntry getBibEntry() {
- return this.bibEntry;
+ public BibEntry getChangedEntry() {
+ return changedEntry;
}
}