|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.core.commands.common.EventManager
org.mailster.gui.prefs.store.MailsterPrefStore
public class MailsterPrefStore
A concrete preference store implementation based on an internal
OrderedProperties object, with support for persisting the
non-default preference values to files or streams.
This class was not designed to be subclassed.
IPreferenceStore| Field Summary | |
|---|---|
private OrderedProperties |
defaultProperties
The mapping from preference name to default preference value (represented as strings); null if none. |
private boolean |
dirty
Indicates whether a value as been changed by setToDefault
or setValue; initially false. |
private java.lang.String |
filename
The file name used by the load method to load a property
file. |
static java.lang.String |
HEADER
The header inserted at top of the properties file. |
private OrderedProperties |
properties
The mapping from preference name to preference value (represented as strings). |
| Fields inherited from interface org.eclipse.jface.preference.IPreferenceStore |
|---|
BOOLEAN_DEFAULT_DEFAULT, DOUBLE_DEFAULT_DEFAULT, FALSE, FLOAT_DEFAULT_DEFAULT, INT_DEFAULT_DEFAULT, LONG_DEFAULT_DEFAULT, STRING_DEFAULT_DEFAULT, TRUE |
| Constructor Summary | |
|---|---|
private |
MailsterPrefStore()
Creates an empty preference store. |
|
MailsterPrefStore(java.lang.String filename)
Creates an empty preference store that loads from and saves to the a file. |
| Method Summary | |
|---|---|
void |
addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
|
boolean |
contains(java.lang.String name)
|
void |
firePropertyChangeEvent(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
|
private boolean |
getBoolean(java.util.Properties p,
java.lang.String name)
Helper function: gets boolean for a given name. |
boolean |
getBoolean(java.lang.String name)
|
boolean |
getDefaultBoolean(java.lang.String name)
|
double |
getDefaultDouble(java.lang.String name)
|
float |
getDefaultFloat(java.lang.String name)
|
int |
getDefaultInt(java.lang.String name)
|
long |
getDefaultLong(java.lang.String name)
|
java.lang.String |
getDefaultString(java.lang.String name)
|
private double |
getDouble(java.util.Properties p,
java.lang.String name)
Helper function: gets double for a given name. |
double |
getDouble(java.lang.String name)
|
private float |
getFloat(java.util.Properties p,
java.lang.String name)
Helper function: gets float for a given name. |
float |
getFloat(java.lang.String name)
|
private int |
getInt(java.util.Properties p,
java.lang.String name)
Helper function: gets int for a given name. |
int |
getInt(java.lang.String name)
|
private long |
getLong(java.util.Properties p,
java.lang.String name)
Helper function: gets long for a given name. |
long |
getLong(java.lang.String name)
|
private java.lang.String |
getString(java.util.Properties p,
java.lang.String name)
Helper function: gets string for a given name. |
java.lang.String |
getString(java.lang.String name)
|
boolean |
isDefault(java.lang.String name)
|
void |
list(java.io.PrintStream out)
Prints the contents of this preference store to the given print stream. |
void |
list(java.io.PrintWriter out)
Prints the contents of this preference store to the given print writer. |
void |
load()
Loads this preference store from the file established in the constructor PreferenceStore(java.lang.String) (or by
setFileName). |
void |
load(java.io.InputStream in)
Loads this preference store from the given input stream. |
boolean |
needsSaving()
|
java.lang.String[] |
preferenceNames()
Returns an enumeration of all preferences known to this store which have current values other than their default value. |
void |
putValue(java.lang.String name,
java.lang.String value)
|
void |
removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
|
void |
save()
Saves the non-default-valued preferences known to this preference store to the file from which they were originally loaded. |
void |
save(java.io.OutputStream out,
java.lang.String header)
Saves this preference store to the given output stream. |
void |
setDefault(java.lang.String name,
boolean value)
|
void |
setDefault(java.lang.String name,
double value)
|
void |
setDefault(java.lang.String name,
float value)
|
void |
setDefault(java.lang.String name,
int value)
|
void |
setDefault(java.lang.String name,
long value)
|
void |
setDefault(java.lang.String name,
java.lang.String value)
|
void |
setFilename(java.lang.String name)
Sets the name of the file used when loading and storing this preference store. |
void |
setToDefault(java.lang.String name)
|
private void |
setValue(java.util.Properties p,
java.lang.String name,
boolean value)
Helper method: sets the value for a given name. |
private void |
setValue(java.util.Properties p,
java.lang.String name,
double value)
Helper method: sets value for a given name. |
private void |
setValue(java.util.Properties p,
java.lang.String name,
float value)
Helper method: sets value for a given name. |
private void |
setValue(java.util.Properties p,
java.lang.String name,
int value)
Helper method: sets value for a given name. |
private void |
setValue(java.util.Properties p,
java.lang.String name,
long value)
Helper method: sets the value for a given name. |
private void |
setValue(java.util.Properties p,
java.lang.String name,
java.lang.String value)
Helper method: sets the value for a given name. |
void |
setValue(java.lang.String name,
boolean value)
|
void |
setValue(java.lang.String name,
double value)
|
void |
setValue(java.lang.String name,
float value)
|
void |
setValue(java.lang.String name,
int value)
|
void |
setValue(java.lang.String name,
long value)
|
void |
setValue(java.lang.String name,
java.lang.String value)
|
| 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 |
| Field Detail |
|---|
public static final java.lang.String HEADER
private OrderedProperties properties
private OrderedProperties defaultProperties
null if none.
private boolean dirty
setToDefault
or setValue; initially false.
private java.lang.String filename
load method to load a property
file. This filename is used to save the properties file when
save is called.
| Constructor Detail |
|---|
private MailsterPrefStore()
Use the methods load(InputStream) and
save(InputStream) to load and store this preference store.
load(InputStream),
save(OutputStream, String)public MailsterPrefStore(java.lang.String filename)
Use the methods load() and save() to load
and store this preference store.
filename - the file nameload(),
save()| Method Detail |
|---|
public void addPropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
addPropertyChangeListener in interface org.eclipse.jface.preference.IPreferenceStorepublic boolean contains(java.lang.String name)
contains in interface org.eclipse.jface.preference.IPreferenceStore
public void firePropertyChangeEvent(java.lang.String name,
java.lang.Object oldValue,
java.lang.Object newValue)
firePropertyChangeEvent in interface org.eclipse.jface.preference.IPreferenceStorepublic boolean getBoolean(java.lang.String name)
getBoolean in interface org.eclipse.jface.preference.IPreferenceStore
private boolean getBoolean(java.util.Properties p,
java.lang.String name)
p - name -
public boolean getDefaultBoolean(java.lang.String name)
getDefaultBoolean in interface org.eclipse.jface.preference.IPreferenceStorepublic double getDefaultDouble(java.lang.String name)
getDefaultDouble in interface org.eclipse.jface.preference.IPreferenceStorepublic float getDefaultFloat(java.lang.String name)
getDefaultFloat in interface org.eclipse.jface.preference.IPreferenceStorepublic int getDefaultInt(java.lang.String name)
getDefaultInt in interface org.eclipse.jface.preference.IPreferenceStorepublic long getDefaultLong(java.lang.String name)
getDefaultLong in interface org.eclipse.jface.preference.IPreferenceStorepublic java.lang.String getDefaultString(java.lang.String name)
getDefaultString in interface org.eclipse.jface.preference.IPreferenceStorepublic double getDouble(java.lang.String name)
getDouble in interface org.eclipse.jface.preference.IPreferenceStore
private double getDouble(java.util.Properties p,
java.lang.String name)
p - name -
public float getFloat(java.lang.String name)
getFloat in interface org.eclipse.jface.preference.IPreferenceStore
private float getFloat(java.util.Properties p,
java.lang.String name)
p - name -
public int getInt(java.lang.String name)
getInt in interface org.eclipse.jface.preference.IPreferenceStore
private int getInt(java.util.Properties p,
java.lang.String name)
p - name -
public long getLong(java.lang.String name)
getLong in interface org.eclipse.jface.preference.IPreferenceStore
private long getLong(java.util.Properties p,
java.lang.String name)
p - the propertiesname - the name of the property
public java.lang.String getString(java.lang.String name)
getString in interface org.eclipse.jface.preference.IPreferenceStore
private java.lang.String getString(java.util.Properties p,
java.lang.String name)
p - the propertiesname - the property name
public boolean isDefault(java.lang.String name)
isDefault in interface org.eclipse.jface.preference.IPreferenceStorepublic void list(java.io.PrintStream out)
out - the print streampublic void list(java.io.PrintWriter out)
out - the print writer
public void load()
throws java.io.IOException
PreferenceStore(java.lang.String) (or by
setFileName). Default preference values are not affected.
java.io.IOException - if there is a problem loading this store
public void load(java.io.InputStream in)
throws java.io.IOException
in - the input stream
java.io.IOException - if there is a problem loading this storepublic boolean needsSaving()
needsSaving in interface org.eclipse.jface.preference.IPreferenceStorepublic java.lang.String[] preferenceNames()
public void putValue(java.lang.String name,
java.lang.String value)
putValue in interface org.eclipse.jface.preference.IPreferenceStorepublic void removePropertyChangeListener(org.eclipse.jface.util.IPropertyChangeListener listener)
removePropertyChangeListener in interface org.eclipse.jface.preference.IPreferenceStore
public void save()
throws java.io.IOException
save in interface org.eclipse.jface.preference.IPersistentPreferenceStorejava.io.IOException - if there is a problem saving this store
public void save(java.io.OutputStream out,
java.lang.String header)
throws java.io.IOException
out - the output streamheader - the header
java.io.IOException - if there is a problem saving this store
public void setDefault(java.lang.String name,
double value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setDefault(java.lang.String name,
float value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setDefault(java.lang.String name,
int value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setDefault(java.lang.String name,
long value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setDefault(java.lang.String name,
java.lang.String value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setDefault(java.lang.String name,
boolean value)
setDefault in interface org.eclipse.jface.preference.IPreferenceStorepublic void setFilename(java.lang.String name)
Afterward, the methods load() and save()
can be used to load and store this preference store.
name - the file nameload(),
save()public void setToDefault(java.lang.String name)
setToDefault in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
double value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
float value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
int value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
long value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
java.lang.String value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
public void setValue(java.lang.String name,
boolean value)
setValue in interface org.eclipse.jface.preference.IPreferenceStore
private void setValue(java.util.Properties p,
java.lang.String name,
double value)
p - name - value -
private void setValue(java.util.Properties p,
java.lang.String name,
float value)
p - name - value -
private void setValue(java.util.Properties p,
java.lang.String name,
int value)
p - name - value -
private void setValue(java.util.Properties p,
java.lang.String name,
long value)
p - name - value -
private void setValue(java.util.Properties p,
java.lang.String name,
java.lang.String value)
p - name - value -
private void setValue(java.util.Properties p,
java.lang.String name,
boolean value)
p - name - value -
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||