Skip to content

Commit

Permalink
Refactor different Entry types (#5203)
Browse files Browse the repository at this point in the history
* fix: IEEETRANBSTCTL belongs to IEEE types not standard BibTeX types

* refactor: reintroduce standard entry type
  • Loading branch information
stefan-kolb authored Aug 23, 2019
1 parent b8c3800 commit bbf3ab4
Show file tree
Hide file tree
Showing 145 changed files with 310 additions and 278 deletions.
14 changes: 7 additions & 7 deletions src/main/java/org/jabref/gui/EntryTypeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryType;
import org.jabref.model.entry.BiblatexEntryTypes;
import org.jabref.model.entry.BibtexEntryTypes;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.IEEETranEntryTypes;
import org.jabref.model.entry.types.BiblatexEntryTypeDefinitions;
import org.jabref.model.entry.types.BibtexEntryTypeDefinitions;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions;
import org.jabref.preferences.JabRefPreferences;

import com.airhacks.afterburner.views.ViewLoader;
Expand Down Expand Up @@ -120,7 +120,7 @@ public void initialize() {
customTitlePane.managedProperty().bind(customTitlePane.visibleProperty());

if (basePanel.getBibDatabaseContext().isBiblatexMode()) {
addEntriesToPane(biblatexPane, BiblatexEntryTypes.ALL);
addEntriesToPane(biblatexPane, BiblatexEntryTypeDefinitions.ALL);

bibTexTitlePane.setVisible(false);
ieeeTranTitlePane.setVisible(false);
Expand All @@ -134,8 +134,8 @@ public void initialize() {

} else {
biblatexTitlePane.setVisible(false);
addEntriesToPane(bibTexPane, BibtexEntryTypes.ALL);
addEntriesToPane(ieeetranPane, IEEETranEntryTypes.ALL);
addEntriesToPane(bibTexPane, BibtexEntryTypeDefinitions.ALL);
addEntriesToPane(ieeetranPane, IEEETranEntryTypeDefinitions.ALL);

List<BibEntryType> customTypes = Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX);
if (customTypes.isEmpty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.database.shared.DatabaseLocation;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.SpecialField;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.preferences.JabRefPreferences;
import org.jabref.preferences.LastFocusedTabPreferences;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryType;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;
import org.jabref.preferences.JabRefPreferences;

public class BibtexKeyPatternPanel extends Pane {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import javafx.scene.control.Tab;

import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;

public abstract class EntryEditorTab extends Tab {

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/gui/fieldeditors/FieldEditors.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@
import org.jabref.logic.integrity.FieldCheckers;
import org.jabref.logic.journals.JournalAbbreviationRepository;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.FieldProperty;
import org.jabref.model.entry.field.InternalField;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.IEEETranEntryType;
import org.jabref.model.metadata.MetaData;
import org.jabref.preferences.JabRefPreferences;

Expand Down Expand Up @@ -79,7 +79,7 @@ public static FieldEditorFX getForField(final Field field,
} else if (fieldProperties.contains(FieldProperty.PAGINATION)) {
return new OptionEditor<>(new PaginationEditorViewModel(field, suggestionProvider, fieldCheckers));
} else if (fieldProperties.contains(FieldProperty.TYPE)) {
if (entryType.equals(StandardEntryType.Patent)) {
if (entryType.equals(IEEETranEntryType.Patent)) {
return new OptionEditor<>(new PatentTypeEditorViewModel(field, suggestionProvider, fieldCheckers));
} else {
return new OptionEditor<>(new TypeEditorViewModel(field, suggestionProvider, fieldCheckers));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import org.jabref.Globals;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntryType;
import org.jabref.model.entry.EntryTypeFactory;
import org.jabref.model.entry.types.EntryTypeFactory;
import org.jabref.preferences.PreferencesService;

public class ImportCustomEntryTypesDialogViewModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.model.util.FileUpdateMonitor;
import org.jabref.preferences.PreferencesService;

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/gui/importer/NewEntryAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.jabref.gui.StateManager;
import org.jabref.gui.actions.SimpleCommand;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;
import org.jabref.preferences.JabRefPreferences;

import org.slf4j.Logger;
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/org/jabref/gui/menus/ChangeEntryTypeMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.BibEntryType;
import org.jabref.model.entry.BibtexEntryTypes;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.IEEETranEntryTypes;
import org.jabref.model.entry.types.BibtexEntryTypeDefinitions;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.IEEETranEntryTypeDefinitions;

public class ChangeEntryTypeMenu {

Expand Down Expand Up @@ -63,11 +63,11 @@ private void populateComplete(ObservableList<MenuItem> items, BibEntry entry, Bi
populateSubMenu(items, Localization.lang("Custom"), Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBLATEX), entry, undoManager);
} else {
// Default BibTeX
populateSubMenu(items, BibDatabaseMode.BIBTEX.getFormattedName(), BibtexEntryTypes.ALL, entry, undoManager);
populateSubMenu(items, BibDatabaseMode.BIBTEX.getFormattedName(), BibtexEntryTypeDefinitions.ALL, entry, undoManager);
items.remove(0); // Remove separator

// IEEETran
populateSubMenu(items, "IEEETran", IEEETranEntryTypes.ALL, entry, undoManager);
populateSubMenu(items, "IEEETran", IEEETranEntryTypeDefinitions.ALL, entry, undoManager);

// Custom types
populateSubMenu(items, Localization.lang("Custom"), Globals.entryTypesManager.getAllCustomTypes(BibDatabaseMode.BIBTEX), entry, undoManager);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
import org.jabref.logic.importer.WebFetchers;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.EntryType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/org/jabref/gui/preferences/AdvancedTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<?import org.controlsfx.control.textfield.CustomPasswordField?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.AdvancedTabView">
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/org/jabref/gui/preferences/ExternalTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<?import javafx.scene.control.Tooltip?>
<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.ExternalTabView">
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/preferences/FileTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.FileTabView">
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/preferences/GeneralTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.GeneralTabView">
Expand Down
4 changes: 1 addition & 3 deletions src/main/java/org/jabref/gui/preferences/GroupsTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,11 @@
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.RadioButton?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.control.ToggleGroup?>
<?import javafx.scene.layout.ColumnConstraints?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.layout.RowConstraints?>
<?import javafx.scene.layout.VBox?>

<?import javafx.scene.control.ToggleGroup?>

<fx:root prefWidth="650.0" spacing="10.0" type="VBox"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.GroupsTabView">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
<?import javafx.scene.control.SplitPane?>
<?import javafx.scene.control.Tooltip?>
<?import javafx.scene.layout.VBox?>

<?import org.controlsfx.control.textfield.CustomTextField?>

<DialogPane prefHeight="700.0" prefWidth="1100.0" minHeight="400" minWidth="600"
xmlns="http://javafx.com/javafx/8.0.212" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.preferences.PreferencesDialogView">
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/org/jabref/gui/preferences/PreviewTab.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.ListView?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>

<?import org.fxmisc.richtext.CodeArea?>

<?import org.fxmisc.flowless.VirtualizedScrollPane?>
<?import javafx.scene.control.TabPane?>
<?import javafx.scene.control.Tab?>
<?import javafx.scene.layout.AnchorPane?>

<?import org.fxmisc.richtext.CodeArea?>
<fx:root prefWidth="650.0" spacing="4.0" type="VBox" xmlns="http://javafx.com/javafx/8.0.212"
xmlns:fx="http://javafx.com/fxml/1" fx:controller="org.jabref.gui.preferences.PreviewTabView">
<children>
Expand Down
1 change: 0 additions & 1 deletion src/main/java/org/jabref/gui/texparser/ParseTexDialog.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.layout.VBox?>
<?import org.controlsfx.control.CheckTreeView?>

<DialogPane xmlns="http://javafx.com/javafx/8.0.171" xmlns:fx="http://javafx.com/fxml/1"
fx:controller="org.jabref.gui.texparser.ParseTexDialogView"
prefWidth="500.0" prefHeight="650.0">
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/gui/undo/UndoableChangeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import org.jabref.logic.l10n.Localization;
import org.jabref.model.FieldChange;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.EntryTypeFactory;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.EntryTypeFactory;
import org.jabref.model.strings.StringUtil;

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.strings.StringUtil;

import org.slf4j.Logger;
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/logic/exporter/BibTeXMLExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.StandardEntryType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -76,7 +77,7 @@ public void export(final BibDatabaseContext databaseContext, final Path resultFi

bibEntry.getCiteKeyOptional().ifPresent(entry::setId);

org.jabref.model.entry.EntryType i = bibEntry.getType();
EntryType i = bibEntry.getType();
if (StandardEntryType.Article.equals(i)) {
parse(new Article(), bibEntry, entry);
} else if (StandardEntryType.Book.equals(i)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import org.jabref.model.bibtexkeypattern.AbstractBibtexKeyPattern;
import org.jabref.model.bibtexkeypattern.GlobalBibtexKeyPattern;
import org.jabref.model.cleanup.FieldFormatterCleanups;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.metadata.ContentSelector;
import org.jabref.model.metadata.MetaData;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/exporter/ModsExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,10 @@
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.field.UnknownField;
import org.jabref.model.entry.types.EntryType;

/**
* TemplateExporter for exporting in MODS XML format.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.types.EntryType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/importer/fetcher/ArXiv.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
import org.jabref.logic.util.strings.StringSimilarity;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.identifier.ArXivIdentifier;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.model.strings.StringUtil;
import org.jabref.model.util.OptionalUtil;

Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/jabref/logic/importer/fetcher/CrossRef.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@
import org.jabref.model.cleanup.FieldFormatterCleanup;
import org.jabref.model.entry.AuthorList;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.EntryType;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.types.EntryType;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.model.util.OptionalUtil;

import org.apache.http.client.utils.URIBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.jabref.logic.importer.SearchBasedParserFetcher;
import org.jabref.logic.util.OS;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;
import org.jabref.model.strings.StringUtil;

import org.apache.http.client.utils.URIBuilder;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/logic/importer/fetcher/IEEE.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import org.jabref.logic.util.OS;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.identifier.DOI;
import org.jabref.model.entry.types.StandardEntryType;

import org.apache.http.client.utils.URIBuilder;
import org.json.JSONArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.LinkedFile;
import org.jabref.model.entry.Month;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;

import org.apache.http.client.utils.URIBuilder;
import org.json.JSONArray;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@
import org.jabref.logic.importer.fileformat.bibtexml.Incollection;
import org.jabref.logic.util.StandardFileType;
import org.jabref.model.entry.BibEntry;
import org.jabref.model.entry.StandardEntryType;
import org.jabref.model.entry.field.Field;
import org.jabref.model.entry.field.FieldFactory;
import org.jabref.model.entry.field.StandardField;
import org.jabref.model.entry.types.StandardEntryType;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down
Loading

0 comments on commit bbf3ab4

Please sign in to comment.