Skip to content
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

Added a "Clear text" button in right click menu within the text boxes. #3475

Merged
merged 5 commits into from
Dec 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ We refer to [GitHub issues](https://github.com/JabRef/jabref/issues) by using `#
- We added an option to mass append to fields via the Quality -> set/clear/append/rename fields dialog. [#2721](https://github.com/JabRef/jabref/issues/2721)
- We added a check on startup to ensure JabRef is run with an adequate Java version. [3310](https://github.com/JabRef/jabref/issues/3310)
- In the preference, all installed java Look and Feels are now listed and selectable
- We added a clear option to the right-click menu of the text field in the entry editor. [koppor#198](https://github.com/koppor/jabref/issues/198)


### Fixed
- We fixed the translation of \textendash in the entry preview [#3307](https://github.com/JabRef/jabref/issues/3307)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.jabref.gui.fieldeditors.contextmenu;

import javafx.scene.control.MenuItem;
import javafx.scene.control.TextArea;

import org.jabref.logic.l10n.Localization;

class ClearField extends MenuItem {

public ClearField(TextArea opener) {
super(Localization.lang("Clear"));
setOnAction(event -> opener.setText(""));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,13 @@ public class EditorMenus {
*/
public static Supplier<List<MenuItem>> getDefaultMenu(TextArea textArea) {
return () -> {
List<MenuItem> menuItems = new ArrayList<>(5);
List<MenuItem> menuItems = new ArrayList<>(6);
menuItems.add(new CaseChangeMenu(textArea.textProperty()));
menuItems.add(new ConversionMenu(textArea.textProperty()));
menuItems.add(new SeparatorMenuItem());
menuItems.add(new ProtectedTermsMenu(textArea));
menuItems.add(new SeparatorMenuItem());
menuItems.add(new ClearField(textArea));
return menuItems;
};
}
Expand All @@ -57,7 +58,6 @@ public static Supplier<List<MenuItem>> getNameMenu(TextArea textArea) {
normalizeNames.setOnAction(event -> textArea.setText(new NormalizeNamesFormatter().format(textArea.getText())));
Tooltip toolTip = new Tooltip(Localization.lang("If possible, normalize this list of names to conform to standard BibTeX name formatting"));
Tooltip.install(normalizeNames.getContent(), toolTip);

List<MenuItem> menuItems = new ArrayList<>(6);
menuItems.add(normalizeNames);
menuItems.addAll(getDefaultMenu(textArea).get());
Expand Down