Skip to main content

Trash bin

12 replies [Last post]
anka
Offline
Joined: 2004-06-13

Hello,
Is somebody planning to implement Recycle/Trash Bin file sending under the jdic??????

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
fcmartins
Offline
Joined: 2004-01-01

Anybody knows how to programmatically send a file to the Trash Can in Mac OS X (through Cocoa)?
I looked inside Apple's documentation but couldn't find an answer.

fcmartins
Offline
Joined: 2004-01-01

Hi,

I alreay sent the code via e-mail.

The method receives a File object and sends the file/directory to the Recycle Bin. It will return true if the operation is performed, even in the cases where the user press "No" in the Confirmation Box.
If the File Object doesn't reference any File, the method will show a native error dialog.

If someone know how this works in Gnome (is there an API method, like in Windows?), I might give it a look. I haven't find any references to that in Google.

I tested the code against a Windows XP box, but it should work in Windows 95 OSR2 too.

georgez
Offline
Joined: 2003-08-19

Also, I found this bug in Java bug database:
Need way to find free disk space
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4057701

which gives more evaluation information. It maybe helpful to take a look.

Thanks,
-George.

fcmartins
Offline
Joined: 2004-01-01

I've implemented a method to do that in Windows, using JNI + Win32 API. The method receives a File object and sends the file or directory referenced by the File object to the Recycle Bin. It also shows the Windows' standard confirmation box.
Would you be interested in?

georgez
Offline
Joined: 2003-08-19

Hi Fábio,

It's great ! It's a very interesting feature, I'd like to try it out. I fired an issue to track it:
https://jdic.dev.java.net/issues/show_bug.cgi?id=208

Could you raise your comments there and provide a patch? We can include it in JDIC someway. :-)

Thanks,
-George.

georgez
Offline
Joined: 2003-08-19

Hi Anka,

There is no such planned feature at the moment. Do you any idea for that?

Thanks,
-George.

anka
Offline
Joined: 2004-06-13

Hi George!
I imagine this as File class extension with method deleteToTrash. This method would need a dll for Windows systems. As far as know, for other systems you just need to move you file to Trash or .Trash folder.
So, it doesn't sound a very complicated, I think I could do that.....

willdenniss
Offline
Joined: 2003-08-14

There is an RFE on this:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5080625

I suggest voting for this bug if you like the idea.

Will.

anka
Offline
Joined: 2004-06-13

I already did,
but I can not wait for years for next release....

georgez
Offline
Joined: 2003-08-19

Hi Anka and Will,

I viewed that RFE, and think it's quite a reasonable and doable request.

Though we can hope and wait for that in JDK 6.0, or 7.0+ (?), we can make it available in JDIC now, and try to integrate it into JDK someday.

On the other hand, that's a feature that well fits in with the scope of JDIC project. It can be directly integrated into the current FileExplorer demo. : )

Also, leveraging the current JDIC source structure, it's very much doable. All the other packages take the similar approach: Java API calls into JNI code to access the OS specific features.

If you can spare time to create a prototype, that would be great. I think we can integrate that into JDIC later releases.

What do you think ? : )

-George.

anka
Offline
Joined: 2004-06-13

Hi, George!
I am going to implement this feature soon...
anka

georgez
Offline
Joined: 2003-08-19

I'm ready to try it out soon... : -)

-George.