From a2fbb3a46901eee3310527bf6e283f1656dafb89 Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 31 Aug 2020 17:17:58 +0200 Subject: [PATCH] Follow up fix for copy paste (#6820) Fixes #6293 Also enable paste menu/action for empty libraries with no entries yet --- src/main/java/org/jabref/gui/edit/EditAction.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/jabref/gui/edit/EditAction.java b/src/main/java/org/jabref/gui/edit/EditAction.java index a05b592b190..4e983c27726 100644 --- a/src/main/java/org/jabref/gui/edit/EditAction.java +++ b/src/main/java/org/jabref/gui/edit/EditAction.java @@ -7,7 +7,6 @@ import org.jabref.gui.actions.ActionHelper; import org.jabref.gui.actions.SimpleCommand; import org.jabref.gui.actions.StandardActions; -import org.jabref.gui.maintable.MainTable; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -29,7 +28,11 @@ public EditAction(StandardActions action, JabRefFrame frame, StateManager stateM this.frame = frame; this.stateManager = stateManager; - this.executable.bind(ActionHelper.needsEntriesSelected(stateManager)); + if (action == StandardActions.PASTE) { + this.executable.bind(ActionHelper.needsDatabase(stateManager)); + } else { + this.executable.bind(ActionHelper.needsEntriesSelected(stateManager)); + } } @Override @@ -62,9 +65,9 @@ public void execute() { throw new IllegalStateException("Only cut/copy/paste supported in TextInputControl but got " + action); } - } else if (focusOwner instanceof MainTable) { + } else { - LOGGER.debug("EditAction - MainTable: {}", frame.getCurrentBasePanel().getTabTitle()); + LOGGER.debug("EditAction - Else: {}", frame.getCurrentBasePanel().getTabTitle()); // Not sure what is selected -> copy/paste/cut selected entries // ToDo: Should be handled by BibDatabaseContext instead of BasePanel