Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into customizeEntrydlg
Browse files Browse the repository at this point in the history
* upstream/master:
  Update development-strategy.md
  Replace link to Workspace set-up with new one (#5896)
  Fixes making paths of linked files relative (web urls will not be touched anymore) (#5879)
  Switch to our IntelliJ config (#5881)
  • Loading branch information
Siedlerchr committed Jan 31, 2020
2 parents 0f1ff4c + 216a910 commit 7a2f0ef
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We fixed an issue where the ampersand character wasn't rendering correctly on previews. [#3840](https://github.com/JabRef/jabref/issues/3840)
- We fixed an issue where an erroneous "The library has been modified by another program" message was shown when saving. [#4877](https://github.com/JabRef/jabref/issues/4877)
- We fixed an issue where the file extension was missing after downloading a file (we now fall-back to pdf). [#5816](https://github.com/JabRef/jabref/issues/5816)
- We fixed an issue where cleaning up entries broke web URLs, if "Make paths of linked files relative (if possible)" was enabled, which resulted in various other issues subsequently. [#5861](https://github.com/JabRef/jabref/issues/5861)

### Removed
- Ampersands are no longer escaped by default in the `bib` file. If you want to keep the current behaviour, you can use the new "Escape Ampersands" formatter as a save action.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ We view pull requests as a collaborative process.
Submit a pull request early to get feedback from the team on work in progress.
We will discuss improvements with you and agree to merge them once the [developers](https://github.com/JabRef/jabref/blob/master/DEVELOPERS) approve.

If you want a step-by-step walk-through on how to set-up your workspace, please check [this guideline](https://github.com/JabRef/jabref/wiki/Guidelines-for-setting-up-a-local-workspace).
If you want a step-by-step walk-through on how to set-up your workspace, please check [this guideline](https://devdocs.jabref.org/guidelines-for-setting-up-a-local-workspace/).

To compile JabRef from source, you need a Java Development Kit 13 and `JAVA_HOME` pointing to this JDK.
To run it, just execute `gradlew run`.
Expand Down
5 changes: 3 additions & 2 deletions docs/development-strategy.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ To ensure high code-quality,

- we follow the priniciples of [Java by Comparison](https://java.by-comparison.com/).
- we follow the principles of [Effetcive Java](https://www.oreilly.com/library/view/effective-java-3rd/9780134686097/).
- we use [Design Pattners](https://java-design-patterns.com/patterns/) wherever possible.
- we use [Design Pattners](https://java-design-patterns.com/patterns/) when applicable.
- we document our design decisions using the lightweight architectural decision records [MADR](https://adr.github.io/madr/).
- we review each pull request by at least two [JabRef Core Developers](https://github.com/JabRef/jabref/blob/master/DEVELOPERS).
- we review each external pull request by at least two [JabRef Core Developers](https://github.com/JabRef/jabref/blob/master/DEVELOPERS).

## Continuos integration

Expand All @@ -22,6 +22,7 @@ The branch [master](https://builds.jabref.org/master/) is the main development l

Other branches are used for discussing improvements with the help of [pull requests](https://github.com/JabRef/jabref/pulls).
One can see the binaries of each branch at <https://builds.jabref.org/>.
Releases mark milestones and are based on the master at a point in time.

## How JabRef aquires contributors

Expand Down
11 changes: 6 additions & 5 deletions docs/guidelines-for-setting-up-a-local-workspace.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ Under Ubuntu Linux, you can follow the [documentation from the Ubuntu Community]
--add-exports javafx.controls/com.sun.javafx.scene.control.behavior=com.jfoenix
--patch-module org.jabref=build/resources/main
```
4. Optional: Use IntellJ to build and run (instead of gradle): File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Under "Build and run using" and "Run tests using" choose "Intellj IDEA"
5. Use the provided code style:
1. Install the [CheckStyle-IDEA plugin](http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via plug-in repository (File > Settings > Plugins > Browse repositories).
4. Use IntellJ to build and run (instead of gradle): File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> At "Build and run using" and "Run tests using" choose "Intellj IDEA"
4. Ensure that JDK13 is enabled for Gradle: Use IntellJ to build and run (instead of gradle): File -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Gradle -> Gradle JVM
5. Use the provided code style:
1. Install the [CheckStyle-IDEA plugin](http://plugins.jetbrains.com/plugin/1065?pr=idea), it can be found via plug-in repository (File > Settings > Plugins > Marketplace -> Search for "Checkstyle" and choose "CheckStyle-IDEA). Close the settings afterwards and restart IntelliJ.
2. Go to File > Settings > Editor > Code Style, choose a code style (or create a new one)
3. Click on the settings wheel (next to the scheme chooser), then Import scheme and choose "CheckStyle Configuration". Select the CheckStyle configuration file `config\checkstyle\checkstyle.xml`. Click OK and restart IntelliJ.
4. Go to File -> Settings -> Checkstyle and import the above CheckStyle configuration file. Activate it.
3. Click on the settings wheel (next to the scheme chooser), then click "Import Scheme" and choose "IntelliJ Code Style xml". Select the IntelliJ configuration file `config/IntelliJ Code Style.xml`. Click OK.
4. Go to File -> Settings -> Checkstyle and import the CheckStyle configuration file. Activate it.
6. Use the provided run configuration: Run -> Run "JabRef Main"

### Set-up Eclipse
Expand Down
16 changes: 11 additions & 5 deletions src/main/java/org/jabref/logic/cleanup/RelativePathsCleanup.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ public List<FieldChange> cleanup(BibEntry entry) {

for (LinkedFile fileEntry : fileList) {
String oldFileName = fileEntry.getLink();
String newFileName = FileUtil
.relativize(Paths.get(oldFileName), databaseContext.getFileDirectoriesAsPaths(filePreferences))
.toString();

String newFileName = null;
if (fileEntry.isOnlineLink()) {
// keep online link untouched
newFileName = oldFileName;
}
else {
// only try to transform local file path to relative one
newFileName = FileUtil
.relativize(Paths.get(oldFileName), databaseContext.getFileDirectoriesAsPaths(filePreferences))
.toString();
}
LinkedFile newFileEntry = fileEntry;
if (!oldFileName.equals(newFileName)) {
newFileEntry = new LinkedFile(fileEntry.getDescription(), newFileName, fileEntry.getFileType());
Expand All @@ -56,5 +63,4 @@ public List<FieldChange> cleanup(BibEntry entry) {

return Collections.emptyList();
}

}
5 changes: 3 additions & 2 deletions src/main/java/org/jabref/model/entry/LinkedFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,10 +135,11 @@ private void readObject(ObjectInputStream in) throws IOException {
/**
* Checks if the given String is an online link
* @param toCheck The String to check
* @return True if it starts with http://, https:// or contains www; false otherwise
* @return <code>true</code>, if it starts with "http://", "https://" or contains "www."; <code>false</code> otherwise
*/
private boolean isOnlineLink(String toCheck) {
return toCheck.startsWith("http://") || toCheck.startsWith("https://") || toCheck.contains("www.");
String normalizedFilePath = toCheck.trim().toLowerCase();
return normalizedFilePath.startsWith("http://") || normalizedFilePath.startsWith("https://") || normalizedFilePath.contains("www.");
}

@Override
Expand Down

0 comments on commit 7a2f0ef

Please sign in to comment.