eclipse-platform / eclipse.platform.swt

Eclipse SWT
https://www.eclipse.org/swt/
Eclipse Public License 2.0
112 stars 133 forks source link

Add support for the recycle-bin #548

Open laeubi opened 1 year ago

laeubi commented 1 year ago

Currently Eclipse can only delete files permanently, but I think many user would prefer to have an option to move it to the systems recycle bin.

At least Windows and Linux Desktops have such concepts and I assume Mac as well.

There is an old bugzilla here https://bugs.eclipse.org/bugs/show_bug.cgi?id=70810 but it never got much attention.

As even AWT has now such a function: https://docs.oracle.com/javase/9/docs/api/java/awt/Desktop.html#moveToTrash-java.io.File-

I think it is time that SWT offers something similar.

merks commented 1 year ago

That bug was open again the platform resources component. I don't understand what SWT would do to provide such a feature even if it did do something, the resources framework does not depend on SWT. Not only that, resources don't even necessarily correspond to files in the file system, but that's a detail. I assume some new version of org.eclipse.core.resources.IResource.delete is needed to add recycle-bin support...

laeubi commented 1 year ago

That bug was open again the platform resources component I don't understand what SWT would

Just quoting from the original bug

SWT already has a few cross-platform convenience methods (the Program class for opening files, for example). Would it be possible to make a class to manage a cross-platform "Recycle Bin" or "Trash Can" for deleting files?

So I agree with that this is more a SWT (= Desktop Integration Related across Windowing Systems) that is simlar to what Program offers.

Not only that, resources don't even necessarily correspond to files in the file system

So I don't see that the resources framework plays any role here, nut might reuse that function

akurtakov commented 1 year ago

The fact that even in the JDK this functionality is implemented as part of Desktop relates to the fact that filesystems don't have the notion of trash/recyclebin but this is rather desktop environment functionality and implementation is most likely using desktop environment APIs and not filesystem one e.g. it's pretty hard to move file to trash from command line (last that I tried).

laeubi commented 1 year ago

@akurtakov exactly that why I think its an "UI" concern, because recycle-bin has no real meaning on the commandline.

akurtakov commented 1 year ago

Program.moveToTrash would be fairly easy to do on Linux https://docs.gtk.org/gio/method.File.trash.html

akurtakov commented 1 year ago

It's implemented in gio so from Linux POV it can even be done in filesystem but it would mean linking to libgio too while libfilesystem.so doesn't link to anything but libc right now. Next step should be to get similar analysis for Mac and/or Win before decision on API can be done.

deepika-u commented 1 month ago

I have checked on win32 apis for implementing recycle-bin support on windows, it is implementable in my opinion. Please find my observations as below

I am not that familiar with windows apis as such, so some one more familiar with windows apis can confirm if my understanding is correct.

deepika-u commented 2 weeks ago

@niraj-modi : Can you share your opinion from windows perspective please?