Skip to content

Commit

Permalink
Make entry editor DND behave as specified in settings (#5554)
Browse files Browse the repository at this point in the history
  • Loading branch information
Siedlerchr authored and koppor committed Nov 3, 2019
1 parent 921f442 commit ca2953d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 39 deletions.
45 changes: 6 additions & 39 deletions src/main/java/org/jabref/gui/entryeditor/EntryEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}

0 comments on commit ca2953d

Please sign in to comment.