Skip to content

Commit

Permalink
Merge branch 'master' into fileChooserRefactor
Browse files Browse the repository at this point in the history
* master:
  Fixed OO/LO manual connection dialog on Linux
  Removed thrown Exception declarations (JabRef#1673)
  Fix JabRef#1288 Newly opened bib-file is not focused (JabRef#1671)
  Refactor DB loading
  Fix OutOfBoundsException when importing multiple entries in medline format (JabRef#1611)
  Removed the possibility to auto show or hide the groups interface (JabRef#1668)
  Add test to describe workaround for JabRef#1633
  Fixed JabRef#1643: Searching with double quotes in a specific field ignores the last character
  fix build
  Fixes JabRef#1554: JabRefFrame is set as owner for ImportInspectionDialog
  Fixed most of the ErrorProne warnings
  Replaced output of getResolvedField to Optional<String> (JabRef#1650)
  PushToApplication cleanup and refactoring (JabRef#1659)
  Replaced Object with appropriate class where possible (JabRef#1660)
  Replaced some array return types (JabRef#1661)
  Fix XMP test
  Localization
  Moved the main part of XMPUtil to jabref.XMPUtilMain and injected a b… (JabRef#1642)
  Made possible to make the OO/LO panel a bit more narrow (JabRef#1652)
  French localization: Jabref_fr: empty strings + some cleaning
  • Loading branch information
Siedlerchr committed Aug 5, 2016
2 parents be286a4 + 0e618b5 commit c974ae1
Show file tree
Hide file tree
Showing 105 changed files with 906 additions and 822 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,15 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- 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
- Fixed [#1554](https://github.com/JabRef/jabref/issues/1554): Import dialog is no longer hidden behind main window
- Fixed [#1643](https://github.com/JabRef/jabref/issues/1643): Searching with double quotes in a specific field ignores the last character
- Fixed [#1288](https://github.com/JabRef/jabref/issues/1288): Newly opened bib-file is not focused
- Fixed [#1669](https://github.com/JabRef/jabref/issues/1669): Dialog for manual connection to OpenOffice/LibreOffice works again on Linux


### Removed
- It is not longer possible to choose to convert HTML sub- and superscripts to equations
- [#1610](https://github.com/JabRef/jabref/issues/1610) Removed the possibility to auto show or hide the groups interface



Expand Down Expand Up @@ -489,4 +495,4 @@ The changelog of 2.11 and versions before is maintained as [text file](https://g
[3.1]: https://github.com/JabRef/jabref/compare/v3.0...v3.1
[3.0]: https://github.com/JabRef/jabref/compare/v2.11.1...v3.0
[dev_2.11]: https://github.com/JabRef/jabref/compare/v2.11.1...dev_2.11
[2.11.1]: https://github.com/JabRef/jabref/compare/v2.11...v2.11.1
[2.11.1]: https://github.com/JabRef/jabref/compare/v2.11...v2.11.1
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ install4j {
}

task wrapper(type: Wrapper) {
gradleVersion = '2.14'
gradleVersion = '2.14.1'
}


Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Jun 27 17:21:50 CEST 2016
#Wed Aug 03 11:49:15 CEST 2016
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-bin.zip
46 changes: 25 additions & 21 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,30 @@
##
##############################################################################

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"

Expand All @@ -30,6 +48,7 @@ die ( ) {
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
Expand All @@ -40,26 +59,11 @@ case "`uname`" in
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac

# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar

# Determine the Java command to use to start the JVM.
Expand All @@ -85,7 +89,7 @@ location of your Java installation."
fi

# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
Expand Down
6 changes: 3 additions & 3 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

Expand Down
2 changes: 1 addition & 1 deletion src/jmh/java/net/sf/jabref/benchmarks/Benchmarks.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public boolean keywordGroupContains() throws ParseException {
}

@Benchmark
public boolean keywordGroupContainsWord() throws ParseException {
public boolean keywordGroupContainsWord() {
return KeywordGroup.containsWord("testWord", "Some longer test string containing testWord the test word");
}

Expand Down
92 changes: 55 additions & 37 deletions src/main/java/net/sf/jabref/JabRefGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
import net.sf.jabref.importer.OpenDatabaseAction;
import net.sf.jabref.importer.ParserResult;
import net.sf.jabref.logic.l10n.Localization;
import net.sf.jabref.logic.preferences.LastFocusedTabPreferences;
import net.sf.jabref.logic.util.OS;
import net.sf.jabref.logic.util.Version;
import net.sf.jabref.logic.util.VersionPreferences;
Expand All @@ -58,16 +57,25 @@ public class JabRefGUI {

private static JabRefFrame mainFrame;

private final List<ParserResult> loaded;
private final List<ParserResult> bibDatabases;
private final boolean isBlank;

private final List<File> postponed = new ArrayList<>();
private final List<ParserResult> failed = new ArrayList<>();
private final List<ParserResult> toOpenTab = new ArrayList<>();

public JabRefGUI(List<ParserResult> loaded, boolean isBlank) {
this.loaded = loaded;
private String focusedFile;

public JabRefGUI(List<ParserResult> argsDatabases, boolean isBlank) {
this.bibDatabases = argsDatabases;
this.isBlank = isBlank;

// passed file (we take the first one) should be focused
if (!argsDatabases.isEmpty()) {
focusedFile = argsDatabases.get(0).getFile().getAbsolutePath();
} else {
focusedFile = Globals.prefs.get(JabRefPreferences.LAST_FOCUSED);
}

openWindow();
JabRefGUI.checkForNewVersion(false);
}
Expand Down Expand Up @@ -102,9 +110,8 @@ private void openWindow() {
setLookAndFeel();

// If the option is enabled, open the last edited databases, if any.
if (!isBlank && Globals.prefs.getBoolean(JabRefPreferences.OPEN_LAST_EDITED)
&& (Globals.prefs.get(JabRefPreferences.LAST_EDITED) != null)) {
openLastEditedDatabase();
if (!isBlank && Globals.prefs.getBoolean(JabRefPreferences.OPEN_LAST_EDITED)) {
openLastEditedDatabases();
}

GUIGlobals.init();
Expand All @@ -114,19 +121,20 @@ private void openWindow() {
LOGGER.debug("Initializing frame");
JabRefGUI.mainFrame = new JabRefFrame();

// Add all loaded databases to the frame:
boolean first = true;
if (!loaded.isEmpty()) {
for (Iterator<ParserResult> i = loaded.iterator(); i.hasNext();) {
ParserResult pr = i.next();
// Add all bibDatabases databases to the frame:
boolean first = false;
if (!bibDatabases.isEmpty()) {
for (Iterator<ParserResult> parserResultIterator = bibDatabases.iterator(); parserResultIterator.hasNext();) {
ParserResult pr = parserResultIterator.next();

if (new LastFocusedTabPreferences(Globals.prefs).hadLastFocus(pr.getFile())) {
// Define focused tab
if (focusedFile != null && pr.getFile().getAbsolutePath().equals(focusedFile)) {
first = true;
}

if (pr.isInvalid()) {
failed.add(pr);
i.remove();
parserResultIterator.remove();
} else if (!pr.isPostponedAutosaveFound()) {
if (pr.toOpenTab()) {
// things to be appended to an opened tab should be done after opening all tabs
Expand All @@ -137,7 +145,7 @@ private void openWindow() {
first = false;
}
} else {
i.remove();
parserResultIterator.remove();
postponed.add(pr.getFile());
}
}
Expand Down Expand Up @@ -177,7 +185,7 @@ private void openWindow() {

if (Globals.prefs.getBoolean(JabRefPreferences.DISPLAY_KEY_WARNING_DIALOG_AT_STARTUP)) {
int i = 0;
for (ParserResult pr : loaded) {
for (ParserResult pr : bibDatabases) {
ParserResultWarningDialog.showParserResultWarningDialog(pr, JabRefGUI.getMainFrame(), i++);
}
}
Expand All @@ -189,10 +197,10 @@ private void openWindow() {
// in this version of JabRef.
// Note that we have to check whether i does not go over getBasePanelCount().
// This is because importToOpen might have been used, which adds to
// loaded, but not to getBasePanelCount()
// loadedDatabases, but not to getBasePanelCount()

for (int i = 0; (i < loaded.size()) && (i < JabRefGUI.getMainFrame().getBasePanelCount()); i++) {
ParserResult pr = loaded.get(i);
for (int i = 0; (i < bibDatabases.size()) && (i < JabRefGUI.getMainFrame().getBasePanelCount()); i++) {
ParserResult pr = bibDatabases.get(i);
BasePanel panel = JabRefGUI.getMainFrame().getBasePanelAt(i);
OpenDatabaseAction.performPostOpenActions(panel, pr, true);
}
Expand All @@ -206,33 +214,43 @@ private void openWindow() {
SwingUtilities.invokeLater(asp);
}

if (!loaded.isEmpty()) {
if (!bibDatabases.isEmpty()) {
new FocusRequester(JabRefGUI.getMainFrame().getCurrentBasePanel().getMainTable());
}
}

private void openLastEditedDatabase() {
// How to handle errors in the databases to open?
List<String> names = Globals.prefs.getStringList(JabRefPreferences.LAST_EDITED);
lastEdLoop: for (String name : names) {
File fileToOpen = new File(name);
private void openLastEditedDatabases() {
if (Globals.prefs.get(JabRefPreferences.LAST_EDITED) == null) {
return;
}

List<String> lastFiles = Globals.prefs.getStringList(JabRefPreferences.LAST_EDITED);

for (ParserResult pr : loaded) {
if ((pr.getFile() != null) && pr.getFile().equals(fileToOpen)) {
continue lastEdLoop;
}
for (String fileName : lastFiles) {
File dbFile = new File(fileName);

// Already parsed via command line parameter, e.g., "jabref.jar somefile.bib"
if (isLoaded(dbFile) || !dbFile.exists()) {
continue;
}

if (fileToOpen.exists()) {
ParserResult pr = OpenDatabaseAction.loadDatabaseOrAutoSave(name, false);
ParserResult parsedDatabase = OpenDatabaseAction.loadDatabaseOrAutoSave(fileName, false);

if (pr.isNullResult()) {
LOGGER.error(Localization.lang("Error opening file") + " '" + fileToOpen.getPath() + "'");
} else {
loaded.add(pr);
}
if (parsedDatabase.isNullResult()) {
LOGGER.error(Localization.lang("Error opening file") + " '" + dbFile.getPath() + "'");
} else {
bibDatabases.add(parsedDatabase);
}
}
}

private boolean isLoaded(File fileToOpen) {
for (ParserResult pr : bibDatabases) {
if (pr.getFile() != null && pr.getFile().equals(fileToOpen)) {
return true;
}
}
return false;
}

private void setLookAndFeel() {
Expand Down
6 changes: 2 additions & 4 deletions src/main/java/net/sf/jabref/cli/ArgumentProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,13 @@
import org.apache.commons.logging.LogFactory;

public class ArgumentProcessor {
private static final Log LOGGER = LogFactory.getLog(ArgumentProcessor.class);

public enum Mode {
INITIAL_START,
REMOTE_START
}


private static final Log LOGGER = LogFactory.getLog(ArgumentProcessor.class);

private final JabRefCLI cli;

private final List<ParserResult> parserResults;
Expand Down Expand Up @@ -230,7 +228,7 @@ private void doAuxImport(List<ParserResult> loaded) {
private List<ParserResult> importAndOpenFiles() {
List<ParserResult> loaded = new ArrayList<>();
List<String> toImport = new ArrayList<>();
if (!cli.isBlank() && (cli.getLeftOver().length > 0)) {
if (!cli.isBlank() && (!cli.getLeftOver().isEmpty())) {
for (String aLeftOver : cli.getLeftOver()) {
// Leftover arguments that have a "bib" extension are interpreted as
// BIB files to open. Other files, and files that could not be opened
Expand Down
9 changes: 6 additions & 3 deletions src/main/java/net/sf/jabref/cli/JabRefCLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
*/
package net.sf.jabref.cli;

import java.util.Arrays;
import java.util.List;

import net.sf.jabref.Globals;
import net.sf.jabref.logic.exporter.ExportFormats;
import net.sf.jabref.logic.l10n.Localization;
Expand All @@ -32,7 +35,7 @@ public class JabRefCLI {

private static final Log LOGGER = LogFactory.getLog(JabRefCLI.class);

private String[] leftOver;
private List<String> leftOver;
private final CommandLine cl;


Expand All @@ -42,7 +45,7 @@ public JabRefCLI(String[] args) {

try {
this.cl = new DefaultParser().parse(options, args);
this.leftOver = cl.getArgs();
this.leftOver = Arrays.asList(cl.getArgs());
} catch (ParseException e) {
LOGGER.warn("Problem parsing arguments", e);

Expand Down Expand Up @@ -262,7 +265,7 @@ private String getVersionInfo() {
return String.format("JabRef %s", Globals.BUILD_INFO.getVersion());
}

public String[] getLeftOver() {
public List<String> getLeftOver() {
return leftOver;
}

Expand Down
Loading

0 comments on commit c974ae1

Please sign in to comment.