Skip to content

Commit

Permalink
Merge "All-Comments" into tab "Comments"
Browse files Browse the repository at this point in the history
  • Loading branch information
koppor committed Jun 6, 2023
1 parent 2d3ac52 commit 30e01c4
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 17 deletions.
3 changes: 2 additions & 1 deletion src/main/java/org/jabref/gui/entryeditor/CommentsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.jabref.preferences.PreferencesService;

public class CommentsTab extends FieldsEditorTab {
public static final String NAME = "Comments";

private final String name;
public CommentsTab(PreferencesService preferences,
Expand Down Expand Up @@ -55,7 +56,7 @@ public CommentsTab(PreferencesService preferences,
this.name = preferences.getOwnerPreferences().getDefaultOwner();
setText(Localization.lang("All comments"));
setTooltip(new Tooltip(Localization.lang("Display all comments")));
setGraphic(IconTheme.JabRefIcons.REQUIRED.getGraphicNode());
setGraphic(IconTheme.JabRefIcons.COMMENT.getGraphicNode());
}

protected Set<Field> determineFieldsToShow(BibEntry entry) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

public class DeprecatedFieldsTab extends FieldsEditorTab {

public static final String NAME = "Deprecated fields";
private final BibEntryTypesManager entryTypesManager;

public DeprecatedFieldsTab(BibDatabaseContext databaseContext,
Expand Down
32 changes: 20 additions & 12 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.File;
import java.nio.file.Path;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
Expand Down Expand Up @@ -245,35 +246,43 @@ private void navigateToNextEntry() {
}

private List<EntryEditorTab> createTabs() {
// Preview tab
entryEditorTabs.add(new PreviewTab(databaseContext, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager()));

// Required fields
// Required, optional, deprecated, and "other" fields
entryEditorTabs.add(new RequiredFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, taskExecutor, journalAbbreviationRepository));

// Optional fields
entryEditorTabs.add(new OptionalFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, taskExecutor, journalAbbreviationRepository));
entryEditorTabs.add(new OptionalFields2Tab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, taskExecutor, journalAbbreviationRepository));
entryEditorTabs.add(new DeprecatedFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, taskExecutor, journalAbbreviationRepository));

// Other fields
entryEditorTabs.add(new OtherFieldsTab(databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), bibEntryTypesManager, taskExecutor, journalAbbreviationRepository));

// Comment Tab
// Tab for general and user-specific comments
// Comment Tab: Tab for general and user-specific comments
entryEditorTabs.add(new CommentsTab(preferencesService, databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), taskExecutor, journalAbbreviationRepository));

// General fields from preferences
for (Map.Entry<String, Set<Field>> tab : entryEditorPreferences.getEntryEditorTabList().entrySet()) {
// First, remove all tabs that are already handled above or below; except for the source tab (which has different titles for BibTeX and BibLaTeX mode)
Map<String, Set<Field>> entryEditorTabList = new HashMap<>(entryEditorPreferences.getEntryEditorTabList());
entryEditorTabList.remove(PreviewTab.NAME);
entryEditorTabList.remove(RequiredFieldsTab.NAME);
entryEditorTabList.remove(OptionalFieldsTab.NAME);
entryEditorTabList.remove(OptionalFields2Tab.NAME);
entryEditorTabList.remove(DeprecatedFieldsTab.NAME);
entryEditorTabList.remove(CommentsTab.NAME);
entryEditorTabList.remove(MathSciNetTab.NAME);
entryEditorTabList.remove(FileAnnotationTab.NAME);
entryEditorTabList.remove(RelatedArticlesTab.NAME);
entryEditorTabList.remove(LatexCitationsTab.NAME);
entryEditorTabList.remove(FulltextSearchResultsTab.NAME);
entryEditorTabList.remove("Comments");
// Then show the remaining configured
for (Map.Entry<String, Set<Field>> tab : entryEditorTabList.entrySet()) {
entryEditorTabs.add(new UserDefinedFieldsTab(tab.getKey(), tab.getValue(), databaseContext, libraryTab.getSuggestionProviders(), undoManager, dialogService, preferencesService, stateManager, themeManager, libraryTab.getIndexingTaskManager(), taskExecutor, journalAbbreviationRepository));
}

// Special tabs
// "Special" tabs
entryEditorTabs.add(new MathSciNetTab());
entryEditorTabs.add(new FileAnnotationTab(libraryTab.getAnnotationCache()));
entryEditorTabs.add(new RelatedArticlesTab(this, entryEditorPreferences, preferencesService, dialogService));

// Source tab
sourceTab = new SourceTab(
databaseContext,
undoManager,
Expand All @@ -285,7 +294,6 @@ private List<EntryEditorTab> createTabs() {
keyBindingRepository);
entryEditorTabs.add(sourceTab);

// LaTeX citations tab
entryEditorTabs.add(new LatexCitationsTab(databaseContext, preferencesService, taskExecutor, dialogService));

entryEditorTabs.add(new FulltextSearchResultsTab(stateManager, preferencesService, dialogService));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@

public class LatexCitationsTab extends EntryEditorTab {

public static final String NAME = "LaTeX Citations";
private final LatexCitationsTabViewModel viewModel;
private final GridPane searchPane;
private final ProgressIndicator progressIndicator;
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/org/jabref/gui/entryeditor/MathSciNetTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

public class MathSciNetTab extends EntryEditorTab {

public static final String NAME = "MathSciNet Review";

public MathSciNetTab() {
setText(Localization.lang("MathSciNet Review"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.jabref.preferences.PreferencesService;

public class OptionalFields2Tab extends OptionalFieldsTabBase {

public static final String NAME = "Optional fields 2";

public OptionalFields2Tab(BibDatabaseContext databaseContext,
SuggestionProviders suggestionProviders,
UndoManager undoManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.jabref.preferences.PreferencesService;

public class OptionalFieldsTab extends OptionalFieldsTabBase {

public static final String NAME = "Optional fields";

public OptionalFieldsTab(BibDatabaseContext databaseContext,
SuggestionProviders suggestionProviders,
UndoManager undoManager,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

public class OtherFieldsTab extends FieldsEditorTab {

public static final String NAME = "Other fields";
private final List<Field> customTabFieldNames;
private final BibEntryTypesManager entryTypesManager;

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/entryeditor/PreviewTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jabref.preferences.PreferencesService;

public class PreviewTab extends EntryEditorTab {
public static final String NAME = "Preview";
private final DialogService dialogService;
private final BibDatabaseContext databaseContext;
private final PreferencesService preferences;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
*/
public class RelatedArticlesTab extends EntryEditorTab {

public static final String NAME = "Related articles";
private static final Logger LOGGER = LoggerFactory.getLogger(RelatedArticlesTab.class);
private final EntryEditorPreferences preferences;
private final DialogService dialogService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

public class RequiredFieldsTab extends FieldsEditorTab {

public static final String NAME = "Required fields";
private final BibEntryTypesManager entryTypesManager;

public RequiredFieldsTab(BibDatabaseContext databaseContext,
Expand All @@ -44,7 +45,6 @@ public RequiredFieldsTab(BibDatabaseContext databaseContext,
super(false, databaseContext, suggestionProviders, undoManager, dialogService,
preferences, stateManager, themeManager, taskExecutor, journalAbbreviationRepository, indexingTaskManager);
this.entryTypesManager = entryTypesManager;

setText(Localization.lang("Required fields"));
setTooltip(new Tooltip(Localization.lang("Show required fields")));
setGraphic(IconTheme.JabRefIcons.REQUIRED.getGraphicNode());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

public class FileAnnotationTab extends EntryEditorTab {

public static final String NAME = "File annotations";
private final FileAnnotationCache fileAnnotationCache;

public FileAnnotationTab(FileAnnotationCache cache) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

public class FulltextSearchResultsTab extends EntryEditorTab {

public static final String NAME = "Search results";
private static final Logger LOGGER = LoggerFactory.getLogger(FulltextSearchResultsTab.class);

private final StateManager stateManager;
Expand Down
3 changes: 0 additions & 3 deletions src/main/resources/l10n/JabRef_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2530,8 +2530,5 @@ Delete\ %0\ files\ permanently\ from\ disk,\ or\ just\ remove\ the\ files\ from\
Error\ accessing\ file\ '%0'.=Error accessing file '%0'.
This\ operation\ requires\ selected\ linked\ files.=This operation requires selected linked files.
All\ comments=All comments
Display\ all\ comments=Display all comments
Create\ backup=Create backup
Automatically\ search\ and\ show\ unlinked\ files\ in\ the\ entry\ editor=Automatically search and show unlinked files in the entry editor

0 comments on commit 30e01c4

Please sign in to comment.