-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat: support open reference at google scholar #13153
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: support open reference at google scholar #13153
Conversation
@@ -37,6 +37,7 @@ public enum StandardActions implements Action { | |||
EXTRACT_FILE_REFERENCES_OFFLINE(Localization.lang("Extract references from file (offline)"), IconTheme.JabRefIcons.FILE_STAR), | |||
OPEN_URL(Localization.lang("Open URL or DOI"), IconTheme.JabRefIcons.WWW, KeyBinding.OPEN_URL_OR_DOI), | |||
SEARCH_SHORTSCIENCE(Localization.lang("Search ShortScience")), | |||
SEARCH_GOOGLE_SCHOLAR(Localization.lang("Search Google Scholar")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new action 'SEARCH_GOOGLE_SCHOLAR' uses title case for its label. According to the guidelines, all labels and texts should be in sentence case.
@@ -102,6 +102,7 @@ public static ContextMenu create(BibEntryTableViewModel entry, | |||
|
|||
factory.createMenuItem(StandardActions.OPEN_URL, new OpenUrlAction(dialogService, stateManager, preferences)), | |||
factory.createMenuItem(StandardActions.SEARCH_SHORTSCIENCE, new SearchShortScienceAction(dialogService, stateManager, preferences)), | |||
factory.createMenuItem(StandardActions.SEARCH_GOOGLE_SCHOLAR, new SearchGoogleScholarAction(dialogService, stateManager, preferences)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request title should contain a short title of the issue fixed or what the PR addresses, not just 'Fix issue xyz'. This ensures clarity and context for the changes made.
final List<BibEntry> bibEntries = stateManager.getSelectedEntries(); | ||
|
||
if (bibEntries.size() != 1) { | ||
dialogService.notify(Localization.lang("This operation requires exactly one item to be selected.")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The notification message should be in sentence case, not title case, to maintain consistency with other user interface text.
uriBuilder = new URIBuilder(GOOGLE_SCHOLAR_SEARCH_URL); | ||
} catch (URISyntaxException e) { | ||
// This should never be able to happen as it would require the field to be misconfigured. | ||
throw new AssertionError("Google Scholar URL is invalid.", e); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using exceptions for control flow is not recommended. The code should handle the exception in a way that doesn't rely on throwing an AssertionError for expected conditions.
Your code currently does not meet JabRef's code guidelines. We use Checkstyle to identify issues. You can see which checks are failing by locating the box "Some checks were not successful" on the pull request page. To see the test output, locate "Tests / Checkstyle (pull_request)" and click on it. In case of issues with the import order, double check that you activated Auto Import. You can trigger fixing imports by pressing Ctrl+Alt+O to trigger Optimize Imports. Please carefully follow the setup guide for the codestyle. Afterwards, please run checkstyle locally and fix the issues, commit, and push. |
Note that your PR will not be reviewed/accepted until you have gone through the mandatory checks in the description and marked each of them them exactly in the format of |
Update following are wrong comments; the feature is about opening using the web browser
|
Summary of Changes
This PR adds a new "Search Google Scholar" feature to JabRef, similar to the existing "Search ShortScience" functionality. The feature allows users to quickly search for a selected entry's title in Google Scholar directly from the main table's context menu. Addresses feature in #12268.
Changes:
The feature is enabled when a single entry with a title field is selected. Clicking the menu item opens the default browser with a Google Scholar search for the entry's title.
Collaborators
@lydia-yan @yoasaaa @brandon-lau0 @FlyJoanne
Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if change is visible to the user)