From 778ea95221214aeeb5867064c77a238d52518eb7 Mon Sep 17 00:00:00 2001 From: Harrison Black Date: Fri, 18 Oct 2024 01:42:42 +1100 Subject: [PATCH] Fixed issue #10418 --- src/main/java/org/jabref/gui/LibraryTab.java | 9 +-------- .../org/jabref/gui/groups/GroupNodeViewModel.java | 11 +++++++++++ .../gui/preferences/entry/EntryTabViewModel.java | 8 +++++--- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/jabref/gui/LibraryTab.java b/src/main/java/org/jabref/gui/LibraryTab.java index 70accf322f1f..79025d26d5e3 100644 --- a/src/main/java/org/jabref/gui/LibraryTab.java +++ b/src/main/java/org/jabref/gui/LibraryTab.java @@ -3,7 +3,6 @@ import java.io.IOException; import java.nio.file.Path; import java.util.Collections; -import java.util.Hashtable; import java.util.List; import java.util.Objects; import java.util.Optional; @@ -160,9 +159,8 @@ private enum PanelMode { MAIN_TABLE, MAIN_TABLE_AND_ENTRY_EDITOR } private SuggestionProviders suggestionProviders; // Used to track how many views each attachment has. - private Hashtable viewCountTable = new Hashtable<>(); private final Path viewStorePath = NativeDesktop.getOtherDataDir().resolve("tracking.mv"); - private static final ReentrantLock fileLock = new ReentrantLock(); + private final ReentrantLock fileLock = new ReentrantLock(); @SuppressWarnings({"FieldCanBeLocal"}) private Subscription dividerPositionSubscription; @@ -1231,11 +1229,6 @@ private void incrementViewCount(BibEntry entry) { viewCounts.put(uniqueKey, currentCount + 1); lastViewTimestamps.put(uniqueKey, currentTime); mvStore.commit(); // Save changes - - // Debugging, remove when all good - System.out.println("BibEntry: " + entry); - System.out.println("UniqueKey: " + uniqueKey); - System.out.println(PopularityGroup.getEntryViewCount(entry)); } } } diff --git a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java index cc64665235f4..46f3ba4cfc17 100644 --- a/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java +++ b/src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java @@ -43,6 +43,7 @@ import org.jabref.model.groups.GroupTreeNode; import org.jabref.model.groups.KeywordGroup; import org.jabref.model.groups.LastNameGroup; +import org.jabref.model.groups.PopularityGroup; import org.jabref.model.groups.RegexKeywordGroup; import org.jabref.model.groups.SearchGroup; import org.jabref.model.groups.TexGroup; @@ -431,6 +432,8 @@ public boolean canAddEntriesIn() { return false; } else if (group instanceof TexGroup) { return false; + } else if (group instanceof PopularityGroup) { + return false; } else { throw new UnsupportedOperationException("canAddEntriesIn method not yet implemented in group: " + group.getClass().getName()); } @@ -456,6 +459,8 @@ public boolean canBeDragged() { return true; } else if (group instanceof TexGroup) { return true; + } else if (group instanceof PopularityGroup) { + return true; } else { throw new UnsupportedOperationException("canBeDragged method not yet implemented in group: " + group.getClass().getName()); } @@ -481,6 +486,8 @@ public boolean canAddGroupsIn() { return false; } else if (group instanceof TexGroup) { return true; + } else if (group instanceof PopularityGroup) { + return false; } else { throw new UnsupportedOperationException("canAddGroupsIn method not yet implemented in group: " + group.getClass().getName()); } @@ -506,6 +513,8 @@ public boolean canRemove() { return true; } else if (group instanceof TexGroup) { return true; + } else if (group instanceof PopularityGroup) { + return true; } else { throw new UnsupportedOperationException("canRemove method not yet implemented in group: " + group.getClass().getName()); } @@ -531,6 +540,8 @@ public boolean isEditable() { return true; } else if (group instanceof TexGroup) { return true; + } else if (group instanceof PopularityGroup) { + return true; } else { throw new UnsupportedOperationException("isEditable method not yet implemented in group: " + group.getClass().getName()); } diff --git a/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java b/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java index 4ae9266ea8e6..55a61a12bdc3 100644 --- a/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java +++ b/src/main/java/org/jabref/gui/preferences/entry/EntryTabViewModel.java @@ -21,12 +21,14 @@ public class EntryTabViewModel implements PreferenceTabViewModel { private final StringProperty resolveStringsForFieldsProperty = new SimpleStringProperty(""); private final StringProperty nonWrappableFieldsProperty = new SimpleStringProperty(""); - private static final BooleanProperty analysisProperty = new SimpleBooleanProperty(); private final BooleanProperty markOwnerProperty = new SimpleBooleanProperty(); private final StringProperty markOwnerNameProperty = new SimpleStringProperty(""); private final BooleanProperty markOwnerOverwriteProperty = new SimpleBooleanProperty(); private final BooleanProperty addCreationDateProperty = new SimpleBooleanProperty(); private final BooleanProperty addModificationDateProperty = new SimpleBooleanProperty(); + + // TODO: Change these from static variables 18/10/2024 + private static final BooleanProperty analysisProperty = new SimpleBooleanProperty(); private static final BooleanProperty trackViewsProperty = new SimpleBooleanProperty(); private final FieldPreferences fieldPreferences; @@ -112,6 +114,8 @@ public BooleanProperty addModificationDateProperty() { return addModificationDateProperty; } + // View analysis + public static BooleanProperty trackViewsProperty() { return trackViewsProperty; } @@ -120,8 +124,6 @@ public void setTrackViewsEnabled(boolean enabled) { trackViewsProperty.set(enabled); } - // Vew Analysis - public void setAnalysisEnabled(boolean enabled) { analysisProperty.set(enabled); }