Skip to content

Commit

Permalink
Merge pull request #6 from JabRef/main
Browse files Browse the repository at this point in the history
updates
  • Loading branch information
arfazhxss authored Oct 16, 2024
2 parents 931d7df + c32298e commit 1fbe626
Show file tree
Hide file tree
Showing 22 changed files with 268 additions and 61 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: On labeled
name: On labeled issue

on:
issues:
types:
- labeled
pull_request_target:
types:
- labeled

jobs:
FirstTimeCodeContribution:
Expand All @@ -28,17 +25,21 @@ jobs:
Having any questions or issues? Feel free to ask here on GitHub. Need help setting up your local workspace? Join the conversation on [JabRef's Gitter chat](https://gitter.im/JabRef/jabref). And don't hesitate to open a (draft) pull request early on to show the direction it is heading towards. This way, you will receive valuable feedback.
⚠ Note that this issue will become unassigned if it isn't closed within **30 days**.
🔧 A maintainer can also add the **`Pinned`** label to prevent it from being unassigned automatically.
Happy coding! 🚀
- name: Move Issue to "Assigned" Column in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues@v1.0.9
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
target-labels: "FirstTimeCodeContribution"
target-column: "Assigned"
ignored-columns: ""
- name: Move Issue to "Assigned" Column in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues@v1.0.9
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
Expand All @@ -53,15 +54,15 @@ jobs:
issues: write
steps:
- name: Move Issue to "Assigned" Column in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues@v1.0.9
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
target-labels: "📍 Assigned"
target-column: "Assigned"
ignored-columns: ""
- name: Move Issue to "Assigned" Column in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues@v1.0.9
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/on-labeled-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: On labeled PR

on:
pull_request:
types:
- labeled

jobs:
automerge:
name: Auto Merge
if: "${{ github.event.label.name == 'automerge' }}"
runs-on: ubuntu-latest
steps:
- name: Approve PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN_JABREF_MACHINE_PR_APPROVE}}
- name: Merge PR
run: gh pr merge --auto --squash "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GH_TOKEN_UPDATE_GRADLE_WRAPPER}}
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
name: On unlabeled
name: On unlabeled issue

on:
issues:
types:
- unlabeled
pull_request_target:
types:
- unlabeled

jobs:
FirstTimeCodeContribution_or_Assigned:
Expand All @@ -16,7 +13,7 @@ jobs:
issues: write
steps:
- name: Move Issue to "Free to take" Column in "Candidates for University Projects"
uses: m7kvqbe1/github-action-move-issues@feat/default-column-label-remove
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/3"
Expand All @@ -25,7 +22,7 @@ jobs:
ignored-columns: ""
default-column: "Free to take"
- name: Move Issue to "Free to take" Column in "Good First Issues"
uses: m7kvqbe1/github-action-move-issues@feat/default-column-label-remove
uses: m7kvqbe1/github-action-move-issues@v1.1.1
with:
github-token: ${{ secrets.GH_TOKEN_ACTION_MOVE_ISSUE }}
project-url: "https://github.com/orgs/JabRef/projects/5"
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We added a different background color to the search bar to indicate when the search syntax is wrong. [#11658](https://github.com/JabRef/jabref/pull/11658)
- We added a setting which always adds the literal "Cited on pages" text before each JStyle citation. [#11691](https://github.com/JabRef/jabref/pull/11732)
- We added a new plain citation parser that uses LLMs. [#11825](https://github.com/JabRef/jabref/issues/11825)
- We added a compare button to the duplicates in the citation relations tab to open the "Possible duplicate entries" window. [#11192](https://github.com/JabRef/jabref/issues/11192)
- 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 the linked entry. [#11955](https://github.com/JabRef/jabref/pull/11955)
Expand All @@ -52,6 +53,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- ⚠️ Renamed command line parameters `embeddBibfileInPdf` to `embedBibFileInPdf`, `writeMetadatatoPdf` to `writeMetadataToPdf`, and `writeXMPtoPdf` to `writeXmpToPdf`. [#11575](https://github.com/JabRef/jabref/pull/11575)
- The browse button for a Custom theme now opens in the directory of the current used CSS file. [#11597](https://github.com/JabRef/jabref/pull/11597)
- The browse button for a Custom exporter now opens in the directory of the current used exporter file. [#11717](https://github.com/JabRef/jabref/pull/11717)
- ⚠️ We relaxed the escaping requirements for [bracketed patterns](https://docs.jabref.org/setup/citationkeypatterns), which are used for the [citaton key generator](https://docs.jabref.org/advanced/entryeditor#autogenerate-citation-key) and [filename and directory patterns](https://docs.jabref.org/finding-sorting-and-cleaning-entries/filelinks#auto-linking-files). One only needs to write `\"` if a quote sign should be escaped. All other escapings are not necessary (and working) any more. [#11967](https://github.com/JabRef/jabref/pull/11967)
- JabRef now uses TLS 1.2 for all HTTPS connections. [#11852](https://github.com/JabRef/jabref/pull/11852)
- We improved the display of long messages in the integrity check dialog. [#11619](https://github.com/JabRef/jabref/pull/11619)
- We improved the undo/redo buttons in the main toolbar and main menu to be disabled when there is nothing to undo/redo. [#8807](https://github.com/JabRef/jabref/issues/8807)
Expand Down Expand Up @@ -89,6 +91,7 @@ Note that this project **does not** adhere to [Semantic Versioning](https://semv
- We fixed an issue where unescaped braces in the arXiv fetcher were not treated. [#11704](https://github.com/JabRef/jabref/issues/11704)
- We fixed an issue where HTML instead of the fulltext pdf was downloaded when importing arXiv entries. [#4913](https://github.com/JabRef/jabref/issues/4913)
- We fixed an issue where the keywords and crossref fields were not properly focused. [#11177](https://github.com/JabRef/jabref/issues/11177)
- We fixed handling of `\"` in [bracketed patterns](https://docs.jabref.org/setup/citationkeypatterns) containing a RegEx. [#11967](https://github.com/JabRef/jabref/pull/11967)
- We fixed an issue where the Undo/Redo buttons were active even when all libraries are closed. [#11837](https://github.com/JabRef/jabref/issues/11837)
- We fixed an issue where recently opened files were not displayed in the main menu properly. [#9042](https://github.com/JabRef/jabref/issues/9042)
- We fixed an issue where the DOI lookup would show an error when a DOI was found for an entry. [#11850](https://github.com/JabRef/jabref/issues/11850)
Expand Down
18 changes: 10 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ Check out the [documentation for developers](https://devdocs.jabref.org/contribu

For improving developer's documentation, go on at the [docs/ subdirectory of JabRef's code](https://github.com/JabRef/jabref/tree/main/docs) and edit the file.
GitHub offers a good guide at [Editing files in another user's repository](https://help.github.com/en/github/managing-files-in-a-repository/editing-files-in-another-users-repository).

One can also add [callouts](https://just-the-docs.github.io/just-the-docs-tests/components/callouts/).

## Getting a task assigned
Expand All @@ -63,20 +62,23 @@ GitHub will then automatically assign you.

## Pull Request Process

1. **Create a new branch** (such as `fix-for-issue-121`). Be sure to create a **separate branch** for each improvement you implement.
2. Work on the **new branch — not the `main` branch.** Refer to our [code how-tos](https://devdocs.jabref.org/code-howtos) if you have questions about your implementation.
3. Create a pull request. For an overview of pull requests, take a look at GitHub's [pull request help documentation](https://help.github.com/articles/about-pull-requests/).
1. Follow the steps at [Pre Condition 3: Code on the local machine](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/pre-03-code.html) to a) create a fork and b) have the fork checked out on your local machine
2. Ensure that you followed the [steps to set up a local workspace](https://devdocs.jabref.org/getting-into-the-code/guidelines-for-setting-up-a-local-workspace/) to have the code running properly in IntelliJ.
3. **Create a new branch** (such as `fix-for-issue-121`). Be sure to create a **separate branch** for each improvement you implement.
4. Work on the **new branch — not the `main` branch.** Refer to our [code how-tos](https://devdocs.jabref.org/code-howtos) if you have questions about your implementation.
5. Create a [pull request to JabRef main repository](https://github.com/JabRef/jabref/pulls).
For an overview on the concept of pull requests, take a look at GitHub's [pull request help documentation](https://help.github.com/articles/about-pull-requests/).
1. Ensure that you followed the requirements listed below. They are not too hard, they merely support the maintainers to focus on supportive feedback than just stating the obvious.
2. For text inspirations, consider [How to write the perfect pull request](https://github.com/blog/1943-how-to-write-the-perfect-pull-request).
3. In case your pull request is not yet complete or not yet ready for review, create a [draft pull request](https://github.blog/2019-02-14-introducing-draft-pull-requests/) instead.
4. Wait for feedback of the developers
5. Address the feedback of the developers
6. After two developers gave their green flag, the pull request will be merged.
6. Wait for feedback of the developers
7. Address the feedback of the developers
8. After two developers gave their green flag, the pull request will be merged.

In case you have any questions, please

1. comment on the issue,
2. show up in our [gitter chat](https://gitter.im/JabRef/jabref), or
2. show up in our [Gitter chat](https://gitter.im/JabRef/jabref), or
3. show your current code using a draft pull request and ask questions.

We favor looking into your code using a draft pull request, because we can then also load the code into our IDE.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ If that does not exist, just select JDK 21.
![Gradle JVM is project SDK](guidelines-intellij-settings-gradle-gradlejvm-is-projectjvm.png)
{% endfigure %}

## Enable compiliation by IntelliJ
## Enable compilation by IntelliJ

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

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/jabref/Launcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import java.util.List;

import org.jabref.cli.JabRefCli;
import org.jabref.cli.JabKit;
import org.jabref.gui.JabRefGUI;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.preferences.JabRefGuiPreferences;
Expand All @@ -23,7 +23,7 @@
public class Launcher {

public static void main(String[] args) {
JabRefCli.initLogging(args);
JabKit.initLogging(args);

// Initialize preferences
final JabRefGuiPreferences preferences = JabRefGuiPreferences.getInstance();
Expand All @@ -33,7 +33,7 @@ public static void main(String[] args) {
DefaultFileUpdateMonitor fileUpdateMonitor = new DefaultFileUpdateMonitor();
HeadlessExecutorService.INSTANCE.executeInterruptableTask(fileUpdateMonitor, "FileUpdateMonitor");

List<UiCommand> uiCommands = JabRefCli.processArguments(args, preferences, fileUpdateMonitor);
List<UiCommand> uiCommands = JabKit.processArguments(args, preferences, fileUpdateMonitor);
// The method `processArguments` quites the whole JVM if no GUI is needed.

PreferencesMigrations.runMigrations(preferences);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@
import org.slf4j.bridge.SLF4JBridgeHandler;
import org.tinylog.configuration.Configuration;

/**
* Entrypoint for a command-line only version of JabRef.
*
* Does not do any preference migrations
*/
public class JabRefCli {
/// Entrypoint for a command-line only version of JabRef.
/// It does not open any dialogs, just parses the command line arguments and outputs text and creates/modifies files.
///
/// See [Command Line Interface Guidelines](https://clig.dev/) for general guidelines how to design a good CLI interface.
///
/// It does not open any GUI.
/// For the GUI application see {@link org.jabref.Launcher}.
///
/// Does not do any preference migrations.
public class JabKit {
private static Logger LOGGER;

public static void main(String[] args) {
Expand Down Expand Up @@ -144,7 +148,7 @@ public static void initLogging(String[] args) {
try {
Files.createDirectories(directory);
} catch (IOException e) {
LOGGER = LoggerFactory.getLogger(JabRefCli.class);
LOGGER = LoggerFactory.getLogger(JabKit.class);
LOGGER.error("Could not create log directory {}", directory, e);
return;
}
Expand All @@ -162,7 +166,7 @@ public static void initLogging(String[] args) {
"writerFile.backups", "30");
configuration.forEach(Configuration::set);

LOGGER = LoggerFactory.getLogger(JabRefCli.class);
LOGGER = LoggerFactory.getLogger(JabKit.class);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.net.URI;
import java.util.Arrays;
import java.util.List;
import java.util.Optional;

import javax.swing.undo.UndoManager;

Expand Down Expand Up @@ -39,7 +40,12 @@
import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.CitationFetcher;
import org.jabref.gui.entryeditor.citationrelationtab.semanticscholar.SemanticScholarFetcher;
import org.jabref.gui.icon.IconTheme;
import org.jabref.gui.mergeentries.EntriesMergeResult;
import org.jabref.gui.mergeentries.MergeEntriesDialog;
import org.jabref.gui.preferences.GuiPreferences;
import org.jabref.gui.undo.NamedCompound;
import org.jabref.gui.undo.UndoableInsertEntries;
import org.jabref.gui.undo.UndoableRemoveEntries;
import org.jabref.gui.util.NoSelectionModel;
import org.jabref.gui.util.ViewModelListCellFactory;
import org.jabref.logic.bibtex.BibEntryWriter;
Expand All @@ -51,6 +57,7 @@
import org.jabref.logic.os.OS;
import org.jabref.logic.util.BackgroundTask;
import org.jabref.logic.util.TaskExecutor;
import org.jabref.model.database.BibDatabase;
import org.jabref.model.database.BibDatabaseContext;
import org.jabref.model.database.BibDatabaseMode;
import org.jabref.model.database.BibDatabaseModeDetection;
Expand Down Expand Up @@ -89,6 +96,8 @@ public class CitationRelationsTab extends EntryEditorTab {
private final CitationsRelationsTabViewModel citationsRelationsTabViewModel;
private final DuplicateCheck duplicateCheck;
private final BibEntryTypesManager entryTypesManager;
private final StateManager stateManager;
private final UndoManager undoManager;

public CitationRelationsTab(DialogService dialogService,
BibDatabaseContext databaseContext,
Expand All @@ -104,6 +113,8 @@ public CitationRelationsTab(DialogService dialogService,
this.preferences = preferences;
this.libraryTab = libraryTab;
this.taskExecutor = taskExecutor;
this.undoManager = undoManager;
this.stateManager = stateManager;
setText(Localization.lang("Citation relations"));
setTooltip(new Tooltip(Localization.lang("Show articles related by citation")));

Expand Down Expand Up @@ -238,6 +249,13 @@ private void styleFetchedListView(CheckListView<CitationRelationItem> listView)
}
});
vContainer.getChildren().add(jumpTo);

Button compareButton = IconTheme.JabRefIcons.MERGE_ENTRIES.asButton();
compareButton.setTooltip(new Tooltip(Localization.lang("Compare with existing entry")));
compareButton.setOnMouseClicked(event -> {
openPossibleDuplicateEntriesWindow(entry, listView);
});
vContainer.getChildren().add(compareButton);
} else {
ToggleButton addToggle = IconTheme.JabRefIcons.ADD.asToggleButton();
addToggle.setTooltip(new Tooltip(Localization.lang("Select entry")));
Expand Down Expand Up @@ -511,4 +529,43 @@ private void importEntries(List<CitationRelationItem> entriesToImport, CitationF

dialogService.notify(Localization.lang("Number of entries successfully imported") + ": " + entriesToImport.size());
}

/**
* Function to open possible duplicate entries window to compare duplicate entries
*
* @param citationRelationItem duplicate in the citation relations tab
* @param listView CheckListView to display citations
*/
private void openPossibleDuplicateEntriesWindow(CitationRelationItem citationRelationItem, CheckListView<CitationRelationItem> listView) {
BibEntry libraryEntry = citationRelationItem.localEntry();
BibEntry citationEntry = citationRelationItem.entry();
String leftHeader = Localization.lang("Library Entry");
String rightHeader = Localization.lang("Citation Entry");

MergeEntriesDialog dialog = new MergeEntriesDialog(libraryEntry, citationEntry, leftHeader, rightHeader, preferences);
dialog.setTitle(Localization.lang("Possible duplicate entries"));

Optional<EntriesMergeResult> entriesMergeResult = dialogService.showCustomDialogAndWait(dialog);
entriesMergeResult.ifPresentOrElse(mergeResult -> {

BibEntry mergedEntry = mergeResult.mergedEntry();
// update local entry of selected citation relation item
listView.getItems().set(listView.getItems().indexOf(citationRelationItem), new CitationRelationItem(citationRelationItem.entry(), mergedEntry, true));

// Merge method is similar to MergeTwoEntriesAction#execute
BibDatabase database = stateManager.getActiveDatabase().get().getDatabase();
database.removeEntry(mergeResult.originalLeftEntry());
libraryTab.getMainTable().setCitationMergeMode(true);
database.insertEntry(mergedEntry);

NamedCompound ce = new NamedCompound(Localization.lang("Merge entries"));
ce.addEdit(new UndoableRemoveEntries(database, mergeResult.originalLeftEntry()));
ce.addEdit(new UndoableInsertEntries(stateManager.getActiveDatabase().get().getDatabase(), mergedEntry));
ce.end();

undoManager.addEdit(ce);

dialogService.notify(Localization.lang("Merged entries"));
}, () -> dialogService.notify(Localization.lang("Canceled merging entries")));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ private void importCites(List<BibEntry> entries, BibEntry existingEntry, ImportH

List<String> citeKeys = getExistingEntriesFromCiteField(existingEntry);
citeKeys.removeIf(String::isEmpty);

for (BibEntry entryToCite : entries) {
if (generateNewKeyOnImport || entryToCite.getCitationKey().isEmpty()) {
String key = generator.generateKey(entryToCite);
Expand Down
Loading

0 comments on commit 1fbe626

Please sign in to comment.