|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
java.lang.Objectorg.eclipse.jface.dialogs.DialogSettings
Concrete implementation of a dialog settings (IDialogSettings)
using a hash table and XML. The dialog store can be read
from and saved to a stream. All keys and values must be strings or array of
strings. Primitive types are converted to strings.
This class was not designed to be subclassed. Here is an example of using a DialogSettings:
DialogSettings settings = new DialogSettings("root");
settings.put("Boolean1",true);
settings.put("Long1",100);
settings.put("Array1",new String[]{"aaaa1","bbbb1","cccc1"});
DialogSettings section = new DialogSettings("sectionName");
settings.addSection(section);
section.put("Int2",200);
section.put("Float2",1.1);
section.put("Array2",new String[]{"aaaa2","bbbb2","cccc2"});
settings.save("c:\\temp\\test\\dialog.xml");
| Constructor Summary | |
|---|---|
DialogSettings(String sectionName)
Create an empty dialog settings which loads and saves its content to a file. |
|
| Method Summary | |
|---|---|
IDialogSettings |
addNewSection(String sectionName)
Create a new section in the receiver and return it. |
void |
addSection(IDialogSettings section)
Add a section in the receiver. |
String |
get(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. |
boolean |
getBoolean(String key)
Convenience API. |
double |
getDouble(String key)
Convenience API. |
float |
getFloat(String key)
Convenience API. |
int |
getInt(String key)
Convenience API. |
long |
getLong(String key)
Convenience API. |
String |
getName()
Returns the IDialogSettings name. |
IDialogSettings |
getSection(String sectionName)
Returns the section with the given name in this dialog settings. |
IDialogSettings[] |
getSections()
Returns all the sections in this dialog settings. |
void |
load(Reader r)
Load a dialog settings from a stream and fill the receiver with its content. |
void |
load(String fileName)
Load a dialog settings from a file and fill the receiver with its content. |
void |
put(String key,
boolean value)
Convenience API. |
void |
put(String key,
double value)
Convenience API. |
void |
put(String key,
float value)
Convenience API. |
void |
put(String key,
int value)
Convenience API. |
void |
put(String key,
long value)
Convenience API. |
void |
put(String key,
String value)
Adds the pair key/value to this dialog settings. |
void |
put(String key,
String[] value)
Adds the pair key/value to this dialog settings. |
void |
save(String fileName)
Save a dialog settings to a file. |
void |
save(Writer writer)
Save a dialog settings to a stream |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DialogSettings(String sectionName)
load(String) and store(String)
to load and store this dialog settings.
sectionName - the name of the section in the settings.| Method Detail |
public IDialogSettings addNewSection(String sectionName)
IDialogSettings
addNewSection in interface IDialogSettingssectionName - the name of the new section
public void addSection(IDialogSettings section)
IDialogSettings
addSection in interface IDialogSettingssection - the section to be addedpublic String get(String key)
IDialogSettings
get in interface IDialogSettingskey - the key
null if nonepublic String[] getArray(String key)
IDialogSettings
getArray in interface IDialogSettingskey - the key
null if nonepublic boolean getBoolean(String key)
IDialogSettings
getBoolean in interface IDialogSettingskey - the key
false if none
public double getDouble(String key)
throws NumberFormatException
IDialogSettings
getDouble in interface IDialogSettingskey - the key
NumberFormatException if none
NumberFormatException - if the string value does not contain a parsable number.Double.valueOf(java.lang.String)
public float getFloat(String key)
throws NumberFormatException
IDialogSettings
getFloat in interface IDialogSettingskey - the key
NumberFormatException if none
NumberFormatException - if the string value does not contain a parsable number.Float.valueOf(java.lang.String)
public int getInt(String key)
throws NumberFormatException
IDialogSettings
getInt in interface IDialogSettingskey - the key
NumberFormatException if none
NumberFormatException - if the string value does not contain a parsable number.Integer.valueOf(java.lang.String)
public long getLong(String key)
throws NumberFormatException
IDialogSettings
getLong in interface IDialogSettingskey - the key
NumberFormatException if none
NumberFormatException - if the string value does not contain a parsable number.Long.valueOf(java.lang.String)public String getName()
IDialogSettings
getName in interface IDialogSettingspublic IDialogSettings getSection(String sectionName)
IDialogSettings
getSection in interface IDialogSettingssectionName - the key
null if nonepublic IDialogSettings[] getSections()
IDialogSettings
getSections in interface IDialogSettingsnull if nonepublic void load(Reader r)
IDialogSettings
load in interface IDialogSettingsr - a Reader specifying the stream where the settings are read
from.
public void load(String fileName)
throws IOException
IDialogSettings
load in interface IDialogSettingsfileName - the name of the file the settings are read from.
IOException
public void put(String key,
String[] value)
IDialogSettingskey/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
double value)
IDialogSettingsvalue to a string and
adds the pair key/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
float value)
IDialogSettingsvalue to a string and
adds the pair key/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
int value)
IDialogSettingsvalue to a string and
adds the pair key/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
long value)
IDialogSettingsvalue to a string and
adds the pair key/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
String value)
IDialogSettingskey/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void put(String key,
boolean value)
IDialogSettingsvalue to a string
and adds the pair key/value to this dialog settings.
put in interface IDialogSettingskey - the key.value - the value to be associated with the key
public void save(Writer writer)
throws IOException
IDialogSettings
save in interface IDialogSettingswriter - a Writer specifying the stream the settings are written in.
IOException
public void save(String fileName)
throws IOException
IDialogSettings
save in interface IDialogSettingsfileName - the name of the file the settings are written in.
IOException
|
Eclipse Platform Release 3.3 |
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||||
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2007. All rights reserved.