Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into selectFilesDlg
Browse files Browse the repository at this point in the history
* upstream/master:
  Add warning message if group with same name is already present (#3077)
  Fix #3062: Ctrl + F works again
  Fix del/copy/paste key trigger main table action in search bar (#3070)
  Fix markdown
  Update gradle from 4.0.1 to 4.0.2
  Fix #3045 Update Transformer plugin
  Reimplement MappedList using a backigList (#3069)
  Fix importing preferences after resetting without restarting (#3065)
  Fix some spotbugs issues (#3060)
  Import dialog when fetch (#3025)
  Adapt CircleCI build
  Adapt CI script
  Closes #3027 and updates install4j to v7
  • Loading branch information
Siedlerchr committed Aug 6, 2017
2 parents 24c35c5 + ee4f252 commit 8dca324
Show file tree
Hide file tree
Showing 41 changed files with 1,064 additions and 241 deletions.
12 changes: 10 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,17 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#

### Changed

- If fetched article is already in database, then the entry merge dialog is shown.
- An error message is now displayed if you try to create a group containing the keyword separator or if there is already a group with the same name. [#3075](https://github.com/JabRef/jabref/issues/3075) and [#1495](https://github.com/JabRef/jabref/issues/1495)

### Fixed
We fixed an issue where the fetcher for the Astrophysics Data System (ADS) added some non-bibtex data to the entry returned from the search [#3035](https://github.com/JabRef/jabref/issues/3035)
We fixed an issue where assigning an entry via drag and drop to a group caused JabRef to stop/freeze completely [#3036](https://github.com/JabRef/jabref/issues/3036)

- We fixed an issue where the fetcher for the Astrophysics Data System (ADS) added some non-bibtex data to the entry returned from the search [#3035](https://github.com/JabRef/jabref/issues/3035)
- We fixed an issue where assigning an entry via drag and drop to a group caused JabRef to stop/freeze completely [#3036](https://github.com/JabRef/jabref/issues/3036)
- We fixed the shortcut <kbd>Ctrl</kbd>+<kbd>F</kbd> for the search field.
- We fixed an issue where the preferences could not be imported without a restart of JabRef [#3064](https://github.com/JabRef/jabref/issues/3064)
- We fixed an issue where <kbd>DEL</kbd>, <kbd>Ctrl</kbd>+<kbd>C</kbd>, <kbd>Ctrl</kbd>+<kbd>V</kbd> and <kbd>Ctrl</kbd>+<kbd>A</kbd> in the search field triggered corresponding actions in the main table [#3067](https://github.com/JabRef/jabref/issues/3067)

### Removed


Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import org.gradle.internal.os.OperatingSystem

// to update the gradle wrapper, execute ./gradlew wrapper --gradle-version 3.0
// to update the gradle wrapper, execute ./gradlew wrapper --gradle-version 4.0

plugins {
id 'com.gradle.build-scan' version '1.8'
id 'com.install4j.gradle' version '6.1.5'
id 'com.github.johnrengelman.shadow' version '2.0.1'
id "de.sebastianboegl.shadow.transformer.log4j" version "2.1.0"
id "de.sebastianboegl.shadow.transformer.log4j" version "2.1.1"
id "com.simonharrer.modernizer" version '1.5.0-1'
id 'me.champeau.gradle.jmh' version '0.4.3'
id 'net.ltgt.errorprone' version '0.0.11'
Expand Down
8 changes: 4 additions & 4 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ dependencies:
# openssl aes-256-cbc -e -in ./buildres/jabref-cert-2016.p12 -out jabref-cert-2016.p12.enc -k {PASSWORD}
- openssl aes-256-cbc -d -in ./buildres/jabref-cert-2016.p12.enc -out ./buildres/jabref-cert-2016.p12 -k $CERTIFICATE
- scripts/prepare-install4j.sh
- install4j6/bin/install4jc --verbose --license=$INSTALL4J_KEY --win-keystore-password $CERTIFICATE_PW --mac-keystore-password $CERTIFICATE_PW
- install4j7/bin/install4jc --verbose --license=$INSTALL4J_KEY --win-keystore-password $CERTIFICATE_PW --mac-keystore-password $CERTIFICATE_PW
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.
- ./gradlew compileJava
cache_directories:
- "~/.install4j6"
- "~/.install4j7"
- "~/downloads"

test:
override:
- ./gradlew -Pdev=true -Pinstall4jDir="install4j6" release --stacktrace
- ./gradlew -Pdev=true -Pinstall4jDir="install4j7" release --stacktrace
post:
# save test reports as build artifacts
- mkdir -p $CIRCLE_TEST_REPORTS/junit/
Expand All @@ -32,7 +32,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)
- ./gradlew -Pinstall4jDir="install4j6" clean release --stacktrace
- ./gradlew -Pinstall4jDir="install4j7" clean release --stacktrace
# upload at all circumstances
- scripts/upload-to-builds.jabref.org.sh
development:
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 @@
#Tue Jul 18 01:58:04 BRT 2017
#Thu Aug 03 11:08:08 CEST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0.2-bin.zip
832 changes: 765 additions & 67 deletions jabref.install4j

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions scripts/prepare-install4j.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ fi

# ensure that tar archive of install4j exists
cd ~/downloads
wget --quiet -nc http://download-keycdn.ej-technologies.com/install4j/install4j_unix_6_1_6.tar.gz
wget --quiet -nc http://download-keycdn.ej-technologies.com/install4j/install4j_unix_7_0_1.tar.gz

# extract tar archive of install4j into the source directory of JabRef
cd ~/jabref
# version 6.1.6 is NOT zipped any more - old command line: "-xzf"
tar -xf ~/downloads/install4j_unix_6_1_6.tar.gz
# version 7.0.1 is NOT zipped any more - old command line: "-xzf"
tar -xf ~/downloads/install4j_unix_7_0_1.tar.gz
# fix directory name (until install4j 6.1.5 it was install4j6
mv install4j6.1.6 install4j6
mv install4j7.0.1 install4j7

# fetch JREs
if [ ! -d ~/.install4j6/jres/ ]; then
mkdir -p ~/.install4j6/jres/
if [ ! -d ~/.install4j7/jres/ ]; then
mkdir -p ~/.install4j7/jres/
fi
cd ~/.install4j6/jres/
wget --quiet -nc https://files.jabref.org/jres/windows-x86-1.8.0_131.tar.gz
wget --quiet -nc https://files.jabref.org/jres/windows-amd64-1.8.0_131.tar.gz
wget --quiet -nc https://files.jabref.org/jres/macosx-amd64-1.8.0_131_unpacked.tar.gz
cd ~/.install4j7/jres/
wget --quiet -nc https://files.jabref.org/jres/windows-x86-1.8.0_141.tar.gz
wget --quiet -nc https://files.jabref.org/jres/windows-amd64-1.8.0_141.tar.gz
wget --quiet -nc https://files.jabref.org/jres/macosx-amd64-1.8.0_141_unpacked.tar.gz
2 changes: 1 addition & 1 deletion src/main/java/org/jabref/Globals.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ private Globals() {
}

// Key binding preferences
public static KeyBindingRepository getKeyPrefs() {
public static synchronized KeyBindingRepository getKeyPrefs() {
if (keyBindingRepository == null) {
keyBindingRepository = prefs.getKeyBindingRepository();
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/BasePanel.java
Original file line number Diff line number Diff line change
Expand Up @@ -2144,7 +2144,9 @@ public void action() {
if ((focused != null) && (focused instanceof FieldEditor) && focused.hasFocus()) {
// User is currently editing a field:
// Check if it is the preamble:
if ((preambleEditor != null) && (focused == preambleEditor.getFieldEditor())) {

FieldEditor fieldEditor = (FieldEditor) focused;
if ((preambleEditor != null) && (fieldEditor.equals(preambleEditor.getFieldEditor()))) {
preambleEditor.storeCurrentEdit();
}
}
Expand Down
20 changes: 17 additions & 3 deletions src/main/java/org/jabref/gui/EntryTypeDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
import javax.swing.SwingWorker;

import org.jabref.Globals;
import org.jabref.gui.importer.ImportInspectionDialog;
import org.jabref.gui.keyboard.KeyBinding;
import org.jabref.logic.bibtex.DuplicateCheck;
import org.jabref.logic.bibtexkeypattern.BibtexKeyPatternUtil;
import org.jabref.logic.importer.FetcherException;
import org.jabref.logic.importer.IdBasedFetcher;
Expand Down Expand Up @@ -305,10 +307,22 @@ protected void done() {
Optional<BibEntry> result = get();
if (result.isPresent()) {
final BibEntry bibEntry = result.get();
// Regenerate CiteKey of imported BibEntry
BibtexKeyPatternUtil.makeAndSetLabel(Globals.prefs.getBibtexKeyPatternPreferences().getKeyPattern(), frame.getCurrentBasePanel().getDatabase(), bibEntry, Globals.prefs.getBibtexKeyPatternPreferences());
if ((DuplicateCheck.containsDuplicate(frame.getCurrentBasePanel().getDatabase(), bibEntry, frame.getCurrentBasePanel().getBibDatabaseContext().getMode()).isPresent())) {
//If there are duplicates starts ImportInspectionDialog
final BasePanel panel = (BasePanel) frame.getTabbedPane().getSelectedComponent();

ImportInspectionDialog diag = new ImportInspectionDialog(frame, panel, Localization.lang("Import"), false);
diag.addEntry(bibEntry);
diag.entryListComplete();
diag.setLocationRelativeTo(frame);
diag.setVisible(true);
diag.toFront();
} else {
// Regenerate CiteKey of imported BibEntry
BibtexKeyPatternUtil.makeAndSetLabel(Globals.prefs.getBibtexKeyPatternPreferences().getKeyPattern(), frame.getCurrentBasePanel().getDatabase(), bibEntry, Globals.prefs.getBibtexKeyPatternPreferences());
frame.getCurrentBasePanel().insertEntry(bibEntry);
}

frame.getCurrentBasePanel().insertEntry(bibEntry);
dispose();
} else if (searchID.trim().isEmpty()) {
JOptionPane.showMessageDialog(frame, Localization.lang("The given search ID was empty."), Localization.lang("Empty search ID"), JOptionPane.WARNING_MESSAGE);
Expand Down
15 changes: 2 additions & 13 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import java.awt.Insets;
import java.awt.RenderingHints;
import java.awt.event.ActionEvent;
import java.awt.event.KeyListener;
import java.awt.event.KeyAdapter;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.time.LocalDateTime;
Expand Down Expand Up @@ -157,18 +157,7 @@ public EntryEditor(JabRefFrame frame, BasePanel panel, BibEntry entry, String la

JFXPanel container = new JFXPanel();

container.addKeyListener(new KeyListener() {

@Override
public void keyTyped(java.awt.event.KeyEvent e) {
//empty
}

@Override
public void keyReleased(java.awt.event.KeyEvent e) {
// empty

}
container.addKeyListener(new KeyAdapter() {

@Override
public void keyPressed(java.awt.event.KeyEvent e) {
Expand Down
42 changes: 35 additions & 7 deletions src/main/java/org/jabref/gui/groups/GroupDialog.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.jabref.model.groups.AutomaticPersonsGroup;
import org.jabref.model.groups.ExplicitGroup;
import org.jabref.model.groups.GroupHierarchyType;
import org.jabref.model.groups.GroupTreeNode;
import org.jabref.model.groups.RegexKeywordGroup;
import org.jabref.model.groups.SearchGroup;
import org.jabref.model.groups.WordKeywordGroup;
Expand Down Expand Up @@ -326,18 +327,45 @@ public void actionPerformed(ActionEvent e) {
okButton.addActionListener(e -> {
isOkPressed = true;
try {
String groupName = nameField.getText().trim();
if (explicitRadioButton.isSelected()) {
resultingGroup = new ExplicitGroup(nameField.getText().trim(), getContext(),
Globals.prefs.getKeywordDelimiter());
Character keywordDelimiter = Globals.prefs.getKeywordDelimiter();
if (groupName.contains(Character.toString(keywordDelimiter))) {
jabrefFrame.showMessage(
Localization.lang("The group name contains the keyword separator \"%0\" and thus probably does not work as expected.", Character.toString(keywordDelimiter)));
}

Optional<GroupTreeNode> rootGroup = jabrefFrame.getCurrentBasePanel().getBibDatabaseContext().getMetaData().getGroups();
if (rootGroup.isPresent()) {
int groupsWithSameName = rootGroup.get().findChildrenSatisfying(group -> group.getName().equals(groupName)).size();
boolean warnAboutSameName = false;
if (editedGroup == null && groupsWithSameName > 0) {
// New group but there is already one group with the same name
warnAboutSameName = true;
}
if (editedGroup != null && !editedGroup.getName().equals(groupName) && groupsWithSameName > 0) {
// Edit group, changed name to something that is already present
warnAboutSameName = true;
}

if (warnAboutSameName) {
jabrefFrame.showMessage(
Localization.lang("There exists already a group with the same name.", Character.toString(keywordDelimiter)));
return;
}
}

resultingGroup = new ExplicitGroup(groupName, getContext(),
keywordDelimiter);
} else if (keywordsRadioButton.isSelected()) {
// regex is correct, otherwise OK would have been disabled
// therefore I don't catch anything here
if (keywordGroupRegExp.isSelected()) {
resultingGroup = new RegexKeywordGroup(nameField.getText().trim(), getContext(),
resultingGroup = new RegexKeywordGroup(groupName, getContext(),
keywordGroupSearchField.getText().trim(), keywordGroupSearchTerm.getText().trim(),
keywordGroupCaseSensitive.isSelected());
} else {
resultingGroup = new WordKeywordGroup(nameField.getText().trim(), getContext(),
resultingGroup = new WordKeywordGroup(groupName, getContext(),
keywordGroupSearchField.getText().trim(), keywordGroupSearchTerm.getText().trim(),
keywordGroupCaseSensitive.isSelected(), Globals.prefs.getKeywordDelimiter(), false);
}
Expand All @@ -346,20 +374,20 @@ public void actionPerformed(ActionEvent e) {
// regex is correct, otherwise OK would have been
// disabled
// therefore I don't catch anything here
resultingGroup = new SearchGroup(nameField.getText().trim(), getContext(), searchGroupSearchExpression.getText().trim(),
resultingGroup = new SearchGroup(groupName, getContext(), searchGroupSearchExpression.getText().trim(),
isCaseSensitive(), isRegex());
} catch (Exception e1) {
// should never happen
}
} else if (autoRadioButton.isSelected()) {
if (autoGroupKeywordsOption.isSelected()) {
resultingGroup = new AutomaticKeywordGroup(
nameField.getText().trim(), getContext(),
groupName, getContext(),
autoGroupKeywordsField.getText().trim(),
autoGroupKeywordsDeliminator.getText().charAt(0),
autoGroupKeywordsHierarchicalDeliminator.getText().charAt(0));
} else {
resultingGroup = new AutomaticPersonsGroup(nameField.getText().trim(), getContext(),
resultingGroup = new AutomaticPersonsGroup(groupName, getContext(),
autoGroupPersonsField.getText().trim());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public void openFiles(List<Path> filesToOpen, boolean raisePanel) {
Path file = iterator.next();
for (int i = 0; i < frame.getTabbedPane().getTabCount(); i++) {
BasePanel basePanel = frame.getBasePanelAt(i);
if ((basePanel.getBibDatabaseContext().getDatabaseFile().isPresent())
&& basePanel.getBibDatabaseContext().getDatabaseFile().get().equals(file)) {
if ((basePanel.getBibDatabaseContext().getDatabasePath().isPresent())
&& basePanel.getBibDatabaseContext().getDatabasePath().get().equals(file)) {
iterator.remove();
removed++;
// See if we removed the final one. If so, we must perhaps
Expand Down
Loading

0 comments on commit 8dca324

Please sign in to comment.