Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
* upstream/master:
  Addition to the early pull #6438 (#6441)
  Fix the bug #6421 (#6438)
  Cleanup dead code (#6436)
  Fixed entry duplication on file download (#6437)
  Add workaround for buildSrc issue (#6433)
  Remove dash from illegal characters. (#6300)
  Docs: For developers: New architectural decision added to list (#6397)
  • Loading branch information
Siedlerchr committed May 7, 2020
2 parents ded2a2a + 990c6c0 commit 1a88b54
Show file tree
Hide file tree
Showing 31 changed files with 230 additions and 278 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ charset = utf-8
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Added

- We added a new field in the preferences in 'BibTeX key generator' for unwanted characters that can be user-specified. [#6295](https://github.com/JabRef/jabref/issues/6295)
- We added support for searching ShortScience for an entry through the user's browser. [#6018](https://github.com/JabRef/jabref/pull/6018)
- We updated EditionChecker to permit edition to start with a number. [#6144](https://github.com/JabRef/jabref/issues/6144)
- We added tooltips for most fields in the entry editor containing a short description. [#5847](https://github.com/JabRef/jabref/issues/5847)
- We added support for basic markdown in custom formatted previews [#6194](https://github.com/JabRef/jabref/issues/6194)
- We now show the number of items found and selected to import in the online search dialog. [#6248](https://github.com/JabRef/jabref/pull/6248)
- We created a new install screen for macOS. [#5759](https://github.com/JabRef/jabref/issues/5759)
- We implemented an option to download fulltext files while importing. [#6381](https://github.com/JabRef/jabref/pull/6381)
- We fixed the bug when strike the delete key in the text field. [#6421](https://github.com/JabRef/jabref/issues/6421)

### Changed

Expand All @@ -33,6 +35,8 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve
### Fixed

- We fixed wrong button order (Apply and Cancel) in ManageProtectedTermsDialog.
- We fixed an issue with incompatible characters at BibTeX key [#6257](https://github.com/JabRef/jabref/issues/6257)
- We fixed an issue where dash (`-`) was reported as illegal BibTeX key [#6295](https://github.com/JabRef/jabref/issues/6295)
- We greatly improved the performance of the overall application and many operations. [#5071](https://github.com/JabRef/jabref/issues/5071)
- We fixed an issue where sort by priority was broken. [#6222](https://github.com/JabRef/jabref/issues/6222)
- We fixed an issue where opening a library from the recent libraries menu was not possible. [#5939](https://github.com/JabRef/jabref/issues/5939)
Expand All @@ -53,6 +57,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Removed

- We removed the option of the "enforce legal key". [#6295](https://github.com/JabRef/jabref/issues/6295)
- We removed the obsolete `External programs / Open PDF` section in the preferences, as the default application to open PDFs is now set in the `Manage external file types` dialog. [#6130](https://github.com/JabRef/jabref/pull/6130)
- We removed the option to configure whether a `.bib.bak` file should be generated upon save. It is now always enabled. Documentation at <https://docs.jabref.org/general/autosave>. [#6092](https://github.com/JabRef/jabref/issues/6092)
- We removed the built-in list of IEEE journal abbreviations using BibTeX strings. If you still want to use them, you have to download them separately from <https://abbrv.jabref.org>.
Expand Down
6 changes: 3 additions & 3 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This page presents all development informatation around JabRef. For users documentation see [https://docs.jabref.org](https://docs.jabref.org).

## Teaching Excersises
## Teaching Exercises

We are very happy that JabRef is part of [Software Engineering](https://en.wikipedia.org/wiki/Software_engineering) trainings.
Please head to [Teaching](teaching.md) for more information on using JabRef as teaching object and on previous courses where JabRef was used.
Expand All @@ -26,8 +26,7 @@ Without jlink, it is not possible to generate a fat jar any more. During develop

## Groups


diagram showing aspects of groups: [Groups.uml](Groups.uml).
Diagram showing aspects of groups: [Groups.uml](Groups.uml).

## Decision Records

Expand All @@ -43,6 +42,7 @@ This log lists the decisions for JabRef.
* [ADR-0007](adr/0007-human-readable-changelog.md) - Provide a human-readable changelog
* [ADR-0008](adr/0008-use-public-final-instead-of-getters.md) - Use public final instead of getters to offer access to immutable variables
* [ADR-0009](adr/0009-use-plain-junit5-for-testing.md) - Use Plain JUnit5 for advanced test assertions
* [ADR-0010](0010-use-h2-as-internal-database.md) - Use H2 as Internal SQL Database

For new ADRs, please use [template.md](adr/template.md) as basis. More information on MADR is available at [https://adr.github.io/madr/](https://adr.github.io/madr/). General information about architectural decision records is available at [https://adr.github.io/](https://adr.github.io/).

55 changes: 24 additions & 31 deletions docs/guidelines-for-setting-up-a-local-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In case you know how to install JDK14 and to fork JabRef's code,

For a complete step-by-step guide for Linux using IntellJ IDEA as the IDE, have a look at the following video instructions:

[![](https://img.youtube.com/vi/JkFVJ6p0urw/mqdefault.jpg)](https://youtu.be/JkFVJ6p0urw)
[![YouTube video showing the step-by-step guide](https://img.youtube.com/vi/JkFVJ6p0urw/mqdefault.jpg)](https://youtu.be/JkFVJ6p0urw)

## Prerequisites

Expand Down Expand Up @@ -98,26 +98,20 @@ IntelliJ IDEA fully supports Gradle as a build tool, but also has an internal bu
To configure IntelliJ IDEA for developing JabRef, you should first ensure that you have enabled both bundled plugins _Gradle_ and _Gradle Extension_

* Navigate to **File \| Settings \| Plugins \| Installed** and check that you have

the _Gradle_ and _Gradle Extension_ enabled.

After that, you can open `jabref/build.gradle` as a project. It is crucial that Java 14 is used consistently for the JabRef project which includes ensuring the right settings for your project structure, Gradle build, and run configurations.

* Ensure you have a Java 14 SDK configured by navigating to

**File \| Project Structure \| Platform Settings \| SDKs**. If you don't have one, add a new Java JDK and point it to the

location of a JDK 14.

* Navigate to **File \| Project Structure \| Project** and ensure that the projects' SDK is Java 14
* Navigate to **File \| Settings \| Build, Execution, Deployment \| Build Tools \| Gradle** and select the Java 14 SDK as

the Gradle JVM at the bottom.

To prepare IntelliJ's build system two additional steps are required

* Navigate to **File \| Settings \| Build, Execution, Deployment \| Compiler \| Java Compiler**, and under

"Override compiler parameters per-module" add \(\[+\]\) the following compiler arguments for the `JabRef.main` module:

```text
Expand All @@ -134,21 +128,16 @@ To prepare IntelliJ's build system two additional steps are required
Ensuring JabRef builds with Gradle should always the first step because, e.g. it generates additional sources that are required for compiling the code. After adjusting all settings mentioned earlier, your first step should be to

* Open the Gradle Tool Window with the small button that can usually be found on the right side of IDEA or navigate to

**View \| Tool Windows \| Gradle**.

* In the Gradle Tool Window, press the "Reimport All Gradle Projects" button to ensure that all settings are up-to-date

with the setting changes.

After that, you can use the Gradle Tool Window to build all parts JabRef and run it. To do so, expand the JabRef project in the Gradle Tool Window and navigate to Tasks. From there, you can

* Build and run JabRef by double-clicking **JabRef \| Tasks \| application \| run**.

After that a new entry called "jabref \[run\]" will appear in the run configurations.

* Now you can also select "jabref \[run\]" and either run or debug the application from within IntelliJ.

After that a new entry called "jabref \[run\]" will appear in the run configurations.
Now you can also select "jabref \[run\]" and either run or debug the application from within IntelliJ.
You can run any other development task in a similar way. Equivalently, this can also be executed from the terminal by running `./gradlew run`.

#### Using IntelliJ's internal build system
Expand All @@ -158,41 +147,40 @@ You should use IntelliJ IDEA's internal build system for compiling and running J
To use IntelliJ IDEA's internal build system when you build JabRef through **Build \| Build Project** or use the provided "JabRef Main" run configuration, ensure that

* in **File \| Settings \| Build, Execution, Deployment \| Build Tools \| Gradle** the setting "Build and run using" and

"Test using" is set to "IntelliJ IDEA".
* Ignore the Gradle project "buildSrc":
![Ignore the Gradle project "buildSrc"](intellij-gradle-config-ignore-buildSrc.png)

Essentially, you now have the best of both worlds: You can run Gradle tasks using the Gradle Tool Window and unless you haven't made changes to input files that generate sources, you can compile and run with IntelliJ's faster internal build system.

#### Using JabRef's code-style
#### Using JabRef's code style

Contributions to JabRef's source code need to have a code formatting that is consistent with existing source code. For that purpose, JabRef provides code-style and check-style definitions.

* Install the [CheckStyle-IDEA plugin](http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via the plug-in repository:
1. Navigate to **File \| Settings \| Plugins \| Marketplace** and search for "Checkstyle" and choose "CheckStyle-IDEA"
2. Close the settings afterwards and restart IntelliJ
1. Navigate to **File \| Settings \| Plugins \| Marketplace** and search for "Checkstyle" and choose "CheckStyle-IDEA"
2. Close the settings afterwards and restart IntelliJ
* Go to **File \| Settings \| Editor \| Code Style**
* Click on the settings wheel \(next to the scheme chooser\), then click "Import Scheme"
* Select the IntelliJ configuration file `config/IntelliJ Code Style.xml`
* Go to **File \| Settings \| Checkstyle \| Configuration File**
1. Import the CheckStyle configuration file by clicking the \[+\] button
2. For the description provide "JabRef"
3. Click "Browse" and choose `config/checkstyle/checkstyle.xml`
4. Check "Store relative to project location"
5. Click "Next" and "Finish"
6. Activate the CheckStyle configuration file by ticking it in the list
7. Ensure that CheckStyle version 8.31 (or higher) is selected
8. Save settings by clicking "OK"

![checkstyle settings](images/intellij-checkstyle-settings.png)
1. Import the CheckStyle configuration file by clicking the \[+\] button
2. For the description provide "JabRef"
3. Click "Browse" and choose `config/checkstyle/checkstyle.xml`
4. Check "Store relative to project location"
5. Click "Next" and "Finish"
6. Activate the CheckStyle configuration file by ticking it in the list
7. Ensure that CheckStyle version 8.31 (or higher) is selected
8. Save settings by clicking "OK"
9. Your configuration should now look like this:
![checkstyle settings](images/intellij-checkstyle-settings.png)

#### Troubleshooting when using both IDEA and Eclipse

If you have configured Eclipse for the same project \(the required steps are described below\), then the additionally added file `Log4jPlugins.java` must be excluded from the compilation process, otherwise an error will occur during the compilation of the project:

* **File \| Settings \| Build, Execution, Deployment \| Compiler \| Excludes** and add the following file to the

list \(\[+\]\), in order to exclude it:

* `src/main/java/org/jabref/gui/logging/plugins/Log4jPlugins.java`

### Setup for Eclipse
Expand Down Expand Up @@ -235,7 +223,12 @@ For Eclipse 2020-03 you need to install [jdk14 support](https://marketplace.ecli
--patch-module org.jabref=build\resources\main
```

6. Optional: Install the [e\(fx\)clipse plugin](http://www.eclipse.org/efxclipse/index.html) from the Eclipse marketplace: 1. Help -&gt; Eclipse Marketplace... -&gt; Search tab 2. Enter "e\(fx\)clipse" in the search dialogue 3. Click "Go" 4. Click "Install" button next to the plugin 5. Click "Finish"
6. Optional: Install the [e\(fx\)clipse plugin](http://www.eclipse.org/efxclipse/index.html) from the Eclipse marketplace:
1. Help -&gt; Eclipse Marketplace... -&gt; Search tab
2. Enter "e\(fx\)clipse" in the search dialogue
3. Click "Go"
4. Click "Install" button next to the plugin
5. Click "Finish"
7. Now you can build and run/debug the application by either using "JabRefLauncher" or "JabRefMain". This is the recommended way, since the application starts quite fast.

## Final comments
Expand Down
Binary file added docs/intellij-gradle-config-ignore-buildSrc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 0 additions & 19 deletions src/main/java/org/jabref/gui/JabRefFrame.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.Separator;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.SplitPane;
Expand Down Expand Up @@ -155,7 +154,6 @@ public class JabRefFrame extends BorderPane {
private final ThemeLoader themeLoader = Globals.getThemeLoader();
private final GlobalSearchBar globalSearchBar = new GlobalSearchBar(this, Globals.stateManager);

private final ProgressBar progressBar = new ProgressBar();
private final FileHistoryMenu fileHistory;

private final Stage mainStage;
Expand Down Expand Up @@ -430,8 +428,6 @@ public boolean quit() {
}

private void initLayout() {
setProgressBarVisible(false);

setId("frame");

VBox head = new VBox(createMenu(), createToolbar());
Expand Down Expand Up @@ -1084,21 +1080,6 @@ public FileHistoryMenu getFileHistory() {
return fileHistory;
}

/**
* Set the visibility of the progress bar in the right end of the status line at the bottom of the frame.
*/
public void setProgressBarVisible(final boolean visible) {
progressBar.setVisible(visible);
}

/**
* Sets the indeterminate status of the progress bar.
* <p>
*/
public void setProgressBarIndeterminate(final boolean value) {
progressBar.setProgress(ProgressBar.INDETERMINATE_PROGRESS);
}

/**
* Return a boolean, if the selected entry have file
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void saveFields() {
return;
}

String testString = BibtexKeyGenerator.cleanKey(parts[1], preferences.getEnforceLegalKeys());
String testString = BibtexKeyGenerator.cleanKey(parts[1], preferences.getUnwantedCharacters());
if (!testString.equals(parts[1]) || (parts[1].indexOf('&') >= 0)) {
dialogService.showInformationDialogAndWait(
Localization.lang("Error"),
Expand Down
106 changes: 55 additions & 51 deletions src/main/java/org/jabref/gui/edit/EditAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,63 +14,67 @@
*/
public class EditAction extends SimpleCommand {

private final JabRefFrame frame;
private final StandardActions action;
private final StateManager stateManager;
private final JabRefFrame frame;
private final StandardActions action;
private final StateManager stateManager;

public EditAction(StandardActions action, JabRefFrame frame, StateManager stateManager) {
this.action = action;
this.frame = frame;
this.stateManager = stateManager;
public EditAction(StandardActions action, JabRefFrame frame, StateManager stateManager) {
this.action = action;
this.frame = frame;
this.stateManager = stateManager;

this.executable.bind(ActionHelper.needsEntriesSelected(stateManager));
}
this.executable.bind(ActionHelper.needsEntriesSelected(stateManager));
}

@Override
public String toString() {
return this.action.toString();
}
@Override
public String toString() {
return this.action.toString();
}

@Override
public void execute() {
stateManager.getFocusOwner().ifPresent(focusOwner -> {
if (focusOwner instanceof TextInputControl) {
// Focus is on text field -> copy/paste/cut selected text
TextInputControl textInput = (TextInputControl) focusOwner;
switch (action) {
case COPY:
textInput.copy();
break;
case CUT:
textInput.cut();
break;
case PASTE:
// handled by FX in TextInputControl#paste
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported in TextInputControl but got " + action);
}
} else {
// Not sure what is selected -> copy/paste/cut selected entries
@Override
public void execute() {
stateManager.getFocusOwner().ifPresent(focusOwner -> {
if (focusOwner instanceof TextInputControl) {
// Focus is on text field -> copy/paste/cut selected text
TextInputControl textInput = (TextInputControl) focusOwner;
switch (action) {
case COPY:
textInput.copy();
break;
case CUT:
textInput.cut();
break;
case PASTE:
// handled by FX in TextInputControl#paste
break;
case DELETE_ENTRY:
// DELETE_ENTRY in text field should do forward delete
textInput.deleteNextChar();
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported in TextInputControl but got " + action);
}
} else {
// Not sure what is selected -> copy/paste/cut selected entries

// ToDo: Should be handled by BibDatabaseContext instead of BasePanel
switch (action) {
case COPY:
frame.getCurrentBasePanel().copy();
break;
case CUT:
frame.getCurrentBasePanel().cut();
break;
case PASTE:
frame.getCurrentBasePanel().paste();
break;
case DELETE_ENTRY:
frame.getCurrentBasePanel().delete(false);
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported but got " + action);
}
// ToDo: Should be handled by BibDatabaseContext instead of BasePanel
switch (action) {
case COPY:
frame.getCurrentBasePanel().copy();
break;
case CUT:
frame.getCurrentBasePanel().cut();
break;
case PASTE:
frame.getCurrentBasePanel().paste();
break;
case DELETE_ENTRY:
frame.getCurrentBasePanel().delete(false);
break;
default:
throw new IllegalStateException("Only cut/copy/paste supported but got " + action);
}
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public static FieldEditorFX getForField(final Field field,
databaseContext,
preferences.getFilePreferences(),
journalAbbreviationRepository,
preferences.getBoolean(JabRefPreferences.ENFORCE_LEGAL_BIBTEX_KEY),
preferences.getBoolean(JabRefPreferences.ALLOW_INTEGER_EDITION_BIBTEX));

final boolean isSingleLine = FieldFactory.isSingleLineField(field);
Expand Down
Loading

0 comments on commit 1a88b54

Please sign in to comment.