Jabref: adding file to file field - automatically asking what to do?

Created on 21 Sep 2018  路  19Comments  路  Source: JabRef/jabref

I believe in some more or less distance past, it was possible to drag and drop a file onto the entry editor's file field and then jabref automatically asked what to do with the file, e.g. automatically rename and store the file in the preferred folder (#4166).
would be amazing if this, too, worked again ;)

entry-editor good first issue hacktoberfest preferences enhancement

Most helpful comment

A preference option for the default action is a good idea in my opinion. Thanks @tb77phd for the suggestion.

All 19 comments

We reworked drag and drop completely. If you drop directly on the file field the file will be just linked.
If you drop it elsewhere on the entry editor or preview panel it will be renamed and moved to the file directory.
If you drop on maintable, JabRef tries to create an entry and asks what to do

Its somewhat strange that drop on file field is different from a drop on the rest of the entry editor. I think, this should be aligned (i.e. always rename + move + link).

I agree with the alignment but not that it must always rename+move+link. I, for one, prefer to keep my files the way I have already named them and in the subfolders they are already in. It could be a Preference choice:

"When dropping a file on the entry editor, do you wish to ...
a) only link (i.e., keep the file where it is and with its original name)
b) rename and keep in location
c) rename+move+link"

Something along those lines.

So in fact we restore the dialog asking what to do

Not necessarily if it is in Options -> Preferences. Then one chooses once and that's it.

Okay, will think about t his:
In the meantime we have the following options also avaiable:

Holding Shift and dragging or directly dropping without key on windows -> move + rename + link
Holding alt key on windows -> link file to entry, keep in location
Holding ctrl on windows -> copy files to file dir + link to entry

The modifiers are the system ones for MOVE, LINK, and COPY. They are system dependent:
https://ux.stackexchange.com/questions/83748/what-are-the-most-common-modifier-keys-for-dragging-objects-with-a-mouse

A preference option for the default action is a good idea in my opinion. Thanks @tb77phd for the suggestion.

If anybody is not looking into this, can I take this issue?

@shahamish150294 Sure go ahead. as starting point you can look at the EntryEditor and in the LinkedFilesEditor. The methods which handle DragAndDrop are all similiar:
this.setOnDragDropped(event -> { ........ }

As part of this task I am also removing the three methods related to Drag and Drop in
https://github.com/JabRef/jabref/blob/1f14795b20eea9be44a0614afe5b8a2bd86a7c0e/src/main/java/org/jabref/gui/fieldeditors/LinkedFilesEditor.java#L68-L70
because now the drag and drop will be a part of the EntryEditor and hence IMO, this is not needed. Please let me know if I am correct. @Siedlerchr
Thanks.

Is this issue still available to work on? I'd like to contribute for a school project.

@shahamish150294 Yeah. I think we don't need there any special handling. Please test if it's really sufficient to have them in the entry editor.

@morganlovato Seems like @shahamish150294 is already working on this. But you can look through the other issues and take one

Thanks to @shahamish150294 this is now implemented in the latest development version. Could you please check the build from http://builds.jabref.org/master/. Thanks! Please remember to make a backup of your library before trying-out this version.

The latest build seems to reflect the changes. Thank you @tobiasdiez and @Siedlerchr for your help!

JabRef 5.0-dev--snapshot--2018-11-02--master--611e35a6b
Linux 4.18.16-200.fc28.x86_64 amd64
Java 1.8.0_172

Sorry, but in my version drag/drop of a pdf onto an existing entry (both in table and in fiel field of editor) does not result in any effect: no file linked.

Only if I use the + button next to the file field in the entry editor, then I can add a single entry. Here, at least, I would also like to be able to add several files (e.g. chapters of a book that are from the same author).

@ilippert Have you checked the preferences?

I guess I checjked preference Entry editor Default drag & drop: Copy, rename and link file.

The problem is is difficult to reproduce: two times I managed by now to drag a file from external file browser onto the file field and then a link became visible (as expected). But I cannot reliably reproduce this linking.
I did not yet manage at all to drag & drop the file onto the specific entry table entry and then get a link.

It should not only work in the file field, it should work on the whole entry editor.

just tried again. Interestingly, when I drag & drop a file on the entry editor after phase of non-use, the link is produced. I then remove the link to test again. Now, a second later, I cannot re-perform this effect: no link is produced.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Siedlerchr picture Siedlerchr  路  3Comments

AEgit picture AEgit  路  4Comments

simonharrer picture simonharrer  路  3Comments

Braunch picture Braunch  路  3Comments

humbleambition picture humbleambition  路  3Comments