Please use the Apache issue tracking system for new NetBeans issues (https://issues.apache.org/jira/projects/NETBEANS0/issues) !!
Bug 218695 - Alternative algorithm for recent files
Alternative algorithm for recent files
Status: RESOLVED FIXED
Product: utilities
Classification: Unclassified
Component: Open File
7.2
PC Windows 7
: P2 (vote)
: 7.4
Assigned To: Jaroslav Havlin
issues@utilities
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-09-20 12:33 UTC by pjdm
Modified: 2013-03-12 02:06 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description pjdm 2012-09-20 12:33:05 UTC
The algorithm currently used for the File -> Open Recent File list is as follows (see org.netbeans.modules.openfile.RecentFiles$WindowRegistryL.propertyChange()).

If a TopComponent is being closed, add its file to the list.
If a TopComponent is being opened, remove its file from the list.

This algorithm works well with persistent TopComponents. However, my application has multiple instances of TopComponents with persistenceType = TopComponent.PERSISTENCE_NEVER. When a user opens a TopComponent then closes the application, the PROP_TC_CLOSED property is not fired, so WindowRegistryL does not get an opportunity to record the TopComponent's file in the recent files list. This does not matter for a persistent TopComponent, because it is re-opened automatically when the application next runs. However, a non-persistent TopComponent is not automatically re-opened, so not being in the recent files list is a problem.

A suggested solution is to modify the algorithm in WindowRegistryL.propertyChange() as follows.

If a TopComponent is being closed, add its file to the list.
If a TopComponent is being opened:
    if getPersistenceType()==TopComponent.PERSISTENCE_NEVER:
        add its file to the list.
    else:
        remove its file from the list.

This algorithm will leave a file in the list when it is opened; I don't see this as a problem. (One low-priority solution to this might be to not display a file in the recent files menu if an open TopComponent has a DataObject that matches that file.)
Comment 1 Stanislav Aubrecht 2013-03-06 09:33:13 UTC
Recent files should listen to IDE exit events (or window system save events) and add all non-persistent opened documents to the list during that event.
I think it's better solution than  showing already opened documents in the list as suggested above.
Comment 2 Jaroslav Havlin 2013-03-06 09:55:04 UTC
(In reply to comment #1)
> Recent files should listen to IDE exit events (or window system save events)
> and add all non-persistent opened documents to the list during that event.
Thank you, Standa, I'll implement it that way.
Comment 3 Jaroslav Havlin 2013-03-11 10:49:38 UTC
http://hg.netbeans.org/core-main/rev/050efc23b3d1
Fixed. Thank you for reporting and commenting.
Comment 4 Quality Engineering 2013-03-12 02:06:11 UTC
Integrated into 'main-golden', will be available in build *201303112300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/050efc23b3d1
User: Jaroslav Havlin <jhavlin@netbeans.org>
Log: #218695: Alternative algorithm for recent files


By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo