Skip to content

Commit

Permalink
Merge branch 'master' into fileChooserRefactor
Browse files Browse the repository at this point in the history
* master:
  Unified some equals (JabRef#1640)
  Export OO/LO citations to new database (JabRef#1630)
  Fixed JabRef#1639 (JabRef#1641)
  Replaced some getField and fixed some bugs (JabRef#1631)
  Keep @comment text in a bib file (JabRef#1638)

# Conflicts:
#	src/main/java/net/sf/jabref/importer/AppendDatabaseAction.java
  • Loading branch information
Siedlerchr committed Jul 29, 2016
2 parents e9e4779 + 644b2d7 commit f8e22a0
Show file tree
Hide file tree
Showing 50 changed files with 568 additions and 194 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,23 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- Added ISBN integrity checker
- Added filter to not show selected integrity checks
- Enhance the entry customization dialog to give better visual feedback
- It is now possible to generate a new BIB database from the citations in an OpenOffice/LibreOffice document
- The arXiv fetcher now also supports free-text search queries
- [#1345](https://github.com/JabRef/jabref/issues/1345) Cleanup ISSN

### Fixed
- Fixed [#1632](https://github.com/JabRef/jabref/issues/1632) User comments (@Comment) with or without brackets are now kept
- Fixed [#1264](https://github.com/JabRef/jabref/issues/1264): S with caron does not render correctly
- LaTeX to Unicode converter now handles combining accents
- Fixed NullPointerException when clicking Browse in Journal abbreviations with empty text field
- Fixed NullPointerException when opening file in Plain text import
- Fixed NullPointerException when appending database
- Fixed [#636](https://github.com/JabRef/jabref/issues/636): DOI in export filters
- Fixed [#1527](https://github.com/JabRef/jabref/issues/1527): 'Get BibTeX data from DOI' Removes Marking
- Fixed [#1592](https://github.com/JabRef/jabref/issues/1592): LibreOffice: wrong numbers in citation labels
- The merge entry dialog showed wrong heading after merging from DOI
- Fixed [#1321](https://github.com/JabRef/jabref/issues/1321): LaTeX commands in fields not displayed in the list of references
- Fixed [#1639](https://github.com/JabRef/jabref/issues/1639): Google Scholar fetching works again.
- Date fields in the BibLatex standard are now always formatted in the correct way, independent of the preferences

### Removed
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/sf/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ public BasePanel getBasePanelAt(int i) {
*
*/
public List<BasePanel> getBasePanelList() {
List<BasePanel> returnList = new ArrayList<>(getBasePanelCount());
List<BasePanel> returnList = new ArrayList<>();
for (int i=0; i< getBasePanelCount(); i++) {
returnList.add((BasePanel) tabbedPane.getComponentAt(i));
}
Expand Down
26 changes: 16 additions & 10 deletions src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
Expand Down Expand Up @@ -803,25 +804,30 @@ private boolean storeSource() {
}

// First, remove fields that the user has removed.
for (String field : entry.getFieldNames()) {
if (InternalBibtexFields.isDisplayableField(field) && !newEntry.hasField(field)) {
compound.addEdit(new UndoableFieldChange(entry, field, entry.getField(field), null));
entry.clearField(field);
for (Entry<String, String> field : entry.getFieldMap().entrySet()) {
String fieldName = field.getKey();
String fieldValue = field.getValue();

if (InternalBibtexFields.isDisplayableField(fieldName) && !newEntry.hasField(fieldName)) {
compound.addEdit(
new UndoableFieldChange(entry, fieldName, fieldValue, null));
entry.clearField(fieldName);
entryChanged = true;
}
}

// Then set all fields that have been set by the user.
for (String field : newEntry.getFieldNames()) {
String oldValue = entry.getField(field);
String newValue = newEntry.getField(field);
for (Entry<String, String> field : newEntry.getFieldMap().entrySet()) {
String fieldName = field.getKey();
String oldValue = entry.getFieldOptional(fieldName).orElse(null);
String newValue = field.getValue();
if (!Objects.equals(oldValue, newValue)) {
// Test if the field is legally set.
new LatexFieldFormatter(LatexFieldFormatterPreferences.fromPreferences(Globals.prefs))
.format(newValue, field);
.format(newValue, fieldName);

compound.addEdit(new UndoableFieldChange(entry, field, oldValue, newValue));
entry.setField(field, newValue);
compound.addEdit(new UndoableFieldChange(entry, fieldName, oldValue, newValue));
entry.setField(fieldName, newValue);
entryChanged = true;
}
}
Expand Down
18 changes: 12 additions & 6 deletions src/main/java/net/sf/jabref/gui/journals/ManageJournalsPanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,29 @@ public ManageJournalsPanel(final JabRefFrame frame) {
});

browseNew.addActionListener(e -> {
Path old = null;
String name;
if (!newNameTf.getText().isEmpty()) {
old = Paths.get(newNameTf.getText());
name = FileDialogs.getNewFile(frame, Paths.get(newNameTf.getText()).toFile(), Collections.emptyList(), JFileChooser.SAVE_DIALOG,
false);
} else {
name = FileDialogs.getNewFile(frame, null, Collections.emptyList(), JFileChooser.SAVE_DIALOG, false);
}
String name = FileDialogs.getNewFile(frame, old.toFile(), null, JFileChooser.SAVE_DIALOG, false);

if (name != null) {
newNameTf.setText(name);
newFile.setSelected(true);
}
});

browseOld.addActionListener(e -> {
Path old = null;
String name;
if (!personalFile.getText().isEmpty()) {
old = Paths.get(personalFile.getText());
name = FileDialogs.getNewFile(frame, Paths.get(personalFile.getText()).toFile(),
Collections.emptyList(), JFileChooser.OPEN_DIALOG, false);
} else {
name = FileDialogs.getNewFile(frame, null, Collections.emptyList(), JFileChooser.OPEN_DIALOG, false);
}
String name = FileDialogs.getNewFile(frame, old.toFile(), null, JFileChooser.OPEN_DIALOG, false);

if (name != null) {
personalFile.setText(name);
oldFile.setSelected(true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import net.sf.jabref.specialfields.Rank;
import net.sf.jabref.specialfields.ReadStatus;
import net.sf.jabref.specialfields.Relevance;
import net.sf.jabref.specialfields.SpecialFieldValue;
import net.sf.jabref.specialfields.SpecialFieldsUtils;

public class SpecialMainTableColumns {
Expand All @@ -42,12 +41,9 @@ public String getDisplayName() {

@Override
public Object getColumnValue(BibEntry entry) {
SpecialFieldValue rank = Rank.getInstance().parse(entry.getField(SpecialFieldsUtils.FIELDNAME_RANKING));
if (rank == null) {
return null;
} else {
return rank.createLabel();
}

return entry.getFieldOptional(SpecialFieldsUtils.FIELDNAME_RANKING)
.flatMap(Rank.getInstance()::parse).map(rank -> rank.createLabel()).orElse(null);
}
};

Expand All @@ -58,13 +54,8 @@ public Object getColumnValue(BibEntry entry) {
@Override
public Object getColumnValue(BibEntry entry) {

SpecialFieldValue prio = Priority.getInstance()
.parse(entry.getField(SpecialFieldsUtils.FIELDNAME_PRIORITY));
if (prio == null) {
return null;
} else {
return prio.createLabel();
}
return entry.getFieldOptional(SpecialFieldsUtils.FIELDNAME_PRIORITY)
.flatMap(Priority.getInstance()::parse).map(prio -> prio.createLabel()).orElse(null);
}
};

Expand All @@ -75,13 +66,8 @@ public Object getColumnValue(BibEntry entry) {
@Override
public Object getColumnValue(BibEntry entry) {

SpecialFieldValue status = ReadStatus.getInstance()
.parse(entry.getField(SpecialFieldsUtils.FIELDNAME_READ));
if (status == null) {
return null;
} else {
return status.createLabel();
}
return entry.getFieldOptional(SpecialFieldsUtils.FIELDNAME_READ)
.flatMap(ReadStatus.getInstance()::parse).map(status -> status.createLabel()).orElse(null);
}
};

Expand Down
28 changes: 28 additions & 0 deletions src/main/java/net/sf/jabref/gui/openoffice/CreationException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/* Copyright (C) 2016 JabRef contributors.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package net.sf.jabref.gui.openoffice;

/**
* Exception used to indicate that the plugin attempted to set a character format that is
* not defined in the current OpenOffice document.
*/
class CreationException extends Exception {

public CreationException(String message) {
super(message);
}

}
Loading

0 comments on commit f8e22a0

Please sign in to comment.