Class EclipseMemory
java.lang.Object
com.developer.nefarious.zjoule.plugin.memory.EclipseMemory
- All Implemented Interfaces:
IEclipseMemory
Manages interactions with Eclipse's preference storage system.
The EclipseMemory
class provides methods to save, load, and delete key-value pairs
from Eclipse's preferences and to clear all stored preferences. It implements IEclipseMemory
.
-
Field Summary
Fields inherited from interface com.developer.nefarious.zjoule.plugin.memory.IEclipseMemory
PLUGIN_ID
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clearAll()
Clears all key-value pairs from Eclipse's preferences storage.void
Deletes the specified key-value pair from Eclipse's preferences storage.static org.eclipse.core.runtime.preferences.IEclipsePreferences
Retrieves the global Eclipse preferences for the plugin.Loads the value associated with the specified key from Eclipse's preferences storage.void
saveOnEclipsePreferences
(String key, String value) Saves a key-value pair to Eclipse's preferences storage.
-
Constructor Details
-
EclipseMemory
public EclipseMemory()Constructs a newEclipseMemory
instance.Initializes the preferences field with the global Eclipse preferences for the plugin.
-
-
Method Details
-
getEclipsePreferences
public static org.eclipse.core.runtime.preferences.IEclipsePreferences getEclipsePreferences()Retrieves the global Eclipse preferences for the plugin.- Returns:
- the
IEclipsePreferences
instance associated with the plugin.
-
clearAll
public void clearAll()Clears all key-value pairs from Eclipse's preferences storage.This method removes all data from the preferences node associated with the plugin and flushes the changes to ensure they are persisted.
- Specified by:
clearAll
in interfaceIEclipseMemory
-
deleteFromEclipsePreferences
Deletes the specified key-value pair from Eclipse's preferences storage.This method removes the value associated with the given key and flushes the changes to ensure they are persisted.
- Specified by:
deleteFromEclipsePreferences
in interfaceIEclipseMemory
- Parameters:
key
- the key of the preference to remove.
-
loadFromEclipsePreferences
Loads the value associated with the specified key from Eclipse's preferences storage.- Specified by:
loadFromEclipsePreferences
in interfaceIEclipseMemory
- Parameters:
key
- the key of the preference to load.- Returns:
- the value associated with the given key, or
null
if the key does not exist.
-
saveOnEclipsePreferences
Saves a key-value pair to Eclipse's preferences storage.This method associates the given key with the specified value and flushes the changes to ensure they are persisted.
- Specified by:
saveOnEclipsePreferences
in interfaceIEclipseMemory
- Parameters:
key
- the key of the preference to save.value
- the value to associate with the given key.
-