Search code examples
eclipseeclipse-rcpworking-set

How to set recent working set list size limit in eclipse RCP?


I'm building an eclipse RCP using working sets. I programmatically add some working sets to my project explorer (CommonNavigator) and then add in recent working set list by IWorkingSetManager.addRecentWorkingSet.

In javadoc, it says "The last (oldest) item will be deleted if the list exceeds the size limit". Is there a way to set recent working set list size?

Edit: After more search, I found that there are getRecentWorkingSetsLength and getRecentWorkingSetsLength methods in eclipse 3.7.


Solution

  • What you have found (getRecentWorkingSetsLength()) seems to fit bug 318914:

    Provide a preference to set size of the list of most recently used working sets

    The patch adds the following APIs:

    IWorkingSetManager#
        public void setRecentWorkingSetsLength(int length);
        public int getRecentWorkingSetsLength();
    

    (The IWorkingSetManager is marked as "no implement" and got a new method last time in 3.4.)

    The patch exposes new MRU preference in the General -> Workspace preference page.
    Updated patch:

    • removed UI preferences page
    • changed MRU preference to be shown via IWorkbenchPreferenceConstants.RECENTLY_USED_WORKINGSETS_SIZE

    The patch adds JUnit IWorkingSetManagerTest№testRecentWorkingSetsLength().