Skip to main content

"Recent Documents" API proposal.

10 replies [Last post]
georgez
Offline
Joined: 2003-08-19
Points: 0

Hi all,

I heard somebody proposed to add new APIs to make the most recently used document in Java applications visible in the desktop menu, thus as Start->My Recent Documents in Windows. This feature is also available on Gnome/Linux as well.

I have some code working for Windows. Any comments for this?

-George.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
deepakpk009
Offline
Joined: 2011-08-06
Points: 0

hi georgez,

i saw your post while i was googling for recent files support in java for one of my projects.
i have created a RecentFiles API for java. its free and opensource(LGPL). it can be downloaded from @ http://sourceforge.net/projects/recentfilesapi/

happy coding :)

deepakpk009

cdea
Offline
Joined: 2011-03-01
Points: 0

> Hi George,
>
> Personnally I find this useless.
> Its like a spy telling to other people using the
> computer what were the files you last used.
>
> If you can add a API to destroy those "last
> documents", then i'll find it usefull ;-)
>
> maxim

This is a great feature. I'm not a big fan of File/Open/ search for file - click ok.

On the windows platform if you want to erase your paper trail (watergatedocuments)
you simply make a short-cut to your recent folder
"C:\Documents and Settings\some_user\Recent"
and delete documents.

Almost all native apps have this feature, and almost all Java IDE apps don't. We need this.

:)

-Carl

maximk1
Offline
Joined: 2006-02-17
Points: 0

Hi cdea,

There is no "Recent" directory on my PC... where does XP store those shortcuts ?

Thanks,
Maxim

cdea
Offline
Joined: 2011-03-01
Points: 0

> Hi cdea,
>
> There is no "Recent" directory on my PC... where does
> XP store those shortcuts ?
>
> Thanks,
> Maxim

Maxim,

Just remove the files at directory:

C:\Documents and Settings\user_name\Recent

Notice that different platforms have different locations.
Also, if you try to mimic this behavior by copying a short-cut to that directory it does not show up in the Start/Documents.

That's why it is important to have this feature in JDIC.

I have code for this also.
The code is simple and strait forward for Win32.

Would you like Java developer's customers to click Start/Documents select file to launch the Java program and automatically load the file into it?

I hope this helps.

IMHO, Desktop integration for Java will gain serious momentum on the client. When I build an app I don't want to futs with figuring out how to mimic native behavior. I just want to focus on my app.

This won't happen to .Net developers, because C# with desktop integration is a business oxymoron.

P.S. remember what was said in the movie Field of Dreams.

Thanks,

-Carl

georgez
Offline
Joined: 2003-08-19
Points: 0

Carl,

You gave perfect justifications for this feature. : ) This is very much like the shortcut feature in the Start -> Program folder, but that feature is only useful for "installer" apps.

But the "Recent Documents" API is for any "editor" apps.

The implementation for Win32 is nearly done, though we need to specify the APIs.

For Linux/Unix, it's a little bit tricky, as I know for Gnome, we need to parse and edit those .desktop files. Anybody would contribute to this?

Thanks,
-George.

georgez
Offline
Joined: 2003-08-19
Points: 0

An update to this issue. Based on the investigation, I got below result and suggestion for this feature:
1. The API spec:
/**
* Adds a file to the most recently used file list of the desktop.
*
* @param file the file to be added to the most recently used file list.
* @throws IOException if an IO error occurs.
*/
public void addFileToRecentDocs(File file) throws IOException{}

2. We can add this API to the FileUtil incubator project, in specific, adding it to the org.jdesktop.jdic.fileutil.FileUtil interface:
https://jdic.dev.java.net/nonav/incubator/fileutil/javadoc/org/jdesktop/...

3. In terms of implementation, on Windows, this can be done using SHAddToRecentDocs:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc...

On Gnome/KDE, we can follow the "Recent File Storage Specification":
http://standards.freedesktop.org/recent-file-spec/recent-file-spec-0.2.html

Issue#217 was reported to track it:
https://jdic.dev.java.net/issues/show_bug.cgi?id=217

Any comments are welcome ! Thanks !

-George.

armin_chen
Offline
Joined: 2004-09-29
Points: 0

The API spec should be
/**
* Add file to recently-used file list or clear all documents from the list.
*
* @param file The file to be added to the recently-used file list.
* Set this parameter to null to clear all documents from the list
*
* @throws IOException if an error occurs.
*/
public void addFileToRecentDocs(File file) throws IOException;

buw
Offline
Joined: 2006-02-14
Points: 0

Hi,

So is this system only able to add a file to the MRU file list or can it also read this list.
I think that it doesn't support MAC OS unfortunately. Is this right? Will this be changed in future?

Thanks,

buw

maximk1
Offline
Joined: 2006-02-17
Points: 0

Hi George,

Personnally I find this useless.
Its like a spy telling to other people using the computer what were the files you last used.

If you can add a API to destroy those "last documents", then i'll find it usefull ;-)

maxim

georgez
Offline
Joined: 2003-08-19
Points: 0

Hi Maxim,

I wanted to provide API to add opened filed in Java apps to the recent document list. No remove or query, which can be done from the OS itself.

This feature should be needed by all Java "editor" apps, like IDE etc. Try to run the sample Notepad app under [jdk1.5.0]\demo\jfc\Notepad

The opened files are not added to the recent document list, unlike the normal native editor apps.

Any more comments?
-George.