Skip to content

Commit

Permalink
fix disabling of conversion menu
Browse files Browse the repository at this point in the history
  • Loading branch information
TheGor1lla committed Oct 3, 2022
1 parent 6e08833 commit 0e2ba09
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import java.util.Objects;
import java.util.function.Supplier;

import com.tobiasdiez.easybind.EasyBind;
import javafx.scene.control.CustomMenuItem;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
Expand All @@ -15,6 +16,7 @@
import org.jabref.logic.cleanup.Formatter;
import org.jabref.logic.formatter.Formatters;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.strings.StringUtil;

public class DefaultMenu implements Supplier<List<MenuItem>> {

Expand Down Expand Up @@ -62,7 +64,7 @@ private static Menu getConversionMenu(TextInputControl textInputControl) {
CustomMenuItem menuItem = new CustomMenuItem(new Label(converter.getName()));
Tooltip toolTip = new Tooltip(converter.getDescription());
Tooltip.install(menuItem.getContent(), toolTip);
menuItem.setDisable(textInputControl.textProperty().get() == null);
EasyBind.subscribe(textInputControl.textProperty(), value -> menuItem.setDisable(StringUtil.isNullOrEmpty(value)));
menuItem.setOnAction(event ->
textInputControl.textProperty().set(converter.format(textInputControl.textProperty().get())));
submenu.getItems().add(menuItem);
Expand Down

0 comments on commit 0e2ba09

Please sign in to comment.