From ca2953d0ed34b68b7bf68f554d2b72465a1917f2 Mon Sep 17 00:00:00 2001 From: Christoph Date: Sun, 3 Nov 2019 16:47:49 +0100 Subject: [PATCH] Make entry editor DND behave as specified in settings (#5554) --- .../jabref/gui/entryeditor/EntryEditor.java | 45 +++---------------- .../FileDragDropPreferenceType.java | 9 ++++ 2 files changed, 15 insertions(+), 39 deletions(-) diff --git a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java index 02efa83d935..0016b222116 100644 --- a/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java +++ b/src/main/java/org/jabref/gui/entryeditor/EntryEditor.java @@ -137,53 +137,20 @@ public EntryEditor(BasePanel panel, ExternalFileTypes externalFileTypes) { FileDragDropPreferenceType dragDropPreferencesType = preferencesService.getEntryEditorFileLinkPreference(); if (dragDropPreferencesType == FileDragDropPreferenceType.MOVE) { - if (event.getTransferMode() == TransferMode.LINK) { - // Alt on Windows - LOGGER.debug("Mode LINK"); - fileLinker.addFilesToEntry(entry, files); - } else if (event.getTransferMode() == TransferMode.COPY) { - // Ctrl on Windows, no modifier on Xubuntu - LOGGER.debug("Mode COPY"); - fileLinker.copyFilesToFileDirAndAddToEntry(entry, files); - } else { - // Shift on Windows or no modifier - LOGGER.debug("Mode MOVE"); - fileLinker.moveFilesToFileDirAndAddToEntry(entry, files); - } + LOGGER.debug("Mode MOVE"); + fileLinker.moveFilesToFileDirAndAddToEntry(entry, files); success = true; } if (dragDropPreferencesType == FileDragDropPreferenceType.COPY) { - if (event.getTransferMode() == TransferMode.COPY) { - // Ctrl on Windows, no modifier on Xubuntu - LOGGER.debug("Mode MOVE"); - fileLinker.moveFilesToFileDirAndAddToEntry(entry, files); - } else if (event.getTransferMode() == TransferMode.LINK) { - // Alt on Windows - LOGGER.debug("Mode LINK"); - fileLinker.addFilesToEntry(entry, files); - } else { - // Shift on Windows or no modifier - LOGGER.debug("Mode COPY"); - fileLinker.copyFilesToFileDirAndAddToEntry(entry, files); - } + LOGGER.debug("Mode COPY"); + fileLinker.copyFilesToFileDirAndAddToEntry(entry, files); success = true; } if (dragDropPreferencesType == FileDragDropPreferenceType.LINK) { - if (event.getTransferMode() == TransferMode.COPY) { - // Ctrl on Windows, no modifier on Xubuntu - LOGGER.debug("Mode COPY"); - fileLinker.copyFilesToFileDirAndAddToEntry(entry, files); - } else if (event.getTransferMode() == TransferMode.LINK) { - // Alt on Windows - LOGGER.debug("Mode MOVE"); - fileLinker.moveFilesToFileDirAndAddToEntry(entry, files); - } else { - // Shift on Windows or no modifier - LOGGER.debug("Mode LINK"); - fileLinker.addFilesToEntry(entry, files); - } + LOGGER.debug("Mode LINK"); + fileLinker.addFilesToEntry(entry, files); success = true; } } diff --git a/src/main/java/org/jabref/gui/entryeditor/FileDragDropPreferenceType.java b/src/main/java/org/jabref/gui/entryeditor/FileDragDropPreferenceType.java index f8bea3ce606..c4593487e39 100644 --- a/src/main/java/org/jabref/gui/entryeditor/FileDragDropPreferenceType.java +++ b/src/main/java/org/jabref/gui/entryeditor/FileDragDropPreferenceType.java @@ -1,7 +1,16 @@ package org.jabref.gui.entryeditor; public enum FileDragDropPreferenceType { + /** + * Copy file to default file folder + */ COPY, + /** + * Link file (without copying) + */ LINK, + /** + * Copy, rename and link file + */ MOVE; }