Skip to content

Added tooltips to library properties window #13045

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

Closed
wants to merge 8 commits into from

Conversation

henmesh
Copy link

@henmesh henmesh commented May 2, 2025

Closes #12269
Added tooltips for the library properties window:

  • User-specific file directory displays 'User: [username], Host: [hostname]'
  • LaTeX file directory displays 'Directory for LaTeX files: [directory in use]'
  • [username] and [hostname] are retrieved via 'preferences.getFilePreferences().getUserAndHost()'
  • [directory in use] is retrieved via 'viewModel.laTexFileDirectoryProperty()'

image

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • 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 (if change is visible to the user)
  • Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@@ -69,6 +73,15 @@ public void initialize() {
userSpecificFileDirectoryValidationVisualizer.setDecoration(new IconValidationDecorator());
laTexFileDirectoryValidationVisualizer.setDecoration(new IconValidationDecorator());

String userString = preferences.getFilePreferences().getUserAndHost().replace("-" + OS.getHostName(), "");
userSpecificFileDirectoryTooltip.setText("User: " + userString + ", Host: " + OS.getHostName());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip text should be localized using Localization.lang to support multilingual capabilities, as per JabRef's localization guidelines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 79 to 82
laTexFileDirectoryTooltip.textProperty().bind(
viewModel.laTexFileDirectoryProperty().map(path ->
"Directory for LaTeX files: " + (path.isEmpty() ? "(not set)" : path)
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tooltip text should be localized using Localization.lang to support multilingual capabilities, as per JabRef's localization guidelines.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@henmesh henmesh changed the title Issue 12269 Added tooltips to library properties window May 2, 2025
Copy link
Member

@koppor koppor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Solution too dirty.

Start with rewriting

org.jabref.logic.preferences.JabRefCliPreferences#getUserAndHost

to

private UserAndHost getUserAndHost() {

and UserAndHost as new Class maybe with StringProperty / or a final string as the hostname cannot be changed AFAIK

Similar to other preferences

Adapt all other methods and settings accordingly.

@koppor koppor marked this pull request as draft May 4, 2025 05:21
henmesh added 2 commits May 10, 2025 14:22
# Conflicts:
#	jabgui/src/main/java/org/jabref/gui/libraryproperties/general/GeneralPropertiesView.java
#	jabgui/src/main/resources/org/jabref/gui/libraryproperties/general/GeneralProperties.fxml
@henmesh
Copy link
Author

henmesh commented May 10, 2025

Apologies for the numerous commit messages - I tried merging with upstream and it seems to have added all those previous commits.
But otherwise: I've made a UserAndHost class and given it methods to retrieve the username and/or host, and used the localisation function on the pop-up messages.

@@ -0,0 +1,23 @@
package org.jabref.logic.util;

public class UserAndHost {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a typical record in Java, isn't it?

<JabRefIconView fx:id="libSpecificFileDirSwitchIcon" glyph="ABSOLUTE_PATH"/>
</graphic>
<tooltip>
<Tooltip fx:id ="libSpecificFileDirSwitchTooltip" text="%Switch to absolute path: converts the path to an absolute path."/>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this removed?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems like your. merge was not proper

Copy link

trag-bot bot commented May 11, 2025

@trag-bot didn't find any issues in the code! ✅✨

@jabref-machine
Copy link
Collaborator

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 [x] (done), [ ] (not done yet) or [/] (not applicable).

@Siedlerchr Siedlerchr closed this May 29, 2025
@Siedlerchr
Copy link
Member

Closing this PR due to inactivity 💤 Please reopen the PR when you continue working on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

user-specific file directory should show user name
4 participants