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

Groups right click #4061

Merged
merged 2 commits into from
Jun 13, 2018
Merged
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
13 changes: 12 additions & 1 deletion src/main/java/org/jabref/gui/groups/GroupTreeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
Expand Down Expand Up @@ -148,7 +150,10 @@ public void initialize() {
disclosureNode.getChildren().add(disclosureNodeArrow);
return disclosureNode;
})
.withOnMouseClickedEvent(group -> event -> group.toggleExpansion()));
.withOnMouseClickedEvent(group -> event -> {
group.toggleExpansion();
event.consume();
}));

// Set pseudo-classes to indicate if row is root or sub-item ( > 1 deep)
PseudoClass rootPseudoClass = PseudoClass.getPseudoClass("root");
Expand Down Expand Up @@ -178,6 +183,12 @@ public void initialize() {
EasyBind.monadic(row.itemProperty())
.map(this::createContextMenuForGroup)
.orElse((ContextMenu) null));
row.addEventFilter(MouseEvent.MOUSE_PRESSED, event -> {
if (event.getButton() == MouseButton.SECONDARY) {
// Prevent right-click to select group
event.consume();
}
});

// Drag and drop support
row.setOnDragDetected(event -> {
Expand Down