Double click on citation opens LaTeX editor#12044
Conversation
|
To ease organizational workflows, I have linked the pull-request to the issue with syntax as described in https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue.
Example:
|
|
Fix #11996 |
koppor
left a comment
There was a problem hiding this comment.
Many obsolte code comments, some methods seem be left-overs from trial and error.
Please also fix sub module errors: https://devdocs.jabref.org/code-howtos/faq.html#submodules
| // private void jump(Path fileName, int line, int column) { | ||
| // BibDatabaseContext database = stateManager.getActiveDatabase().orElseThrow(() -> new NullPointerException("Database null")); | ||
| // application.publicJumpToLine(database, stateManager.getSelectedEntries(), getKeyString(stateManager.getSelectedEntries(), application.getDelimiter())); | ||
| // } |
There was a problem hiding this comment.
Is this commented-out code needed?
| ProcessBuilder processBuilder = new ProcessBuilder(command); | ||
| processBuilder.start(); | ||
| } catch (IOException e) { | ||
| // Use robust logging instead of printStackTrace() |
| // Use robust logging instead of printStackTrace() | ||
| LOGGER.error("Could not open TeXstudio at the specified location.", e); | ||
|
|
||
| // Show an error dialog to the user |
There was a problem hiding this comment.
This is clear from the line below - remove comment
| LOGGER.error("Could not open TeXstudio at the specified location.", e); | ||
|
|
||
| // Show an error dialog to the user | ||
| dialogService.showErrorDialogAndWait("Error", "Could not open TeXstudio at the specified location."); |
There was a problem hiding this comment.
Use localization. Paramterize the tool using %0. See https://devdocs.jabref.org/code-howtos/localization.html for details.
| protected void jumpToLine(Path fileName, int line, int column) { | ||
| commandPath = preferences.getPushToApplicationPreferences().getCommandPaths().get(this.getDisplayName()); | ||
|
|
||
| // Check if a path to the command has been specified |
There was a problem hiding this comment.
Please remove these kinds of comments - there are clear form the code.
| protected String[] jumpString(Path fileName, int line, int column) { | ||
| return new String[0]; | ||
| } | ||
|
|
||
| public void publicJumpToLine(Path fileName, int line, int column) { | ||
| jumpToLine(fileName, line, column); | ||
| } |
There was a problem hiding this comment.
What are these methods for? I think, they can be deleted?
|
The fetcher tests is failled. But I didn't change any code relate to the internet. How should I fix it? |
|
You can ignore the fetcher tests if you did not change the fetchers
Ricky-Du ***@***.***> schrieb am Di., 22. Okt. 2024, 08:23:
… The fetcher tests is failled. But I didn't change any code relate to the
internet. How should I fix it?
—
Reply to this email directly, view it on GitHub
<#12044 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFZB4QZIBHJ54WHXWHGTZ4XVOZAVCNFSM6AAAAABQJFOXXWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMRYGM2TOOJYHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks |
…11996 # Conflicts: # .github/workflows/on-review-submitted.yml # src/main/java/org/jabref/gui/preferences/JabRefGuiPreferences.java # src/main/java/org/jabref/logic/bibtex/InvalidFieldValueException.java # src/main/java/org/jabref/logic/preferences/JabRefCliPreferences.java
|
@u7465990 I assume you used |
| }; | ||
| } | ||
|
|
||
| // Handle mouse click event |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
|
|
||
| // Handle mouse click event | ||
| public void handleMouseClick(MouseEvent event, CitationsDisplay citationsDisplay) { | ||
| // Get the currently selected item |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
| // Get the currently selected item | ||
| Citation selectedItem = citationsDisplay.getSelectionModel().getSelectedItem(); | ||
|
|
||
| // Check if the left mouse button was double-clicked |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
|
|
||
| // Check if the left mouse button was double-clicked | ||
| if (event.getButton() == MouseButton.PRIMARY && event.getClickCount() == 2 && selectedItem != null) { | ||
| // Perform a jump or other actions |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
| /** | ||
| * This function is to jump to a specific line due to different editor. | ||
| * | ||
| */ |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
| * This function is to jump to a specific line due to different editor. | ||
| * | ||
| */ | ||
| protected void jumpToLine(Path fileName, int line, int column, ProcessBuilder processBuilder) { |
There was a problem hiding this comment.
Never overridden. Not sure why it is separated of jumpToLine(Path fileName, int line, int column). Inline it to
public void jumpToLine(Path fileName, int line, int column) {
| /** | ||
| * Method to open TeXstudio at the given line number in the specified LaTeX file. | ||
| */ |
There was a problem hiding this comment.
Remove obsolete comment - next line states the same
…ke TeXworks works for this feature
…990/jabref into feature-latex-editor#11996 Do the update.
koppor
left a comment
There was a problem hiding this comment.
Something was wrong when doing git merge upstream/main.
- Fix submodules - follow the steps at https://devdocs.jabref.org/code-howtos/faq.html#fix
feature-latex-editor#11996file.
| @@ -0,0 +1,21 @@ | |||
| name: On reviewed PR | |||
There was a problem hiding this comment.
Why is this appearing - I removed in main. Please remove this file from your branch.
| } | ||
|
|
||
| @Override | ||
| protected String[] jumpString(Path fileName, int line, int column) { |
There was a problem hiding this comment.
Rename to jumpToLineCommandlineArguments (or similar)
|
|
||
| @Override | ||
| public String[] jumpString(Path fileName, int line, int column) { | ||
| // Construct the TeXstudio command |
There was a problem hiding this comment.
Remvoe comment. It is clear from the context.
|
|
||
| @Override | ||
| protected String[] jumpString(Path fileName, int line, int column) { | ||
| // didn't find any command to jump to a specific line |
There was a problem hiding this comment.
| // didn't find any command to jump to a specific line | |
| // No command known to jump to a specific line |
Please enter the commit message for your changes. Lines starting
…I hope it's working.
There was a problem hiding this comment.
Your code currently does not meet JabRef's code guidelines.
We use OpenRewrite to ensure "modern" Java coding practices.
The issues found can be automatically fixed.
Please execute the gradle task rewriteRun, check the results, commit, and push.
You can check the detailed error output by navigating to your pull request, selecting the tab "Checks", section "Tests" (on the left), subsection "OpenRewrite".
|
I fixed merge conflicts with |
koppor
left a comment
There was a problem hiding this comment.
Works. Needed to add CHANGELOG.md entry.
|
Thanks. I plan to add the vscode as a push target. Should I open a new issue for this? |
|
Just create a new pr |
Fixes #11996
I think I make the function works. The
viewModelinLatexCitationTabis to store those entries asDoubleClickOnlyListWrapper. The variablecitationsDisplayis the Listener ofviewModel'. I usecitationsDisplayto catch the double click event. If it's click the right entry, I use thePushToApplicationto call thejumpToLine. I found the set up ways in thePushToApplicationCommand. After the setup, thepublicJumpToLinewill be called, it usejumpStringto get the command and use the newprocessBuilder` to run the command. It should works for TeXstudio.Mandatory checks
CHANGELOG.mddescribed in a way that is understandable for the average user (if applicable)