Package org.eclipse.jface.dialogs
Interface IDialogSettings
-
- All Known Implementing Classes:
DialogSettings
public interface IDialogSettingsAn interface to a storage mechanism for making dialog settings persistent. The store manages a collection of key/value pairs. The keys must be strings and the values can be either, strings or array of strings. Convenience API to convert primitive types to strings is provided.- See Also:
DialogSettings
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description IDialogSettingsaddNewSection(String name)Create a new section in the receiver and return it.voidaddSection(IDialogSettings section)Add a section in the receiver.Stringget(String key)Returns the value of the given key in this dialog settings.String[]getArray(String key)Returns the value, an array of strings, of the given key in this dialog settings.booleangetBoolean(String key)Convenience API.doublegetDouble(String key)Convenience API.floatgetFloat(String key)Convenience API.intgetInt(String key)Convenience API.longgetLong(String key)Convenience API.StringgetName()Returns the IDialogSettings name.IDialogSettingsgetSection(String sectionName)Returns the section with the given name in this dialog settings.IDialogSettings[]getSections()Returns all the sections in this dialog settings.voidload(Reader reader)Load a dialog settings from a stream and fill the receiver with its content.voidload(String fileName)Load a dialog settings from a file and fill the receiver with its content.voidput(String key, boolean value)Convenience API.voidput(String key, double value)Convenience API.voidput(String key, float value)Convenience API.voidput(String key, int value)Convenience API.voidput(String key, long value)Convenience API.voidput(String key, String value)Adds the pairkey/valueto this dialog settings.voidput(String key, String[] value)Adds the pairkey/valueto this dialog settings.voidsave(Writer writer)Save a dialog settings to a streamvoidsave(String fileName)Save a dialog settings to a file.
-
-
-
Method Detail
-
addNewSection
IDialogSettings addNewSection(String name)
Create a new section in the receiver and return it.- Parameters:
name- the name of the new section- Returns:
- the new section
- See Also:
DialogSettings.getOrCreateSection(IDialogSettings, String)
-
addSection
void addSection(IDialogSettings section)
Add a section in the receiver.- Parameters:
section- the section to be added
-
get
String get(String key)
Returns the value of the given key in this dialog settings.- Parameters:
key- the key- Returns:
- the value, or
nullif none
-
getArray
String[] getArray(String key)
Returns the value, an array of strings, of the given key in this dialog settings.- Parameters:
key- the key- Returns:
- the array of string, or
nullif none
-
getBoolean
boolean getBoolean(String key)
Convenience API. Convert the value of the given key in this dialog settings to a boolean and return it.- Parameters:
key- the key- Returns:
- the boolean value, or
falseif none
-
getDouble
double getDouble(String key) throws NumberFormatException
Convenience API. Convert the value of the given key in this dialog settings to a double and return it.- Parameters:
key- the key- Returns:
- the value coverted to double, or throws
NumberFormatExceptionif none - Throws:
NumberFormatException- if the string value does not contain a parsable number.- See Also:
Double.valueOf(java.lang.String)
-
getFloat
float getFloat(String key) throws NumberFormatException
Convenience API. Convert the value of the given key in this dialog settings to a float and return it.- Parameters:
key- the key- Returns:
- the value coverted to float, or throws
NumberFormatExceptionif none - Throws:
NumberFormatException- if the string value does not contain a parsable number.- See Also:
Float.valueOf(java.lang.String)
-
getInt
int getInt(String key) throws NumberFormatException
Convenience API. Convert the value of the given key in this dialog settings to a int and return it.- Parameters:
key- the key- Returns:
- the value coverted to int, or throws
NumberFormatExceptionif none - Throws:
NumberFormatException- if the string value does not contain a parsable number.- See Also:
Integer.valueOf(java.lang.String)
-
getLong
long getLong(String key) throws NumberFormatException
Convenience API. Convert the value of the given key in this dialog settings to a long and return it.- Parameters:
key- the key- Returns:
- the value coverted to long, or throws
NumberFormatExceptionif none - Throws:
NumberFormatException- if the string value does not contain a parsable number.- See Also:
Long.valueOf(java.lang.String)
-
getName
String getName()
Returns the IDialogSettings name.- Returns:
- the name
-
getSection
IDialogSettings getSection(String sectionName)
Returns the section with the given name in this dialog settings.- Parameters:
sectionName- the key- Returns:
- IDialogSettings (the section), or
nullif none - See Also:
DialogSettings.getOrCreateSection(IDialogSettings, String)
-
getSections
IDialogSettings[] getSections()
Returns all the sections in this dialog settings.- Returns:
- the section, or
nullif none
-
load
void load(Reader reader) throws IOException
Load a dialog settings from a stream and fill the receiver with its content.- Parameters:
reader- a Reader specifying the stream where the settings are read from.- Throws:
IOException
-
load
void load(String fileName) throws IOException
Load a dialog settings from a file and fill the receiver with its content.- Parameters:
fileName- the name of the file the settings are read from.- Throws:
IOException
-
put
void put(String key, String[] value)
Adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, double value)
Convenience API. Converts the doublevalueto a string and adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, float value)
Convenience API. Converts the floatvalueto a string and adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, int value)
Convenience API. Converts the intvalueto a string and adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, long value)
Convenience API. Converts the longvalueto a string and adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, String value)
Adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
put
void put(String key, boolean value)
Convenience API. Converts the booleanvalueto a string and adds the pairkey/valueto this dialog settings.- Parameters:
key- the key.value- the value to be associated with thekey
-
save
void save(Writer writer) throws IOException
Save a dialog settings to a stream- Parameters:
writer- a Writer specifying the stream the settings are written in.- Throws:
IOException
-
save
void save(String fileName) throws IOException
Save a dialog settings to a file.- Parameters:
fileName- the name of the file the settings are written in.- Throws:
IOException
-
-