Eclipse Platform
Release 3.2

org.eclipse.jface.commands
Class PersistentState

java.lang.Object
  extended byorg.eclipse.core.commands.common.EventManager
      extended byorg.eclipse.core.commands.State
          extended byorg.eclipse.jface.commands.PersistentState
Direct Known Subclasses:
TextState, ToggleState

public abstract class PersistentState
extends State

This is a state that can be made persistent. A state is persisted to a preference store.

Clients may extend this class.

Since:
3.2

Constructor Summary
PersistentState()
           
 
Method Summary
abstract  void load(IPreferenceStore store, String preferenceKey)
          Loads this state from the preference store, given the location at which to look.
abstract  void save(IPreferenceStore store, String preferenceKey)
          Saves this state to the preference store, given the location at which to write.
 void setShouldPersist(boolean persisted)
          Sets whether this state should be persisted.
 boolean shouldPersist()
          Whether this state should be persisted.
 
Methods inherited from class org.eclipse.core.commands.State
addListener, dispose, fireStateChanged, getId, getValue, removeListener, setId, setValue
 
Methods inherited from class org.eclipse.core.commands.common.EventManager
addListenerObject, clearListeners, getListeners, isListenerAttached, removeListenerObject
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PersistentState

public PersistentState()
Method Detail

load

public abstract void load(IPreferenceStore store,
                          String preferenceKey)
Loads this state from the preference store, given the location at which to look. This method must be symmetric with a call to save(IPreferenceStore, String).

Parameters:
store - The store from which to read; must not be null.
preferenceKey - The key at which the state is stored; must not be null.

save

public abstract void save(IPreferenceStore store,
                          String preferenceKey)
Saves this state to the preference store, given the location at which to write. This method must be symmetric with a call to load(IPreferenceStore, String).

Parameters:
store - The store to which the state should be written; must not be null.
preferenceKey - The key at which the state should be stored; must not be null.

setShouldPersist

public void setShouldPersist(boolean persisted)
Sets whether this state should be persisted.

Parameters:
persisted - Whether this state should be persisted.

shouldPersist

public boolean shouldPersist()
Whether this state should be persisted. Subclasses should check this method before loading or saving.

Returns:
true if this state should be persisted; false otherwise.

Eclipse Platform
Release 3.2

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.