JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.47k stars 2.44k forks source link

Add description of actions #9615

Open koppor opened 1 year ago

koppor commented 1 year ago

Issue

Menu does not show the description

grafik

There should be tool tip shown

Context

Advanced hints active: grafik

The code calling the menu entry provides the content for the tool tip:

ABBREVIATE_DOTLESS(Localization.lang("dotless"), Localization.lang("Abbreviate journal names of the selected entries (DOTLESS abbreviation)")),
sreenath-tm commented 1 year ago

Hi I would like to work on this issue can you let me know how I can solve this issue.

ThiloteE commented 1 year ago

@sreenath-tm, you texted me on gitter, but gitter recently migrated to Matrix. I sent you an answer and asked you a question. Unfortunately, since you did not answer me (probably because of gitter/matrix encryption issue), i put the conversation into the archive and THEN a few days later, the archive vanished. So now I don't remember anymore what you texted me, and i don't remember what i wanted to tell you, so .... :D just letting you know.

Edit: Please text me on JabRef's Gitter chat again.

sreenath-tm commented 1 year ago

Hi @ThiloteE sure.

sreenath-tm commented 1 year ago

Are there any other items in any of the dropdown that is working as expected? I just checked out all of the items in the "Quality" dropdown list and none of them display the hints that it is expected to display. I will check for the Pull request that has added these prompts to the dropdown menus and see if I can find anything. Parallelly I will check what is going wrong in the code. Just let me know if you guys are also facing the same issue with the options

koppor commented 1 year ago

Are there any other items in any of the dropdown that is working as expected?

No. Therefore, we opened this issue.

May I ask if you continue investigating or if we shoud free this issue for others?

sreenath-tm commented 1 year ago

I had a look at the code but could not identify the root cause for this issue as all things seem to be right. Not sure for dropdowns what additional change we might need to add.

koppor commented 1 year ago

Did you try a minum example?

ChatGPT gave me following answer:

Model: GPT-4

1 / 1

In JavaFX, how can I get a tooltip of menu items?

1 / 1

In JavaFX, you can add tooltips to menu items by creating a Tooltip object and using the setTooltip() method for the MenuItem. Here's a step-by-step guide on how to achieve this:

  1. First, make sure you have imported the necessary JavaFX classes:

java

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
  1. Create a JavaFX application and set up the primary stage:

java

public class MenuItemTooltipExample extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        // Set up the primary stage and scene
        VBox root = new VBox();
        Scene scene = new Scene(root, 300, 200);
        primaryStage.setScene(scene);
        primaryStage.setTitle("Menu Item Tooltip Example");

        // Create the menu bar and menu
        MenuBar menuBar = new MenuBar();
        Menu fileMenu = new Menu("File");
        menuBar.getMenus().add(fileMenu);

        // Create the menu item with a tooltip
        MenuItem menuItem = new MenuItem("Open");
        Tooltip tooltip = new Tooltip("Open a file");
        Tooltip.install(menuItem, tooltip);

        // Add the menu item to the menu
        fileMenu.getItems().add(menuItem);

        // Add the menu bar to the root
        root.getChildren().add(menuBar);

        primaryStage.show();
    }
}

In the code above, a Tooltip is created with the text "Open a file" and is then installed on the MenuItem using Tooltip.install(). This will display a tooltip with the specified text when you hover over the MenuItem.

Note that in some cases, you might want to use menuItem.setTooltip(tooltip) instead of Tooltip.install(menuItem, tooltip). However, in JavaFX 8 and some later versions, there's a known issue where using setTooltip() doesn't work for MenuItems. Using Tooltip.install() is a reliable workaround for this issue.

koppor commented 1 year ago

I was quickly in org.jabref.gui.actions.ActionFactory#configureMenuItem, but I could not figure out anything, too. Did not spend more time to check how the whole initialization works.

Maybe an UML sequence diagram would help to understand and where the data is lost?

koppor commented 1 year ago

@calixtus dove into with much debugging. One idea was following:

image

However, that does not work. Seems to be more hard. We remove it as projects for students. Seems to be too hard. Much code reading for very little code changes.