-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
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 |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this commented-out code needed?
ProcessBuilder processBuilder = new ProcessBuilder(command); | ||
processBuilder.start(); | ||
} catch (IOException e) { | ||
// Use robust logging instead of printStackTrace() |
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.
Remove comment
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
@@ -154,6 +160,26 @@ public void onDirectoryDelete(File directory) { | |||
}; | |||
} | |||
|
|||
// Handle mouse click event |
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.
Remove obsolete comment - next line states the same
@@ -154,6 +160,26 @@ public void onDirectoryDelete(File directory) { | |||
}; | |||
} | |||
|
|||
// Handle mouse click event | |||
public void handleMouseClick(MouseEvent event, CitationsDisplay citationsDisplay) { | |||
// Get the currently selected item |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) {
src/main/java/org/jabref/gui/push/AbstractPushToApplication.java
Outdated
Show resolved
Hide resolved
/** | ||
* Method to open TeXstudio at the given line number in the specified LaTeX file. | ||
*/ |
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.
Remove obsolete comment - next line states the same
…ke TeXworks works for this feature
…990/jabref into feature-latex-editor#11996 Do the update.
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.
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#11996
file.
@@ -0,0 +1,21 @@ | |||
name: On reviewed PR |
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.
Why is this appearing - I removed in main
. Please remove this file from your branch.
@@ -147,4 +148,9 @@ protected String getCommandName() { | |||
public PushToApplicationSettings getSettings(PushToApplication application, PushToApplicationPreferences preferences) { | |||
return new PushToEmacsSettings(application, dialogService, this.preferences.getFilePreferences(), preferences); | |||
} | |||
|
|||
@Override | |||
protected String[] jumpString(Path fileName, int line, int column) { |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
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.
Tested with TeXsudio. Works.
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.
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
viewModel
inLatexCitationTab
is to store those entries asDoubleClickOnlyListWrapper
. The variablecitationsDisplay
is the Listener ofviewModel'. I use
citationsDisplayto catch the double click event. If it's click the right entry, I use the
PushToApplicationto call the
jumpToLine. I found the set up ways in the
PushToApplicationCommand. After the setup, the
publicJumpToLinewill be called, it use
jumpStringto get the command and use the new
processBuilder` to run the command. It should works for TeXstudio.Mandatory checks
CHANGELOG.md
described in a way that is understandable for the average user (if applicable)