Skip to content

Commit

Permalink
Merge branch 'main' into fix-lucene-query
Browse files Browse the repository at this point in the history
  • Loading branch information
LoayGhreeb committed Oct 27, 2024
2 parents 4d437c1 + e9a6c5a commit 4cc2f5d
Show file tree
Hide file tree
Showing 55 changed files with 312 additions and 48 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Link the issue that will be closed, e.g., "Closes #333". If your PR closes a kop
-->

- [x] I own the copyright of the code submitted and I licence it under the [MIT license](https://github.com/JabRef/jabref/blob/main/LICENSE)
- [ ] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if applicable)
- [ ] Change in `CHANGELOG.md` described in a way that is understandable for the average user (if change is visible to the user)
- [ ] Tests created for changes (if applicable)
- [ ] Manually tested changed features in running JabRef (always required)
- [ ] Screenshots added in PR description (for UI changes)
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/assign-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
assign:
if: github.repository_owner == 'JabRef'
runs-on: ubuntu-latest
permissions:
issues: write
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/check-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ concurrency:

jobs:
lychee:
if: github.repository_owner == 'JabRef'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/cleanup-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:

jobs:
cleanup:
if: github.repository_owner == 'JabRef'
runs-on: ubuntu-latest
steps:
- name: Cancel deployment run
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deployment-arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ concurrency:

jobs:
build:
if: github.repository_owner == 'JabRef'
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/deployment-jdk-ea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ concurrency:

jobs:
build:
if: github.repository_owner == 'JabRef'
strategy:
fail-fast: false
matrix:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/gource.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ concurrency:

jobs:
action:
if: github.repository_owner == 'JabRef'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
Expand Down
42 changes: 35 additions & 7 deletions .github/workflows/on-labeled-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,36 @@ on:
- labeled

jobs:
Assigned:
# Triggered when manually assigned the label "📍 Assigned" to trigger the automatic unassignment after 30 days
name: "📍 Assigned"
if: ${{ github.event.label.name == '📍 Assigned' && github.repository_owner == 'JabRef' }}
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Move Issue to "Free to take" Column in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues@feat/skip-if-not-in-project-flag
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
target-labels: "📍 Assigned"
target-column: "Free to take"
ignored-columns: ""
default-column: "Free to take"
skip-if-not-in-project: true
- name: Move Issue to "Free to take" Column in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues@feat/skip-if-not-in-project-flag
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
target-labels: "📍 Assigned"
target-column: "Free to take"
ignored-columns: ""
default-column: "Free to take"
skip-if-not-in-project: true
FirstTimeCodeContribution:
if: ${{ github.event.label.name == 'FirstTimeCodeContribution' }}
if: ${{ github.event.label.name == 'FirstTimeCodeContribution' && github.repository_owner == 'JabRef' }}
runs-on: ubuntu-latest
permissions:
issues: write
Expand Down Expand Up @@ -35,7 +63,7 @@ jobs:
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
target-labels: "📍 Assigned"
target-labels: "FirstTimeCodeContribution"
target-column: "Assigned"
ignored-columns: ""
default-column: "Free to take"
Expand All @@ -45,14 +73,14 @@ jobs:
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
target-labels: "📍 Assigned"
target-labels: "FirstTimeCodeContribution"
target-column: "Assigned"
ignored-columns: ""
default-column: "Free to take"
skip-if-not-in-project: true
good-first-issue:
name: "good first issue"
if: "${{ github.event.label.name == 'good first issue' }}"
if: "${{ github.event.label.name == 'good first issue' && github.repository_owner == 'JabRef' }}"
runs-on: ubuntu-latest
steps:
- name: "good first issue"
Expand All @@ -62,7 +90,7 @@ jobs:
ISSUE_URL=$(jq --raw-output .issue.html_url "$GITHUB_EVENT_PATH")
gh project item-add 5 --owner JabRef --url $ISSUE_URL
needs-refinement:
if: github.event.label.name == 'needs-refinement'
if: github.event.label.name == 'needs-refinement' && github.repository_owner == 'JabRef'
runs-on: ubuntu-latest
steps:
- name: needs-refinement
Expand All @@ -73,7 +101,7 @@ jobs:
gh project item-add 15 --owner JabRef --url $ISSUE_URL
status-freeze:
name: "status: freeze"
if: "${{ github.event.label.name == 'status: freeze' }}"
if: "${{ github.event.label.name == 'status: freeze' && github.repository_owner == 'JabRef' }}"
runs-on: ubuntu-latest
steps:
- name: "status: freeze"
Expand All @@ -83,7 +111,7 @@ jobs:
ISSUE_URL=$(jq --raw-output .issue.html_url "$GITHUB_EVENT_PATH")
gh project item-add 9 --owner JabRef --url $ISSUE_URL
ui:
if: "${{ github.event.label.name == 'ui' }}"
if: "${{ github.event.label.name == 'ui' && github.repository_owner == 'JabRef' }}"
runs-on: ubuntu-latest
steps:
- name: ui
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-labeled-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
jobs:
automerge:
name: Auto Merge
if: "${{ github.event.label.name == 'automerge' }}"
if: "${{ github.event.label.name == 'automerge' && github.repository_owner == 'JabRef' }}"
runs-on: ubuntu-latest
steps:
- name: Approve PR
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/on-unlabeled-issue.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
FirstTimeCodeContribution_or_Assigned:
if: ${{ (github.event.label.name == 'FirstTimeCodeContribution') || (github.event.label.name == '📍 Assigned') }}
if: ${{ ((github.event.label.name == 'FirstTimeCodeContribution') || (github.event.label.name == '📍 Assigned')) && github.repository_owner == 'JabRef' }}
runs-on: ubuntu-latest
permissions:
issues: write
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ on:
jobs:
comment:
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
if: ${{ github.event.workflow_run.conclusion == 'failure' && (github.repository_owner == 'JabRef') }}
runs-on: ubuntu-latest
permissions:
actions: read
Expand All @@ -37,22 +37,23 @@ jobs:
- uses: actions/checkout@v4
- name: Determine owner
if: ${{ steps.read-pr_number.outputs.pr_number != '' }}
id: owner
id: isCrossRepository
run: |
owner=$(gh pr view $pr_number --json headRepositoryOwner --jq '.headRepositoryOwner')
echo "Got owner $owner"
echo owner=$owner >> $GITHUB_OUTPUT
isCrossRepository=$(gh pr view $pr_number --json isCrossRepository --jq '.isCrossRepository')
echo "Got isCrossRepository $isCrossRepository"
echo isCrossRepository=$isCrossRepository >> $GITHUB_OUTPUT
env:
GH_TOKEN: ${{ github.token }}
pr_number: ${{ steps.read-pr_number.outputs.pr_number }}
- name: Checkout
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }}
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.isCrossRepository.isCrossRepository == 'true') }}
uses: actions/checkout@v4
with:
fetch-depth: '0'
show-progress: 'false'
token: ${{ secrets.GITHUB_TOKEN }}
- name: jbang
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.owner.owner != 'JabRef') }}
if: ${{ (steps.read-pr_number.outputs.pr_number != '') && (steps.isCrossRepository.isCrossRepository == 'true') }}
uses: jbangdev/[email protected]
with:
script: ghprcomment@koppor/ghprcomment
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-gradle-wrapper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:

jobs:
update-gradle-wrapper:
if: github.repository_owner == 'JabRef'
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added automatic browser extension install on Windows for Chrome and Edge. [#6076](https://github.com/JabRef/jabref/issues/6076)
- We added a search bar for filtering keyboard shortcuts. [#11686](https://github.com/JabRef/jabref/issues/11686)
- By double clicking on a local citation in the Citation Relations Tab you can now jump the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955)
- We use the menu icon for background tasks as a progress indicator to visualise an import's progress when dragging and dropping several PDF files into the main table. [#12072](https://github.com/JabRef/jabref/pull/12072)

### Changed

Expand Down Expand Up @@ -104,6 +105,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where it was not possible to select selecting content of other user's comments.[#11106](https://github.com/JabRef/jabref/issues/11106)
- We fixed an issue where web search preferences "Custom API key" table modifications not discarded. [#11925](https://github.com/JabRef/jabref/issues/11925)
- We fixed an issue where trying to open a library from a failed mounted directory on Mac would cause an error. [#10548](https://github.com/JabRef/jabref/issues/10548)
- We fixed an issue where identifier paste couldn't work with Unicode REPLACEMENT CHARACTER. [#11986](https://github.com/JabRef/jabref/issues/11986)

### Removed

Expand Down
18 changes: 12 additions & 6 deletions src/main/java/org/jabref/gui/externalfiles/ImportHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ public BackgroundTask<List<ImportFilesResultItemViewModel>> importFilesInBackgro
return new BackgroundTask<>() {
private int counter;
private final List<ImportFilesResultItemViewModel> results = new ArrayList<>();
private final List<BibEntry> allEntriesToAdd = new ArrayList<>();

@Override
public List<ImportFilesResultItemViewModel> call() {
Expand All @@ -115,8 +116,13 @@ public List<ImportFilesResultItemViewModel> call() {
}

UiTaskExecutor.runInJavaFXThread(() -> {
updateMessage(Localization.lang("Processing file %0", file.getFileName()));
updateProgress(counter, files.size() - 1d);
setTitle(Localization.lang("Importing files into %1 | %2 of %0 file(s) processed.",
files.size(),
bibDatabaseContext.getDatabasePath().map(path -> path.getFileName().toString()).orElse(Localization.lang("untitled")),
counter));
updateMessage(Localization.lang("Processing %0", FileUtil.shortenFileName(file.getFileName().toString(), 68)));
updateProgress(counter, files.size());
showToUser(true);
});

try {
Expand Down Expand Up @@ -168,10 +174,7 @@ public List<ImportFilesResultItemViewModel> call() {

UiTaskExecutor.runInJavaFXThread(() -> updateMessage(Localization.lang("Error")));
}

// We need to run the actual import on the FX Thread, otherwise we will get some deadlocks with the UIThreadList
// That method does a clone() on each entry
UiTaskExecutor.runInJavaFXThread(() -> importEntries(entriesToAdd));
allEntriesToAdd.addAll(entriesToAdd);

ce.addEdit(new UndoableInsertEntries(bibDatabaseContext.getDatabase(), entriesToAdd));
ce.end();
Expand All @@ -180,6 +183,9 @@ public List<ImportFilesResultItemViewModel> call() {

counter++;
}
// We need to run the actual import on the FX Thread, otherwise we will get some deadlocks with the UIThreadList
// That method does a clone() on each entry
UiTaskExecutor.runInJavaFXThread(() -> importEntries(allEntriesToAdd));
return results;
}

Expand Down
1 change: 1 addition & 0 deletions src/main/java/org/jabref/gui/icon/IconTheme.java
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,7 @@ public enum JabRefIcons implements JabRefIcon {
APPLICATION_SUBLIMETEXT(JabRefMaterialDesignIcon.SUBLIME_TEXT),
APPLICATION_TEXSHOP(JabRefMaterialDesignIcon.TEXSHOP),
APPLICATION_TEXWORS(JabRefMaterialDesignIcon.TEXWORKS),
APPLICATION_VSCODE(JabRefMaterialDesignIcon.VSCODE),
KEY_BINDINGS(MaterialDesignK.KEYBOARD),
FIND_DUPLICATES(MaterialDesignC.CODE_EQUAL),
CONNECT_DB(MaterialDesignC.CLOUD_UPLOAD),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* This resize policy is almost the same as {@link TableView#CONSTRAINED_RESIZE_POLICY}
* We make sure that the width of all columns sums up to the total width of the table.
* However, in contrast to {@link TableView#CONSTRAINED_RESIZE_POLICY} we size the columns initially by their preferred width.
* Although {@link TableView#CONSTRAINED_RESIZE_POLICY} is deprecated, this policy maintains a similar resizing behavior.
*/
public class SmartConstrainedResizePolicy implements Callback<TableView.ResizeFeatures, Boolean> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ public class JabRefGuiPreferences extends JabRefCliPreferences implements GuiPre
private static final String PUSH_VIM_SERVER = "vimServer";
private static final String PUSH_VIM = "vim";
private static final String PUSH_SUBLIME_TEXT_PATH = "sublimeTextPath";
private static final String PUSH_VSCODE_PATH = "VScodePath";
// endregion

// region NameDisplayPreferences
Expand Down Expand Up @@ -360,6 +361,7 @@ private JabRefGuiPreferences() {
defaults.put(PUSH_VIM, "vim");
defaults.put(PUSH_VIM_SERVER, "vim");
defaults.put(PUSH_EMACS_ADDITIONAL_PARAMETERS, "-n -e");
defaults.put(PUSH_VSCODE_PATH, OS.detectProgramPath("Code", "Microsoft VS Code"));

if (OS.OS_X) {
defaults.put(PUSH_EMACS_PATH, "emacsclient");
Expand Down Expand Up @@ -937,6 +939,7 @@ public PushToApplicationPreferences getPushToApplicationPreferences() {
applicationCommands.put(PushToApplications.VIM, getEmptyIsDefault(PUSH_VIM));
applicationCommands.put(PushToApplications.WIN_EDT, getEmptyIsDefault(PUSH_WINEDT_PATH));
applicationCommands.put(PushToApplications.SUBLIME_TEXT, getEmptyIsDefault(PUSH_SUBLIME_TEXT_PATH));
applicationCommands.put(PushToApplications.VSCODE, getEmptyIsDefault(PUSH_VSCODE_PATH));

pushToApplicationPreferences = new PushToApplicationPreferences(
get(PUSH_TO_APPLICATION),
Expand Down Expand Up @@ -971,6 +974,8 @@ private void storePushToApplicationPath(Map<String, String> commandPair) {
put(PUSH_WINEDT_PATH, value);
case PushToApplications.SUBLIME_TEXT ->
put(PUSH_SUBLIME_TEXT_PATH, value);
case PushToApplications.VSCODE ->
put(PUSH_VSCODE_PATH, value);
}
});
}
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/jabref/gui/push/PushToApplications.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public class PushToApplications {
public static final String WIN_EDT = "WinEdt";
public static final String SUBLIME_TEXT = "Sublime Text";
public static final String TEXSHOP = "TeXShop";
public static final String VSCODE = "VScode";

private static final List<PushToApplication> APPLICATIONS = new ArrayList<>();

Expand All @@ -38,7 +39,8 @@ public static List<PushToApplication> getAllApplications(DialogService dialogSer
new PushToTeXworks(dialogService, preferences),
new PushToVim(dialogService, preferences),
new PushToWinEdt(dialogService, preferences),
new PushToTexShop(dialogService, preferences)));
new PushToTexShop(dialogService, preferences),
new PushToVScode(dialogService, preferences)));

return APPLICATIONS;
}
Expand Down
38 changes: 38 additions & 0 deletions src/main/java/org/jabref/gui/push/PushToVScode.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.jabref.gui.push;

import java.nio.file.Path;

import org.jabref.gui.DialogService;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.icon.JabRefIcon;
import org.jabref.gui.preferences.GuiPreferences;

public class PushToVScode extends AbstractPushToApplication {

public static final String NAME = PushToApplications.VSCODE;

public PushToVScode(DialogService dialogService, GuiPreferences preferences) {
super(dialogService, preferences);
}

@Override
public String getDisplayName() {
return NAME;
}

@Override
public JabRefIcon getApplicationIcon() {
return IconTheme.JabRefIcons.APPLICATION_VSCODE;
}

@Override
protected String[] getCommandLine(String keyString) {
// TODO - Implementing this will fix https://github.com/JabRef/jabref/issues/6775
return new String[] {commandPath};
}

@Override
public String[] jumpToLineCommandlineArguments(Path fileName, int line, int column) {
return new String[] {commandPath, "--g", "%s:%s:%s".formatted(fileName.toString(), line, column)};
}
}
Loading

0 comments on commit 4cc2f5d

Please sign in to comment.