|
34 | 34 | import javafx.scene.input.ClipboardContent; |
35 | 35 | import javafx.scene.input.DragEvent; |
36 | 36 | import javafx.scene.input.Dragboard; |
| 37 | +import javafx.scene.input.MouseButton; |
37 | 38 | import javafx.scene.input.MouseEvent; |
38 | 39 | import javafx.scene.input.TransferMode; |
39 | 40 | import javafx.scene.layout.BorderPane; |
|
44 | 45 |
|
45 | 46 | import org.jabref.gui.DialogService; |
46 | 47 | import org.jabref.gui.DragAndDropDataFormats; |
47 | | -import org.jabref.gui.Globals; |
48 | 48 | import org.jabref.gui.StateManager; |
49 | 49 | import org.jabref.gui.actions.ActionFactory; |
50 | 50 | import org.jabref.gui.actions.SimpleCommand; |
@@ -225,7 +225,10 @@ private void initialize() { |
225 | 225 | new ViewModelTreeTableRowFactory<GroupNodeViewModel>() |
226 | 226 | .withContextMenu(this::createContextMenuForGroup) |
227 | 227 | .withEventFilter(MouseEvent.MOUSE_PRESSED, (row, event) -> { |
228 | | - if (event.getTarget() instanceof StackPane pane) { |
| 228 | + if (((MouseEvent) event).getButton() == MouseButton.SECONDARY && !stateManager.getSelectedEntries().isEmpty()) { |
| 229 | + // Prevent right-click to select group whe we have selected entries |
| 230 | + event.consume(); |
| 231 | + } else if (event.getTarget() instanceof StackPane pane) { |
229 | 232 | if (pane.getStyleClass().contains("arrow") || pane.getStyleClass().contains("tree-disclosure-node")) { |
230 | 233 | event.consume(); |
231 | 234 | } |
@@ -481,7 +484,7 @@ private ContextMenu createContextMenuForGroup(GroupNodeViewModel group) { |
481 | 484 | } |
482 | 485 |
|
483 | 486 | ContextMenu contextMenu = new ContextMenu(); |
484 | | - ActionFactory factory = new ActionFactory(Globals.getKeyPrefs()); |
| 487 | + ActionFactory factory = new ActionFactory(preferencesService.getKeyBindingRepository()); |
485 | 488 |
|
486 | 489 | MenuItem removeGroup; |
487 | 490 | if (group.hasSubgroups() && group.canAddGroupsIn() && !group.isRoot()) { |
|
0 commit comments