Class PreferenceBasedEObjectStore<T extends org.eclipse.emf.ecore.EObject>

java.lang.Object
com._1c.g5.v8.dt.internal.platform.services.core.PreferenceBasedEObjectStore<T>
Type Parameters:
T - the type of storing and loading objects

public class PreferenceBasedEObjectStore<T extends org.eclipse.emf.ecore.EObject> extends Object
Preference based store support class that allows to store and load content as collection of EObject in the Eclipse metadata preferences.
  • Field Details

    • DUPLICATE_PATTERN

      public static final Pattern DUPLICATE_PATTERN
      Duplicate pattern. May be used to check unique name generation matching.
  • Constructor Details

    • PreferenceBasedEObjectStore

      public PreferenceBasedEObjectStore(Class<T> storingClass, String preferenceKey)
      Creates an instance of PreferenceBasedEObjectStore.
      Parameters:
      storingClass - the storing and loading preferences class, cannot be null
      preferenceKey - the preferences key to use for storing and loading content, cannot be null
  • Method Details

    • loadFromPreferences

      public List<T> loadFromPreferences() throws IOException
      Loads a content list from preferences.
      Returns:
      the loaded content list, never null
      Throws:
      IOException - if load fails
    • storeToPreferences

      public void storeToPreferences(Collection<T> storingObjects) throws IOException
      Saves a collection of content to the preferences.
      Parameters:
      storingObjects - a collection of storing objects, cannot be null
      Throws:
      IOException - if save fails
    • createResource

      public org.eclipse.emf.ecore.resource.Resource createResource(String serializedResource) throws IOException
      Creates a resource by the serialized resource content.
      Parameters:
      serializedResource - the serialized resource content, cannot be null
      Returns:
      the created resource, never null
      Throws:
      IOException - if creating fails
    • getStoringPreferenceKey

      public String getStoringPreferenceKey()
      Returns the preferences key to use to store and load content.
      Returns:
      the preferences key to use, never null
    • getNodeQualifier

      protected String getNodeQualifier()
      Returns the Eclipse preferences node qualifier to use for preference storing.
      Returns:
      the Eclipse preferences node qualifier, never null