Skip to content

Commit

Permalink
Fixed issue JabRef#10418
Browse files Browse the repository at this point in the history
  • Loading branch information
ExrosZ-Alt committed Oct 17, 2024
1 parent e7f18d3 commit 778ea95
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 11 deletions.
9 changes: 1 addition & 8 deletions src/main/java/org/jabref/gui/LibraryTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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<BibEntry, Integer> 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;
Expand Down Expand Up @@ -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));
}
}
}
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/org/jabref/gui/groups/GroupNodeViewModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand All @@ -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());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -112,6 +114,8 @@ public BooleanProperty addModificationDateProperty() {
return addModificationDateProperty;
}

// View analysis

public static BooleanProperty trackViewsProperty() {
return trackViewsProperty;
}
Expand All @@ -120,8 +124,6 @@ public void setTrackViewsEnabled(boolean enabled) {
trackViewsProperty.set(enabled);
}

// Vew Analysis

public void setAnalysisEnabled(boolean enabled) {
analysisProperty.set(enabled);
}
Expand Down

0 comments on commit 778ea95

Please sign in to comment.