Package com.iizigo.prop
Class MementoPropAdapter
- java.lang.Object
- com.iizigo.prop.MementoPropAdapter
- All Implemented Interfaces:
org.eclipse.ui.IMemento
public class MementoPropAdapter extends java.lang.Object implements org.eclipse.ui.IMemento"Adapter" class that converts a property container to the Eclipseorg.eclipse.ui.IMemento.- Author:
- Christopher Mindus
Constructor Summary
Constructors Constructor Description MementoPropAdapter(IPropCnr cnr)Creates a wrapper around a property container.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.eclipse.ui.IMementocreateChild(java.lang.String type)Creates a new child of this memento with the given type.org.eclipse.ui.IMementocreateChild(java.lang.String type, java.lang.String id)Creates a new child of this memento with the given type and id.java.lang.String[]getAttributeKeys()Returns an array of all the attribute keys of the memento.java.lang.BooleangetBoolean(java.lang.String key)Returns the boolean value of the given key.org.eclipse.ui.IMementogetChild(java.lang.String type)Returns the first child with the given type id.org.eclipse.ui.IMemento[]getChildren()Returns all children of this node.org.eclipse.ui.IMemento[]getChildren(java.lang.String type)Returns all children with the given type id.java.lang.FloatgetFloat(java.lang.String key)Returns the floating point value of the given key.java.lang.StringgetID()Returns the id for this memento.java.lang.IntegergetInteger(java.lang.String key)Returns the integer value of the given key.java.lang.StringgetString(java.lang.String key)Returns the string value of the given key.java.lang.StringgetTextData()Returns the data of the Text node of the memento.java.lang.StringgetType()Returns the type for this memento.voidputBoolean(java.lang.String key, boolean value)Sets the value of the given key to the given boolean value.voidputFloat(java.lang.String key, float value)Sets the value of the given key to the given floating point number.voidputInteger(java.lang.String key, int value)Sets the value of the given key to the given integer.voidputMemento(org.eclipse.ui.IMemento memento)Copy the attributes and children frommementoto the receiver.voidputString(java.lang.String key, java.lang.String value)Sets the value of the given key to the given string.voidputTextData(java.lang.String data)Sets the memento's Text node to contain the given data.
Constructor Detail
MementoPropAdapter
public MementoPropAdapter(IPropCnr cnr)
Creates a wrapper around a property container.
Method Detail
createChild
public org.eclipse.ui.IMemento createChild(java.lang.String type)
Creates a new child of this memento with the given type.The
getChildandgetChildrenmethods are used to retrieve children of a given type.- Specified by:
createChildin interfaceorg.eclipse.ui.IMemento- Parameters:
type- The type.- Returns:
- A new child memento.
- See Also:
getChild(java.lang.String),getChildren()
createChild
public org.eclipse.ui.IMemento createChild(java.lang.String type, java.lang.String id)Creates a new child of this memento with the given type and id. The id is stored in the child memento (using a special reserved key,TAG_ID) and can be retrieved usinggetId.The
getChildandgetChildrenmethods are used to retrieve children of a given type.- Specified by:
createChildin interfaceorg.eclipse.ui.IMemento- Parameters:
type- The type.id- The child id.- Returns:
- A new child memento with the given type and id.
- See Also:
getID()
getChild
public org.eclipse.ui.IMemento getChild(java.lang.String type)
Returns the first child with the given type id.- Specified by:
getChildin interfaceorg.eclipse.ui.IMemento- Parameters:
type- The type id.- Returns:
- the first child with the given type. May return
null.
getChildren
public org.eclipse.ui.IMemento[] getChildren()
Returns all children of this node.- Specified by:
getChildrenin interfaceorg.eclipse.ui.IMemento- Returns:
- An array of children of this node. This will not be
null. If there are no children, an array of length zero will be returned.
getChildren
public org.eclipse.ui.IMemento[] getChildren(java.lang.String type)
Returns all children with the given type id.- Specified by:
getChildrenin interfaceorg.eclipse.ui.IMemento- Parameters:
type- The type id.- Returns:
- an array of children with the given type. This will not be
null. If there are no keys, an array of length zero will be returned.
getFloat
public java.lang.Float getFloat(java.lang.String key)
Returns the floating point value of the given key.- Specified by:
getFloatin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.- Returns:
- the value, or
nullif the key was not found or was found but was not a floating point number.
getType
public java.lang.String getType()
Returns the type for this memento.- Specified by:
getTypein interfaceorg.eclipse.ui.IMemento- Returns:
- The memento type.
- See Also:
createChild(java.lang.String),createChild(java.lang.String,java.lang.String)
getID
public java.lang.String getID()
Returns the id for this memento.- Specified by:
getIDin interfaceorg.eclipse.ui.IMemento- Returns:
- The memento id, or
nullif none. - See Also:
createChild(java.lang.String,java.lang.String)
getInteger
public java.lang.Integer getInteger(java.lang.String key)
Returns the integer value of the given key.- Specified by:
getIntegerin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.- Returns:
- The value, or
nullif the key was not found or was found but was not an integer.
getString
public java.lang.String getString(java.lang.String key)
Returns the string value of the given key.- Specified by:
getStringin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.- Returns:
- The value, or
nullif the key was not found.
getBoolean
public java.lang.Boolean getBoolean(java.lang.String key)
Returns the boolean value of the given key.- Specified by:
getBooleanin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.- Returns:
- The value, or
nullif the key was not found.
getTextData
public java.lang.String getTextData()
Returns the data of the Text node of the memento. Each memento is allowed only one Text node.- Specified by:
getTextDatain interfaceorg.eclipse.ui.IMemento- Returns:
- The data of the Text node of the memento, or
nullif the memento has no Text node.
getAttributeKeys
public java.lang.String[] getAttributeKeys()
Returns an array of all the attribute keys of the memento. This will not benull. If there are no keys, an array of length zero will be returned.- Specified by:
getAttributeKeysin interfaceorg.eclipse.ui.IMemento- Returns:
- An array with all the attribute keys of the memento.
putFloat
public void putFloat(java.lang.String key, float value)Sets the value of the given key to the given floating point number.- Specified by:
putFloatin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.value- The value.
putInteger
public void putInteger(java.lang.String key, int value)Sets the value of the given key to the given integer.- Specified by:
putIntegerin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.value- The value.
putMemento
public void putMemento(org.eclipse.ui.IMemento memento)
Copy the attributes and children frommementoto the receiver.- Specified by:
putMementoin interfaceorg.eclipse.ui.IMemento- Parameters:
memento- The IzMemento to be copied.
putString
public void putString(java.lang.String key, java.lang.String value)Sets the value of the given key to the given string.- Specified by:
putStringin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.value- The value.
putBoolean
public void putBoolean(java.lang.String key, boolean value)Sets the value of the given key to the given boolean value.- Specified by:
putBooleanin interfaceorg.eclipse.ui.IMemento- Parameters:
key- The key.value- The value.
putTextData
public void putTextData(java.lang.String data)
Sets the memento's Text node to contain the given data. Creates the Text node if none exists. If a Text node does exist, it's current contents are replaced. Each memento is allowed only one text node.- Specified by:
putTextDatain interfaceorg.eclipse.ui.IMemento- Parameters:
data- The data to be placed on the Text node.