Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin' into all-fields
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/net/sf/jabref/gui/GenFieldsCustomizer.java
#	src/main/java/net/sf/jabref/gui/entryeditor/EntryEditor.java
#	src/main/resources/l10n/JabRef_da.properties
#	src/main/resources/l10n/JabRef_de.properties
#	src/main/resources/l10n/JabRef_en.properties
#	src/main/resources/l10n/JabRef_es.properties
#	src/main/resources/l10n/JabRef_fa.properties
#	src/main/resources/l10n/JabRef_fr.properties
#	src/main/resources/l10n/JabRef_in.properties
#	src/main/resources/l10n/JabRef_it.properties
#	src/main/resources/l10n/JabRef_ja.properties
#	src/main/resources/l10n/JabRef_nl.properties
#	src/main/resources/l10n/JabRef_no.properties
#	src/main/resources/l10n/JabRef_pt_BR.properties
#	src/main/resources/l10n/JabRef_ru.properties
#	src/main/resources/l10n/JabRef_tr.properties
#	src/main/resources/l10n/JabRef_vi.properties
#	src/main/resources/l10n/JabRef_zh.properties
  • Loading branch information
stefan-kolb committed Mar 4, 2016
2 parents d0292c3 + 317b45e commit 86511a5
Show file tree
Hide file tree
Showing 382 changed files with 6,105 additions and 7,694 deletions.
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
* JabRef version (available in the About box):
* Operation system and version:
* Steps to reproduce:
1. ...
2. ...
3. ...
* If applicable, excerpt of the bibliography file, screenshot, and excerpt of log (available in the error console)
4 changes: 4 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [ ] Change in CHANGELOG.md described?
- [ ] Changes in pull request outlined? (What, why, ...)
- [ ] Tests created for changes?
- [ ] Tests green?
Empty file removed .sonar_lock
Empty file.
15 changes: 13 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,20 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Moved all quality-related database actions inside a new quality menu
- [#684](https://github.com/JabRef/jabref/issues/684): ISBNtoBibTex Error Message is now more clear
- Moved default bibliography mode to general preferences tab
- Add dialog to show all preferences in their raw form plus some filtering
- Added Ordinal formatter (1 -> 1st etc)
- [#492](https://github.com/JabRef/jabref/issues/492): If no text is marked, the whole field is copied. Preview of pasted text in tool tip
- [#454](https://github.com/JabRef/jabref/issues/454) Add a tab that shows all remaining entry fields that are not displayed in any other tab
- The LaTeX to Unicode/HTML functionality is much improved by covering many more cases
- Ability to convert from LaTeX to Unicode in right-click field menu

- [#492](https://github.com/JabRef/jabref/issues/492): If no text is marked, the whole field is copied. Preview of pasted text in tool tip
- Integrity check now also checks broken file links, abbreviations in journal and booktitle, and incorrect use of proceedings with page numbers

### Fixed
- Fixed [#598](https://github.com/JabRef/jabref/issues/598) and [#402](https://github.com/JabRef/jabref/issues/402): No more issues with invalid icons for ExternalFileTypes in global search or after editing the settings
- Fixed [#883](https://github.com/JabRef/jabref/issues/883): No NPE during cleanup
- Fixed [#466](https://github.com/JabRef/jabref/issues/466): Rename PDF cleanup now also changes case of file name
- Fixed [#621](https://github.com/JabRef/jabref/issues/621) and [#669](https://github.com/JabRef/jabref/issues/669): Encoding and preamble now end with newline.
- Make BibTex parser more robust against missing newlines
- Fix bug that prevented the import of BibTex entries having only a key as content
Expand All @@ -49,9 +58,11 @@ to [sourceforge feature requests](https://sourceforge.net/p/jabref/features/) by
- Fixed [#824](https://github.com/JabRef/jabref/issues/824): MimeTypeDetector can now also handle local file links
- Fixed [#803](https://github.com/JabRef/jabref/issues/803): Fixed dynamically group, free-form search
- Fixed [#743](https://github.com/JabRef/jabref/issues/743): Logger not configured when JAR is started
- Fixed [#822](https://github.com/JabRef/jabref/issues/822):OSX - Exception when adding the icon to the dock

- Fixed [#822](https://github.com/JabRef/jabref/issues/822): OSX - Exception when adding the icon to the dock
- Fixed [#609](https://github.com/JabRef/jabref/issues/609): Sort Arrows are shown in the main table if table is sorted
- Fixed [#685](https://github.com/JabRef/jabref/issues/685): Fixed MySQL exporting for more than one entry
- Fixed [#815](https://github.com/JabRef/jabref/issues/815): Curly Braces no longer ignored in OpenOffice/LibreOffice citation
- Fixed [#855](https://github.com/JabRef/jabref/issues/856): Fixed OpenOffice Manual connect - Clicking on browse does now work correctly

### Removed
- Fixed [#627](https://github.com/JabRef/jabref/issues/627): The pdf field is removed from the export formats, use the file field
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ facing <concern c>
we decided for <option o>
and neglected <other options>,
to achieve <system qualities/desired consequences>,
accepting <downside d/undesired consequences>.
accepting <downside d/undesired consequences>,
because <additional rationale>.
```

Expand Down
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
[![codecov.io](https://codecov.io/github/JabRef/jabref/coverage.svg?branch=master)](https://codecov.io/github/JabRef/jabref?branch=master)
[![Coverity Status](https://badges.ondemand.coverity.com/streams/tslj9m8e2149d8elggiskktgpc)](https://ondemand.coverity.com/streams/tslj9m8e2149d8elggiskktgpc)
[![Donation](https://img.shields.io/badge/donate-paypal-orange.svg)](https://www.paypal.com/cgi-bin/webscr?item_name=JabRef+Bibliography+Manager&cmd=_donations&lc=US&currency_code=EUR&business=jabrefmail%40gmail.com)
[![Download JabRef](https://img.shields.io/sourceforge/dw/jabref.svg)](http://sourceforge.net/projects/jabref/files/)
[![Issue Stats](http://www.issuestats.com/github/jabref/jabref/badge/pr)](http://www.issuestats.com/github/jabref/jabref)
[![Issue Stats](http://www.issuestats.com/github/jabref/jabref/badge/issue)](http://www.issuestats.com/github/jabref/jabref)
[![Codacy Badge](https://api.codacy.com/project/badge/grade/327430c894e04086a5bfef618fa44f36)](https://www.codacy.com/app/simonharrer/jabref)
Expand Down Expand Up @@ -72,13 +71,9 @@ Try to double click the `jar` file or execute the following command:

## Documentation

JabRef comes with an online help function, accessed by pressing `F1` or
clicking on a question mark icon. The help files are probably not
exhaustive enough to satisfy everyone yet, but they should help sort
out the most important issues about using the program. The help files
can also be viewed outside the program with a standard HTML browser.
If you choose languages other than English, some or all help pages may
appear in your chosen languages.
JabRef comes with an [online help](http://help.jabref.org/), accessed by pressing `F1` or clicking on a question mark icon.
The help is are probably not exhaustive enough to satisfy everyone yet, but it should help sort out the most important issues about using the program.
If you choose languages other than English, some or all help pages may appear in your chosen languages.


## Building JabRef From Source
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ buildscript {

plugins {
id 'com.github.johnrengelman.shadow' version '1.2.3'
id "com.github.kt3k.coveralls" version "2.4.0x"
id "com.github.kt3k.coveralls" version "2.6.3"
id "com.github.youribonnaffe.gradle.format" version "1.3"
id "com.coverity.ondemand" version "1.5.61"
id "net.ltgt.errorprone" version "0.0.8"
Expand Down Expand Up @@ -92,7 +92,7 @@ dependencies {
compile 'org.antlr:antlr4-runtime:4.5.2-1'

compile 'mysql:mysql-connector-java:5.1.38'
compile 'org.postgresql:postgresql:9.4.1207'
compile 'org.postgresql:postgresql:9.4.1208'

compile 'net.java.dev.glazedlists:glazedlists_java15:1.9.1'
compile fileTree(dir: 'lib', includes: ['*.jar'])
Expand Down
15 changes: 9 additions & 6 deletions circle.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
machine:
environment:
TERM: dumb
java:
version: oraclejdk8

Expand All @@ -8,23 +10,24 @@ dependencies:
- install4j6/bin/install4jc --verbose --license=$INSTALL4J_KEY
override:
# We do this to decrease build time by using CircleCI's cache. See https://discuss.circleci.com/t/effective-caching-for-gradle/540 for a longer motivation.
- TERM=dumb ./gradlew getdeps
- ./gradlew getdeps
cache_directories:
- "~/.install4j6"
- "~/downloads"

test:
override:
- TERM=dumb ./gradlew test
- ./gradlew test
post:
- if [[ ! -z $COVERITY_ACCESS_TOKEN ]] ; then TERM=dumb ./gradlew coverityCheck ; fi
- if [[ ! -z $COVERITY_ACCESS_TOKEN ]] ; then ./gradlew coverityCheck ; fi
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
- find . -type f -regex ".*/build/test-results/.*xml" -exec cp {} $CIRCLE_TEST_REPORTS/junit/ \;
- TERM=dumb ./gradlew jacocoTestReport coveralls
# We use JaCoCo instead of Cobertura for measuring code coverage
- ./gradlew jacocoTestReport coveralls
- bash <(curl -s https://codecov.io/bash)
# if you change something here, please also adapt deployment->release->commands
# clean has to be done to ensure that the dev information is included in Help/About
- TERM=dumb ./gradlew -Pdev=true -Pinstall4jDir="install4j6" clean release --stacktrace || exit 0
- ./gradlew -Pdev=true -Pinstall4jDir="install4j6" clean release --stacktrace || exit 0
- timeout 580 scripts/upload-to-builds.jabref.org.sh || exit 0

deployment:
Expand All @@ -33,7 +36,7 @@ deployment:
tag: /v[0-9]+(\.[0-9]+)*(-.+)?/
commands:
# we have to do a clean build as changing gradle's "project.version" does not lead to a rebuild of resources (mirroring project.version)
- TERM=dumb ./gradlew -Pinstall4jDir="install4j6" clean release --stacktrace || exit 0
- ./gradlew -Pinstall4jDir="install4j6" clean release --stacktrace || exit 0

general:
artifacts:
Expand Down
6 changes: 5 additions & 1 deletion src/main/java/net/sf/jabref/BibDatabaseContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ public class BibDatabaseContext {
private final MetaData metaData;
private final Defaults defaults;

public BibDatabaseContext() {
this(new Defaults());
}

public BibDatabaseContext(Defaults defaults) {
this(new BibDatabase(), defaults);
}
Expand All @@ -42,7 +46,7 @@ public BibDatabaseContext(BibDatabase database, MetaData metaData, File file, De

public BibDatabaseMode getMode() {
List<String> data = metaData.getData(MetaData.DATABASE_TYPE);
if (data == null) {
if (data == null || data.isEmpty()) {
BibDatabaseMode inferredMode = BibDatabaseModeDetection.inferMode(database);
if (defaults.mode == BibDatabaseMode.BIBLATEX || inferredMode == BibDatabaseMode.BIBLATEX) {
return BibDatabaseMode.BIBLATEX;
Expand Down
63 changes: 34 additions & 29 deletions src/main/java/net/sf/jabref/JabRefPreferences.java
Original file line number Diff line number Diff line change
Expand Up @@ -470,6 +470,11 @@ private JabRefPreferences() {
}
defaults.put(PUSH_TO_APPLICATION, "TeXstudio");

defaults.put(RECENT_FILES, "");
defaults.put(EXTERNAL_FILE_TYPES, "");
defaults.put(KEY_PATTERN_REGEX, "");
defaults.put(KEY_PATTERN_REPLACEMENT, "");

// Proxy
defaults.put(PROXY_USE, Boolean.FALSE);
defaults.put(PROXY_HOSTNAME, "");
Expand Down Expand Up @@ -543,8 +548,8 @@ private JabRefPreferences() {
defaults.put(ENTRY_TYPE_FORM_WIDTH, 1);
defaults.put(BACKUP, Boolean.TRUE);
defaults.put(OPEN_LAST_EDITED, Boolean.TRUE);
defaults.put(LAST_EDITED, null);
defaults.put(LAST_FOCUSED, null);
defaults.put(LAST_EDITED, "");
defaults.put(LAST_FOCUSED, "");
defaults.put(STRINGS_POS_X, 0);
defaults.put(STRINGS_POS_Y, 0);
defaults.put(STRINGS_SIZE_X, 600);
Expand Down Expand Up @@ -722,12 +727,12 @@ private JabRefPreferences() {
defaults.put(RemotePreferences.USE_REMOTE_SERVER, Boolean.TRUE);
defaults.put(RemotePreferences.REMOTE_SERVER_PORT, 6050);

defaults.put(PERSONAL_JOURNAL_LIST, null);
defaults.put(EXTERNAL_JOURNAL_LISTS, null);
defaults.put(PERSONAL_JOURNAL_LIST, "");
defaults.put(EXTERNAL_JOURNAL_LISTS, "");
defaults.put(CITE_COMMAND, "\\cite"); // obsoleted by the app-specific ones (not any more?)
defaults.put(FLOAT_MARKED_ENTRIES, Boolean.TRUE);

defaults.put(LAST_USED_EXPORT, null);
defaults.put(LAST_USED_EXPORT, "");
defaults.put(SIDE_PANE_WIDTH, -1);

defaults.put(IMPORT_INSPECTION_DIALOG_WIDTH, 650);
Expand Down Expand Up @@ -906,14 +911,6 @@ private boolean getBooleanDefault(String key) {
return (Boolean) defaults.get(key);
}

public double getDouble(String key) {
return prefs.getDouble(key, getDoubleDefault(key));
}

private double getDoubleDefault(String key) {
return (Double) defaults.get(key);
}

public int getInt(String key) {
return prefs.getInt(key, getIntDefault(key));
}
Expand All @@ -922,14 +919,6 @@ public int getIntDefault(String key) {
return (Integer) defaults.get(key);
}

public byte[] getByteArray(String key) {
return prefs.getByteArray(key, getByteArrayDefault(key));
}

private byte[] getByteArrayDefault(String key) {
return (byte[]) defaults.get(key);
}

public void put(String key, String value) {
prefs.put(key, value);
}
Expand All @@ -938,18 +927,10 @@ public void putBoolean(String key, boolean value) {
prefs.putBoolean(key, value);
}

public void putDouble(String key, double value) {
prefs.putDouble(key, value);
}

public void putInt(String key, int value) {
prefs.putInt(key, value);
}

public void putByteArray(String key, byte[] value) {
prefs.putByteArray(key, value);
}

public void remove(String key) {
prefs.remove(key);
}
Expand Down Expand Up @@ -1132,6 +1113,30 @@ public void putKeyPattern(GlobalLabelPattern pattern) {
}
}

public Map<String, Object> getPreferences() {
Map<String, Object> prefs = new HashMap<>();
try {
for(String key : this.prefs.keys()){
Object value = getObject(key);
prefs.put(key, value);
}
} catch (BackingStoreException e) {
LOGGER.info("could not retrieve preference keys", e);
}
return prefs;
}

private Object getObject(String key) {
try {
return this.get(key);
} catch (ClassCastException e) {
try {
return this.getBoolean(key);
} catch (ClassCastException e2) {
return this.getInt(key);
}
}
}


private static String getNextUnit(Reader data) throws IOException {
Expand Down
97 changes: 97 additions & 0 deletions src/main/java/net/sf/jabref/JabRefPreferencesFilter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package net.sf.jabref;

import java.util.*;
import java.util.stream.Collectors;

public class JabRefPreferencesFilter {

private final JabRefPreferences preferences;

public JabRefPreferencesFilter(JabRefPreferences preferences) {
this.preferences = preferences;
}

public List<PreferenceOption> getPreferenceOptions() {
Map<String, Object> defaults = new HashMap<>(preferences.defaults);
Map<String, Object> prefs = preferences.getPreferences();

return prefs.entrySet().stream()
.map(entry -> new PreferenceOption(entry.getKey(), entry.getValue(), defaults.get(entry.getKey())))
.collect(Collectors.toList());
}

public List<PreferenceOption> getDeviatingPreferences() {
return getPreferenceOptions().stream()
.filter(PreferenceOption::isChanged)
.sorted()
.collect(Collectors.toList());
}

public enum PreferenceType {
BOOLEAN, INTEGER, STRING
}

public static class PreferenceOption implements Comparable<PreferenceOption> {

private final String key;
private final Object value;
private final Optional<Object> defaultValue;
private final PreferenceType type;

public PreferenceOption(String key, Object value, Object defaultValue) {
this.key = Objects.requireNonNull(key);
this.value = Objects.requireNonNull(value);
this.defaultValue = Optional.ofNullable(defaultValue);
this.type = Objects.requireNonNull(getType(value));

if ((defaultValue != null) && !Objects.equals(this.type, getType(defaultValue))) {
throw new IllegalStateException("types must match between default value and value");
}
}

private PreferenceType getType(Object value) {
if (value instanceof Boolean) {
return PreferenceType.BOOLEAN;
} else if (value instanceof Integer) {
return PreferenceType.INTEGER;
} else {
return PreferenceType.STRING;
}
}

public boolean isUnchanged() {
return Objects.equals(value, defaultValue.orElse(null));
}

public boolean isChanged() {
return !isUnchanged();
}

@Override
public String toString() {
return String.format("%s: %s=%s (%s)", type, key, value, defaultValue.orElse("NULL"));
}

public String getKey() {
return key;
}

public Object getValue() {
return value;
}

public Optional<Object> getDefaultValue() {
return defaultValue;
}

public PreferenceType getType() {
return type;
}

@Override
public int compareTo(PreferenceOption o) {
return Objects.compare(this.key, o.key, String::compareTo);
}
}

}
Loading

0 comments on commit 86511a5

Please sign in to comment.