Skip to content

Commit

Permalink
disable conversions for empty fields (JabRef#9202)
Browse files Browse the repository at this point in the history
* disable conversion menu for empty fields

* fix disabling of conversion menu

Co-authored-by: Patrick Helm <helm@synyx.de>
  • Loading branch information
TheGor1lla and Patrick Helm authored Oct 3, 2022
1 parent 629c548 commit e48ed0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Note that this project **does not** adhere to [Semantic Versioning](http://semve

### Changed

- We disabled the conversion menu for empty fields [#9200](https://github.com/JabRef/jabref/issues/9200)
- We upgraded to Lucene 9.4 for the fulltext search.
Thus, the now created search index cannot be read from older versions of JabRef anylonger.
⚠️ JabRef will recreate the index in a new folder for new files and this will take a long time for a huge library.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import org.jabref.logic.cleanup.Formatter;
import org.jabref.logic.formatter.Formatters;
import org.jabref.logic.l10n.Localization;
import org.jabref.model.strings.StringUtil;

import com.tobiasdiez.easybind.EasyBind;

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

Expand Down Expand Up @@ -62,6 +65,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);
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 e48ed0c

Please sign in to comment.