#18: add max recent files list setting (default is now 10)
This commit is contained in:
parent
b26e0ecf5e
commit
edacc0a359
|
@ -46,7 +46,6 @@ enum MenuItem implements ActionListener {
|
||||||
*/
|
*/
|
||||||
private static EventListenerList listeners = new EventListenerList();
|
private static EventListenerList listeners = new EventListenerList();
|
||||||
|
|
||||||
private static final int MAX_FILES = 5;
|
|
||||||
private static final int TRUNCATE = 30;
|
private static final int TRUNCATE = 30;
|
||||||
|
|
||||||
private boolean isEndOfGroup;
|
private boolean isEndOfGroup;
|
||||||
|
@ -136,8 +135,8 @@ enum MenuItem implements ActionListener {
|
||||||
}
|
}
|
||||||
recentFiles.add( 0, path );
|
recentFiles.add( 0, path );
|
||||||
|
|
||||||
if ( recentFiles.size() > MAX_FILES ) {
|
if ( recentFiles.size() > Settings.maxRecentFiles.get() ) {
|
||||||
recentFiles.remove( MAX_FILES );
|
recentFiles.remove( (int)Settings.maxRecentFiles.get() );
|
||||||
}
|
}
|
||||||
Settings.recentFiles.set( recentFiles );
|
Settings.recentFiles.set( recentFiles );
|
||||||
populateRecentlyOpened();
|
populateRecentlyOpened();
|
||||||
|
@ -150,7 +149,7 @@ enum MenuItem implements ActionListener {
|
||||||
*/
|
*/
|
||||||
static void populateRecentlyOpened() {
|
static void populateRecentlyOpened() {
|
||||||
List<String> recentFiles = Settings.recentFiles.get();
|
List<String> recentFiles = Settings.recentFiles.get();
|
||||||
for ( int i = MAX_FILES; i < recentFiles.size(); i++ ) {
|
for ( int i = Settings.maxRecentFiles.get(); i < recentFiles.size(); i++ ) {
|
||||||
recentFiles.remove( i - 1 );
|
recentFiles.remove( i - 1 );
|
||||||
}
|
}
|
||||||
OPEN_RECENT.menuItem.removeAll();
|
OPEN_RECENT.menuItem.removeAll();
|
||||||
|
|
|
@ -32,6 +32,7 @@ public class Settings {
|
||||||
public static final Property<Locale> language = new Property<>( "language" );
|
public static final Property<Locale> language = new Property<>( "language" );
|
||||||
public static final Property<Locale> viewerLanguage = new Property<>( "viewerLanguage" );
|
public static final Property<Locale> viewerLanguage = new Property<>( "viewerLanguage" );
|
||||||
public static final Property<List<String>> recentFiles = new Property<>( "recentFiles" );
|
public static final Property<List<String>> recentFiles = new Property<>( "recentFiles" );
|
||||||
|
public static final Property<Integer> maxRecentFiles = new Property<>( "maxRecentFiles" );
|
||||||
public static final Property<Point> coordinates = new Property<>( "coordinates" );
|
public static final Property<Point> coordinates = new Property<>( "coordinates" );
|
||||||
public static final Property<Dimension> dimension = new Property<>( "dimension" );
|
public static final Property<Dimension> dimension = new Property<>( "dimension" );
|
||||||
public static final Property<Compare> compareMethod = new Property<>( "compareMethod" );
|
public static final Property<Compare> compareMethod = new Property<>( "compareMethod" );
|
||||||
|
@ -212,6 +213,7 @@ public class Settings {
|
||||||
setDefault( language.key, Locale.ENGLISH, force );
|
setDefault( language.key, Locale.ENGLISH, force );
|
||||||
setDefault( viewerLanguage.key, Locale.ENGLISH, force );
|
setDefault( viewerLanguage.key, Locale.ENGLISH, force );
|
||||||
setDefault( recentFiles.key, new ArrayList<String>(), force );
|
setDefault( recentFiles.key, new ArrayList<String>(), force );
|
||||||
|
setDefault( maxRecentFiles.key, 10, force );
|
||||||
setDefault( coordinates.key, null, force );
|
setDefault( coordinates.key, null, force );
|
||||||
setDefault( dimension.key, null, force );
|
setDefault( dimension.key, null, force );
|
||||||
setDefault( compareMethod.key, Compare.BEST_OVERALL_RUN, force );
|
setDefault( compareMethod.key, Compare.BEST_OVERALL_RUN, force );
|
||||||
|
|
Reference in a new issue