|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.eclipse.ui.XMLMemento
This class represents the default implementation of the
IMemento
interface.
This class is not intended to be extended by clients.
IMemento
Field Summary |
Fields inherited from interface org.eclipse.ui.IMemento |
TAG_ID |
Constructor Summary | |
XMLMemento(org.w3c.dom.Document document,
org.w3c.dom.Element element)
Creates a memento for the specified document and element. |
Method Summary | |
IMemento |
copyChild(IMemento child)
|
IMemento |
createChild(String type)
Creates a new child of this memento with the given type. |
IMemento |
createChild(String type,
String id)
Creates a new child of this memento with the given type and id. |
static XMLMemento |
createReadRoot(Reader reader)
Creates a Document from the Reader
and returns a memento on the first Element for reading
the document. |
static XMLMemento |
createWriteRoot(String type)
Returns a root memento for writing a document. |
IMemento |
getChild(String type)
Returns the first child with the given type id. |
IMemento[] |
getChildren(String type)
Returns all children with the given type id. |
Float |
getFloat(String key)
Returns the floating point value of the given key. |
String |
getID()
Returns the id for this memento. |
Integer |
getInteger(String key)
Returns the integer value of the given key. |
String |
getString(String key)
Returns the string value of the given key. |
String |
getTextData()
Returns the data of the Text node of the memento. |
void |
putFloat(String key,
float f)
Sets the value of the given key to the given floating point number. |
void |
putInteger(String key,
int n)
Sets the value of the given key to the given integer. |
void |
putMemento(IMemento memento)
Copy the attributes and children from memento
to the receiver. |
void |
putString(String key,
String value)
Sets the value of the given key to the given string. |
void |
putTextData(String data)
Sets the memento's Text node to contain the given data. |
void |
save(Writer writer)
Saves this memento's document current values to the specified writer. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public XMLMemento(org.w3c.dom.Document document, org.w3c.dom.Element element)
Clients should use createReadRoot
and
createWriteRoot
to create the initial
memento on a document.
document
- the document for the mementoelement
- the element node for the mementoMethod Detail |
public static XMLMemento createReadRoot(Reader reader) throws WorkbenchException
Document
from the Reader
and returns a memento on the first Element
for reading
the document.
reader
- the Reader
used to create the memento's document
Element
for reading the document
WorkbenchException
- if IO problems, invalid format, or no element.
WorkbenchException
public static XMLMemento createWriteRoot(String type)
type
- the element node type to create on the document
public IMemento createChild(String type)
IMemento
The getChild
and getChildren
methods
are used to retrieve children of a given type.
createChild
in interface IMemento
type
- the type
IMemento.getChild(java.lang.String)
,
IMemento.getChildren(java.lang.String)
public IMemento createChild(String type, String id)
IMemento
TAG_ID
) and can be retrieved using getId
.
The getChild
and getChildren
methods
are used to retrieve children of a given type.
createChild
in interface IMemento
type
- the typeid
- the child id
#getId
public IMemento copyChild(IMemento child)
public IMemento getChild(String type)
IMemento
getChild
in interface IMemento
type
- the type id
public IMemento[] getChildren(String type)
IMemento
getChildren
in interface IMemento
type
- the type id
public Float getFloat(String key)
IMemento
getFloat
in interface IMemento
key
- the key
null
if the key was not found or was found
but was not a floating point numberpublic String getID()
IMemento
[Issue: For consistency, rename to "getId".]
getID
in interface IMemento
null
if noneIMemento.createChild(java.lang.String,java.lang.String)
public Integer getInteger(String key)
IMemento
getInteger
in interface IMemento
key
- the key
null
if the key was not found or was found
but was not an integerpublic String getString(String key)
IMemento
getString
in interface IMemento
key
- the key
null
if the key was not found or was found
but was not an integerpublic String getTextData()
IMemento
getTextData
in interface IMemento
null
if the memento has no Text node.public void putFloat(String key, float f)
IMemento
putFloat
in interface IMemento
key
- the keyf
- the valuepublic void putInteger(String key, int n)
IMemento
putInteger
in interface IMemento
key
- the keyn
- the valuepublic void putMemento(IMemento memento)
IMemento
memento
to the receiver.
putMemento
in interface IMemento
memento
- the IMemento to be copied.public void putString(String key, String value)
IMemento
putString
in interface IMemento
key
- the keyvalue
- the valuepublic void putTextData(String data)
IMemento
putTextData
in interface IMemento
data
- the data to be placed on the Text nodepublic void save(Writer writer) throws IOException
writer
- the writer used to save the memento's document
IOException
|
Eclipse Platform 2.0 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |