Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into convertSearchWorker
Browse files Browse the repository at this point in the history
* upstream/master:
  Fix icon size - the second (#4993)

# Conflicts:
#	src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
  • Loading branch information
Siedlerchr committed May 25, 2019
2 parents 6db6073 + 3ebc59a commit ef6b159
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
9 changes: 2 additions & 7 deletions src/main/java/org/jabref/gui/actions/ActionFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.lang.reflect.Method;
import java.util.Objects;

import javafx.scene.Node;
import javafx.scene.control.Button;
import javafx.scene.control.ButtonBase;
import javafx.scene.control.CheckMenuItem;
Expand Down Expand Up @@ -148,13 +147,9 @@ public ButtonBase configureIconButton(Action action, Command command, ButtonBase
button.getStyleClass().add("icon-button");

// For some reason the graphic is not set correctly, so let's fix this
// ToDO: Find a way to reuse JabRefIconView
button.graphicProperty().unbind();
action.getIcon().ifPresent(icon -> {
// ToDO: Find a way to reuse JabRefIconView
Node graphicNode = icon.getGraphicNode();
graphicNode.setStyle(String.format("-fx-font-family: %s; -fx-font-size: %s;", icon.fontFamily(), "1em"));
button.setGraphic(graphicNode);
});
action.getIcon().ifPresent(icon -> button.setGraphic(icon.getGraphicNode()));

return button;
}
Expand Down
9 changes: 8 additions & 1 deletion src/main/java/org/jabref/gui/entryeditor/EntryEditor.fxml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,14 @@
<Tooltip text="%Change entry type"/>
</tooltip>
</Button>
<Button fx:id="generateCiteKeyButton" styleClass="narrow"/>
<Button styleClass="icon-button,narrow" onAction="#generateCiteKeyButton">
<graphic>
<JabRefIconView glyph="MAKE_KEY"/>
</graphic>
<tooltip>
<Tooltip text="%Generate BibTeX key"/>
</tooltip>
</Button>
<Button fx:id="fetcherButton" styleClass="icon-button,narrow">
<graphic>
<JabRefIconView glyph="REFRESH"/>
Expand Down
14 changes: 6 additions & 8 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ public class EntryEditor extends BorderPane {
@FXML private Button typeChangeButton;
@FXML private Button fetcherButton;
@FXML private Label typeLabel;
@FXML private Button generateCiteKeyButton;

private final EntryEditorPreferences preferences;
private final DialogService dialogService;
Expand Down Expand Up @@ -262,6 +261,12 @@ private void deleteEntry() {
panel.delete(entry);
}

@FXML
void generateCiteKeyButton() {
GenerateBibtexKeySingleAction action = new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager);
action.execute();
}

@FXML
private void navigateToPreviousEntry() {
panel.selectPreviousEntry();
Expand Down Expand Up @@ -388,13 +393,6 @@ private void setupToolBar() {
fetcherMenu.getItems().add(fetcherMenuItem);
}
fetcherButton.setOnMouseClicked(event -> fetcherMenu.show(fetcherButton, Side.RIGHT, 0, 0));

// Configure cite key button
new ActionFactory(preferences.getKeyBindings())
.configureIconButton(
StandardActions.GENERATE_CITE_KEY,
new GenerateBibtexKeySingleAction(getEntry(), databaseContext, dialogService, preferences, undoManager),
generateCiteKeyButton);
}

private void fetchAndMerge(EntryBasedFetcher fetcher) {
Expand Down

0 comments on commit ef6b159

Please sign in to comment.