org.eclipse.cdt.utils.envvar

## Class PrefsStorableEnvironment

- java.lang.Object
- - org.eclipse.cdt.utils.envvar.StorableEnvironment
  - - org.eclipse.cdt.utils.envvar.PrefsStorableEnvironment

    public class PrefsStorableEnvironment
    extends StorableEnvironment

This class represents the set of environment variables that could be loaded and stored from a IEclipsePreferences store. It acts like an OverlayStore caching outstanding changes while not yet serialized, as well as responding to change in the Preference store itself. fCachedSerialEnv is a cache of the contents of the preference store fVariables (in parent) contains runtime added / changed variables fDeleteVaraibles contains delete variable names When serialize is called, all changes in Variables / Delete are serialized to the ISerializeInfo store, Cached is updated, and fVariables and fDeletedVariables cleared. StorableEnvironment stores the Preferences in a single XML encoded String in ISerializeInfo.getNode().get(ISerializeInfo.getName()) This class defaults to storing the environment as 'Raw' items in the Preferences under: ISerializeInfo.getNode().node(ISerializeInfo.getName())

Since:
  5.2
Restriction:
  This class is not intended to be subclassed by clients.
Restriction:
  This class is not intended to be instantiated by clients.

### Field Summary

Fields
`protected Set<String>` `fDeletedVariables` Set of 'deleted' variables (to be removed from the backing store)

### Fields inherited from class org.eclipse.cdt.utils.envvar.StorableEnvironment

`ENVIRONMENT_ELEMENT_NAME`

### Method Summary

All Methods Instance Methods Concrete Methods Deprecated Methods
`IEnvironmentVariable` `createVariable(String name, String value, int op, String delimiter)`
`boolean` `deleteAll()`
`IEnvironmentVariable` `deleteVariable(String name)`
`protected void` `finalize()`
`IEnvironmentVariable` `getVariable(String name)`
`boolean` `isDirty()` Returns the "dirty" state of the environment.
`void` `registerEnvironmentChangeListener(IEnvironmentChangeListener listener)` Adds a listener that will be notified of changes in environment variables.
`void` `restoreDefaults()`
`void` `serialize(ICStorageElement element)` Deprecated.
`void` `setAppendContributedEnvironment(boolean append)`
`void` `setAppendEnvironment(boolean append)`
`void` `unregisterEnvironmentChangeListener(IEnvironmentChangeListener listener)` Removes an environment variables change listener.

### Methods inherited from class org.eclipse.cdt.utils.envvar.StorableEnvironment

`appendContributedEnvironment, appendEnvironment, checkVariable, createVariable, createVariable, createVariable, createVriables, getVariables, isChanged, isReadOnly, setChanged, setDirty, setVariales`

### Methods inherited from class java.lang.Object

`clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Field Detail

#### fDeletedVariables

    protected Set<String> fDeletedVariables

Set of 'deleted' variables (to be removed from the backing store)

### Method Detail

#### serialize

    @Deprecated
    public void serialize(ICStorageElement element)

Deprecated.
Serialize the Storable environment into the ICStorageElement NB assumes that any variables part of the ISerializeInfo will continue to be serialized Use #serialize instead for persisting into the Preference store

Overrides:
  `serialize` in class `StorableEnvironment`
Parameters:
  `element` -

#### createVariable

    public IEnvironmentVariable createVariable(String name,
                                               String value,
                                               int op,
                                               String delimiter)

Overrides:
  `createVariable` in class `StorableEnvironment`

#### getVariable

    public IEnvironmentVariable getVariable(String name)

Overrides:
  `getVariable` in class `StorableEnvironment`
Parameters:
  `name` -
Returns:
  the environment variable with the given name, or null

#### deleteVariable

    public IEnvironmentVariable deleteVariable(String name)

Overrides:
  `deleteVariable` in class `StorableEnvironment`

#### deleteAll

    public boolean deleteAll()

Overrides:
  `deleteAll` in class `StorableEnvironment`

#### setAppendEnvironment

    public void setAppendEnvironment(boolean append)

Overrides:
  `setAppendEnvironment` in class `StorableEnvironment`

#### setAppendContributedEnvironment

    public void setAppendContributedEnvironment(boolean append)

Overrides:
  `setAppendContributedEnvironment` in class `StorableEnvironment`

#### restoreDefaults

    public void restoreDefaults()

Overrides:
  `restoreDefaults` in class `StorableEnvironment`

#### isDirty

    public boolean isDirty()

Description copied from class: `StorableEnvironment`
Returns the "dirty" state of the environment. If the dirty state is `true`, that means that the environment is out of synch with the repository and the environment needs to be serialized.
The dirty state is automatically set to `false` when the environment is serialized by calling the serialize() method

Overrides:
  `isDirty` in class `StorableEnvironment`
Returns:
  boolean

#### registerEnvironmentChangeListener

    public void registerEnvironmentChangeListener(IEnvironmentChangeListener listener)

Adds a listener that will be notified of changes in environment variables.

Parameters:
  `listener` - - the listener to add
Since:
  5.5

#### unregisterEnvironmentChangeListener

    public void unregisterEnvironmentChangeListener(IEnvironmentChangeListener listener)

Removes an environment variables change listener.

Parameters:
  `listener` - - the listener to remove.
Since:
  5.5

#### finalize

    protected void finalize()
                     throws Throwable

Overrides:
  `finalize` in class `Object`
Throws:
  `Throwable`