Class EclipseMemory

java.lang.Object
com.developer.nefarious.zjoule.plugin.memory.EclipseMemory
All Implemented Interfaces:
IEclipseMemory

public class EclipseMemory extends Object implements 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.

  • Constructor Details

    • EclipseMemory

      public EclipseMemory()
      Constructs a new EclipseMemory 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 interface IEclipseMemory
    • deleteFromEclipsePreferences

      public void deleteFromEclipsePreferences(String key)
      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 interface IEclipseMemory
      Parameters:
      key - the key of the preference to remove.
    • loadFromEclipsePreferences

      public String loadFromEclipsePreferences(String key)
      Loads the value associated with the specified key from Eclipse's preferences storage.
      Specified by:
      loadFromEclipsePreferences in interface IEclipseMemory
      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

      public void saveOnEclipsePreferences(String key, String value)
      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 interface IEclipseMemory
      Parameters:
      key - the key of the preference to save.
      value - the value to associate with the given key.