Skip to content

Commit 6bb2f57

Browse files
committed
Update many files and revert tests to a previous version
1 parent 9bb89dc commit 6bb2f57

36 files changed

+16057
-16084
lines changed

build.gradle

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ dependencies {
111111
compile 'org.apache.pdfbox:fontbox:2.0.17'
112112
compile 'org.apache.pdfbox:xmpbox:2.0.17'
113113

114+
compile group: 'org.apache.commons', name: 'commons-csv', version: '1.7'
115+
114116
compile group: 'org.apache.tika', name: 'tika-core', version: '1.22'
115117

116118
// required for reading write-protected PDFs - see https://github.com/JabRef/jabref/pull/942#issuecomment-209252635

scripts/convert_txt2csv.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
df = pd.read_csv(fileName + ".txt", sep=separator, skiprows=commented_lines, header=None, engine="python", skipinitialspace=True, index_col=0, names=["Name", "Abbrev"])
2727
df.index = df.index.str.strip()
2828
df = df.Abbrev.str.split(";", expand=True)
29-
df.to_csv(fileName + ".csv", sep="\t", header=False)
29+
df.to_csv(fileName + ".csv", sep=";", header=False)
3030
print(fileName + ".csv")

src/main/java/module-info.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,5 @@
6565
requires de.saxsys.mvvmfx.validation;
6666
requires richtextfx;
6767
requires unirest.java;
68+
requires commons.csv;
6869
}

src/main/java/org/jabref/gui/BasePanel.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
import org.jabref.gui.externalfiletype.ExternalFileTypes;
4747
import org.jabref.gui.importer.actions.AppendDatabaseAction;
4848
import org.jabref.gui.journals.AbbreviateAction;
49+
import org.jabref.gui.journals.AbbreviationType;
4950
import org.jabref.gui.journals.UnabbreviateAction;
5051
import org.jabref.gui.maintable.MainTable;
5152
import org.jabref.gui.maintable.MainTableDataModel;
@@ -365,9 +366,9 @@ private void setupActions() {
365366

366367
actions.put(Actions.WRITE_XMP, new WriteXMPAction(this)::execute);
367368

368-
actions.put(Actions.ABBREVIATE_ISO, new AbbreviateAction(this, 0));
369-
actions.put(Actions.ABBREVIATE_MEDLINE, new AbbreviateAction(this, 1));
370-
actions.put(Actions.ABBREVIATE_SHORTEST, new AbbreviateAction(this, 2));
369+
actions.put(Actions.ABBREVIATE_DEFAULT, new AbbreviateAction(this, AbbreviationType.DEFAULT));
370+
actions.put(Actions.ABBREVIATE_MEDLINE, new AbbreviateAction(this, AbbreviationType.MEDLINE));
371+
actions.put(Actions.ABBREVIATE_SHORTEST_UNIQUE, new AbbreviateAction(this, AbbreviationType.SHORTEST_UNIQUE));
371372
actions.put(Actions.UNABBREVIATE, new UnabbreviateAction(this));
372373

373374
actions.put(Actions.DOWNLOAD_FULL_TEXT, new FindFullTextAction(this)::execute);

src/main/java/org/jabref/gui/JabRefFrame.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,9 @@ private MenuBar createMenu() {
783783
pushToApplicationMenuItem,
784784

785785
factory.createSubMenu(StandardActions.ABBREVIATE,
786-
factory.createMenuItem(StandardActions.ABBREVIATE_ISO, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_ISO, this, stateManager)),
786+
factory.createMenuItem(StandardActions.ABBREVIATE_DEFAULT, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_DEFAULT, this, stateManager)),
787787
factory.createMenuItem(StandardActions.ABBREVIATE_MEDLINE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_MEDLINE, this, stateManager)),
788-
factory.createMenuItem(StandardActions.ABBREVIATE_SHORTEST, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_SHORTEST, this, stateManager))),
788+
factory.createMenuItem(StandardActions.ABBREVIATE_SHORTEST_UNIQUE, new OldDatabaseCommandWrapper(Actions.ABBREVIATE_SHORTEST_UNIQUE, this, stateManager))),
789789

790790
factory.createMenuItem(StandardActions.UNABBREVIATE, new OldDatabaseCommandWrapper(Actions.UNABBREVIATE, this, stateManager))
791791
);

src/main/java/org/jabref/gui/actions/Actions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
@Deprecated
77
public enum Actions {
88

9-
ABBREVIATE_ISO,
9+
ABBREVIATE_DEFAULT,
1010
ABBREVIATE_MEDLINE,
11-
ABBREVIATE_SHORTEST,
11+
ABBREVIATE_SHORTEST_UNIQUE,
1212
ADD_FILE_LINK,
1313
CLEANUP,
1414
COPY,

src/main/java/org/jabref/gui/actions/StandardActions.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ public enum StandardActions implements Action {
9494
COPY_LINKED_FILES(Localization.lang("Copy linked files to folder...")),
9595
COPY_DOI(Localization.lang("Copy DOI url")),
9696
ABBREVIATE(Localization.lang("Abbreviate journal names")),
97-
ABBREVIATE_ISO("ISO", Localization.lang("Abbreviate journal names of the selected entries (ISO abbreviation)"), KeyBinding.ABBREVIATE),
97+
ABBREVIATE_DEFAULT("DEFAULT", Localization.lang("Abbreviate journal names of the selected entries (DEFAULT abbreviation)"), KeyBinding.ABBREVIATE),
9898
ABBREVIATE_MEDLINE("MEDLINE", Localization.lang("Abbreviate journal names of the selected entries (MEDLINE abbreviation)")),
99-
ABBREVIATE_SHORTEST("SHORTEST", Localization.lang("Abbreviate journal names of the selected entries (SHORTEST abbreviation)")),
99+
ABBREVIATE_SHORTEST_UNIQUE("SHORTEST UNIQUE", Localization.lang("Abbreviate journal names of the selected entries (SHORTEST UNIQUE abbreviation)")),
100100
UNABBREVIATE(Localization.lang("Unabbreviate journal names"), Localization.lang("Unabbreviate journal names of the selected entries"), KeyBinding.UNABBREVIATE),
101101

102102
MANAGE_CUSTOM_EXPORTS(Localization.lang("Manage custom exports")),

src/main/java/org/jabref/gui/journals/AbbreviateAction.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ public class AbbreviateAction implements BaseAction {
2929

3030
private static final Logger LOGGER = LoggerFactory.getLogger(AbbreviateAction.class);
3131
private final BasePanel panel;
32-
private final int abbrvType;
32+
private final AbbreviationType abbreviationType;
3333

34-
public AbbreviateAction(BasePanel panel, int abbrvType) {
34+
public AbbreviateAction(BasePanel panel, AbbreviationType abbreviationType) {
3535
this.panel = panel;
36-
this.abbrvType = abbrvType;
36+
this.abbreviationType = abbreviationType;
3737
}
3838

3939
@Override
@@ -49,7 +49,7 @@ private String abbreviate() {
4949
List<BibEntry> entries = panel.getSelectedEntries();
5050
UndoableAbbreviator undoableAbbreviator = new UndoableAbbreviator(
5151
Globals.journalAbbreviationLoader.getRepository(Globals.prefs.getJournalAbbreviationPreferences()),
52-
abbrvType);
52+
abbreviationType);
5353

5454
NamedCompound ce = new NamedCompound(Localization.lang("Abbreviate journal names"));
5555
Set<Callable<Boolean>> tasks = new HashSet<>();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.jabref.gui.journals;
2+
3+
/**
4+
* Defines the different abbreviation types that JabRef can operate with
5+
*/
6+
public enum AbbreviationType {
7+
DEFAULT,
8+
MEDLINE,
9+
SHORTEST_UNIQUE
10+
}

src/main/java/org/jabref/gui/journals/AbbreviationViewModel.java

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,24 @@
1010
import org.jabref.logic.journals.Abbreviation;
1111

1212
/**
13-
* This class provides a view model for abbreviation objects which can also
14-
* define placeholder objects of abbreviations. This is indicated by using the
15-
* {@code pseudoAbbreviation} property.
13+
* This class provides a view model for abbreviation objects which can also define placeholder objects of abbreviations.
14+
* This is indicated by using the {@code pseudoAbbreviation} property.
1615
*/
1716
public class AbbreviationViewModel {
1817

1918
private final Abbreviation abbreviationObject;
2019
private final StringProperty name = new SimpleStringProperty("");
2120
private final StringProperty abbreviation = new SimpleStringProperty("");
22-
private final StringProperty shortestUnique = new SimpleStringProperty("");
21+
private final StringProperty shortestUniqueAbbreviation = new SimpleStringProperty("");
2322
private final BooleanProperty pseudoAbbreviation = new SimpleBooleanProperty();
2423

2524
public AbbreviationViewModel(Abbreviation abbreviation) {
2625
this.abbreviationObject = abbreviation;
27-
pseudoAbbreviation.set(this.abbreviationObject == null);
26+
this.pseudoAbbreviation.set(this.abbreviationObject == null);
2827
if (this.abbreviationObject != null) {
2928
this.name.bindBidirectional(this.abbreviationObject.nameProperty());
3029
this.abbreviation.bindBidirectional(this.abbreviationObject.abbreviationProperty());
31-
this.shortestUnique.bindBidirectional(this.abbreviationObject.shortestUniqueProperty());
30+
this.shortestUniqueAbbreviation.bindBidirectional(this.abbreviationObject.shortestUniqueAbbreviationProperty());
3231
} else {
3332
this.name.set("Add new Abbreviation");
3433
}
@@ -38,28 +37,28 @@ public Abbreviation getAbbreviationObject() {
3837
return this.abbreviationObject;
3938
}
4039

41-
public void setName(String name) {
42-
this.name.set(name);
40+
public String getName() {
41+
return this.name.get();
4342
}
4443

45-
public void setAbbreviation(String abbreviation) {
46-
this.abbreviation.set(abbreviation);
44+
public void setName(String name) {
45+
this.name.set(name);
4746
}
4847

49-
public void setShortestUnique(String shortestUnique) {
50-
this.shortestUnique.set(shortestUnique);
48+
public String getAbbreviation() {
49+
return this.abbreviation.get();
5150
}
5251

53-
public String getName() {
54-
return this.name.get();
52+
public void setAbbreviation(String abbreviation) {
53+
this.abbreviation.set(abbreviation);
5554
}
5655

57-
public String getAbbreviation() {
58-
return this.abbreviation.get();
56+
public String getShortestUniqueAbbreviation() {
57+
return this.shortestUniqueAbbreviation.get();
5958
}
6059

61-
public String getShortestUnique() {
62-
return this.shortestUnique.get();
60+
public void setShortestUniqueAbbreviation(String shortestUniqueAbbreviation) {
61+
this.shortestUniqueAbbreviation.set(shortestUniqueAbbreviation);
6362
}
6463

6564
public boolean isPseudoAbbreviation() {
@@ -74,8 +73,8 @@ public StringProperty abbreviationProperty() {
7473
return this.abbreviation;
7574
}
7675

77-
public StringProperty shortestUniqueProperty() {
78-
return this.shortestUnique;
76+
public StringProperty shortestUniqueAbbreviationProperty() {
77+
return this.shortestUniqueAbbreviation;
7978
}
8079

8180
public BooleanProperty isPseudoAbbreviationProperty() {

0 commit comments

Comments
 (0)