public class JadiceDemoPreferences extends Object
Weak listeners can be registered in cases where de-registration of listeners is not easily
possible (see addWeakPreferenceChangeListener(PreferenceChangeListener)
).
Auto-Flush mode: This class can automatically flush the preferences on a PreferenceChangeEvent (
see isAutoFlush()
/ setAutoFlush(boolean)
). By default, this feature is
disabled.
Modifier and Type | Field and Description |
---|---|
static String |
PREF_KEY_RECENT_FILE |
Modifier and Type | Method and Description |
---|---|
static void |
addWeakPreferenceChangeListener(PreferenceChangeListener listener)
Adds a weak PreferenceChangeListener to get notified about preference changes.
|
static Preferences |
getPreferences()
This is equivalent to
|
static List<String> |
getRecentlyUsedFiles()
Returns a list containing the recently used files.
|
static boolean |
isAutoFlush()
Check if auto-flush is enabled
|
static void |
setAutoFlush(boolean autoFlush)
Sets the auto-flush to the desired value.
|
static void |
updateRecentFileList(String currentFile)
Called when a new file has been opened.
|
public static final String PREF_KEY_RECENT_FILE
public static void addWeakPreferenceChangeListener(PreferenceChangeListener listener)
listener
- the listener to weakly registerpublic static Preferences getPreferences()
Preferences.userNodeForPackage(JadiceDemoProperties.class)
public static boolean isAutoFlush()
public static void setAutoFlush(boolean autoFlush)
public static void updateRecentFileList(String currentFile)
This method encapsulates the logic to store the list in the preferences.
currentFile
- the file opened.Copyright © 2024 levigo holding gmbh. All rights reserved.