|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.ui.XMLMemento
public final class 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(Document document,
Element element)
Creates a memento for the specified document and element. |
|
| Method Summary | |
|---|---|
IMemento |
copyChild(IMemento child)
Create a copy of the child node and append it to this node. |
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 |
createReadRoot(Reader reader,
String baseDir)
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. |
String[] |
getAttributeKeys()
Returns an array of all the attribute keys of the memento. |
Boolean |
getBoolean(String key)
Returns the boolean value of the given key. |
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. |
String |
getType()
Returns the type for this memento. |
void |
putBoolean(String key,
boolean value)
Sets the value of the given key to the given boolean value. |
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(Document document,
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 memento| Method 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.
Same as calling createReadRoot(reader, null)
reader - the Reader used to create the memento's document
Element for reading the document
WorkbenchException - if IO problems, invalid format, or no element.
public static XMLMemento createReadRoot(Reader reader,
String baseDir)
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 documentbaseDir - the directory used to resolve relative file names
in the XML document. This directory must exist and include the
trailing separator. The directory format, including the separators,
must be valid for the platform. Can be null if not
needed.
Element for reading the document
WorkbenchException - if IO problems, invalid format, or no element.
public static XMLMemento createWriteRoot(String type)
throws DOMException
type - the element node type to create on the document
DOMException
public IMemento createChild(String type)
throws DOMException
The getChild and getChildren methods are used
to retrieve children of a given type.
createChild in interface IMementotype - the type
DOMException - if the child cannot be createdgetChild(java.lang.String),
getChildren(java.lang.String)
public IMemento createChild(String type,
String id)
throws DOMException
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 IMementotype - the typeid - the child id
DOMException - if the child cannot be createdgetID()
public IMemento copyChild(IMemento child)
throws DOMException
child -
DOMException - if the child cannot be createdpublic IMemento getChild(String type)
IMemento
getChild in interface IMementotype - the type id
null
.public IMemento[] getChildren(String type)
IMemento
getChildren in interface IMementotype - the type id
null. If there are no keys, an array of length zero
will be returned.public Float getFloat(String key)
IMemento
getFloat in interface IMementokey - the key
null if the key was not found or was found
but was not a floating point numberpublic String getType()
IMemento
getType in interface IMementoIMemento.createChild(java.lang.String),
IMemento.createChild(java.lang.String,java.lang.String)public String getID()
IMemento
getID in interface IMementonull if noneIMemento.createChild(java.lang.String,java.lang.String)public Integer getInteger(String key)
IMemento
getInteger in interface IMementokey - 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 IMementokey - the key
null if the key was not foundpublic Boolean getBoolean(String key)
IMemento
getBoolean in interface IMementokey - the key
null if the key was not found
public String getTextData()
throws DOMException
getTextData in interface IMementonull if
the memento has no Text node.
DOMException - if the text node is too bigpublic String[] getAttributeKeys()
IMementonull. If there are no keys, an array of length zero will
be returned.
getAttributeKeys in interface IMemento
public void putFloat(String key,
float f)
throws DOMException
putFloat in interface IMementokey - the keyf - the value
DOMException - if the attribute cannot be set
public void putInteger(String key,
int n)
throws DOMException
putInteger in interface IMementokey - the keyn - the value
DOMException - if the attribute cannot be set
public void putMemento(IMemento memento)
throws DOMException
memento to the
receiver.
putMemento in interface IMementomemento - the IMemento to be copied.
DOMException - if the attributes or children cannot be copied to this node.
public void putString(String key,
String value)
throws DOMException
putString in interface IMementokey - the keyvalue - the value
DOMException - if the attribute cannot be set
public void putBoolean(String key,
boolean value)
throws DOMException
putBoolean in interface IMementokey - the keyvalue - the value
DOMException - if the attribute cannot be set
public void putTextData(String data)
throws DOMException
putTextData in interface IMementodata - the data to be placed on the Text node
DOMException - if the text node cannot be created under this node.
public void save(Writer writer)
throws IOException
writer - the writer used to save the memento's document
IOException - if there is a problem serializing the document to the stream.
|
Eclipse Platform Release 3.7 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2011. All rights reserved.