Author: max.andersen(a)jboss.com
Date: 2008-04-27 03:50:42 -0400 (Sun, 27 Apr 2008)
New Revision: 7836
Modified:
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java
Log:
JBIDE-2152 [Ganymede]The type Memento must implement the inherited abstract method
IMemento.*
Modified:
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java
===================================================================
---
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java 2008-04-26
17:06:25 UTC (rev 7835)
+++
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/Memento.java 2008-04-27
07:50:42 UTC (rev 7836)
@@ -36,14 +36,18 @@
private String id;
private HashMap map = new HashMap();
+ final private String type;
private static final String TEXT_DATA =
"org.jboss.tools.common.model.ui.forms.Memento.textData.id";
- private Memento() {}
+ private Memento() {
+ type = null;
+ }
- public Memento(String id) {
+ public Memento(String type, String id) {
ModelUIPlugin.getPluginLog().logInfo("new Memento("+id+")");
this.id = id;
+ this.type = type;
}
/* (non-Javadoc)
@@ -57,7 +61,7 @@
* @see org.eclipse.ui.IMemento#createChild(java.lang.String, java.lang.String)
*/
public IMemento createChild(String type, String id) {
- Memento newMemento = new Memento(id);
+ Memento newMemento = new Memento(type, id);
ArrayList list = (ArrayList)map.get(type);
if (list==null) {
list = new ArrayList();
@@ -219,4 +223,24 @@
}
public void store(IResource resource) {
}
+
+ @Override
+ public String[] getAttributeKeys() {
+ return (String[]) map.keySet().toArray(new String[0]);
+ }
+
+ @Override
+ public Boolean getBoolean(String key) {
+ return (Boolean)map.get(key);
+ }
+
+ @Override
+ public void putBoolean(String key, boolean value) {
+ map.put(key, value);
+ }
+
+ @Override
+ public String getType() {
+ return type;
+ }
}
Modified:
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java
===================================================================
---
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java 2008-04-26
17:06:25 UTC (rev 7835)
+++
branches/ganymede/trunk/common/plugins/org.jboss.tools.common.model.ui/src/org/jboss/tools/common/model/ui/forms/MementoDOM.java 2008-04-27
07:50:42 UTC (rev 7836)
@@ -14,7 +14,9 @@
import java.util.Hashtable;
import org.eclipse.ui.IMemento;
+import org.w3c.dom.Attr;
import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
@@ -174,4 +176,38 @@
private Element getElement() {
return element;
}
+
+ @Override
+ public String[] getAttributeKeys() {
+ NamedNodeMap map = element.getAttributes();
+ int size = map.getLength();
+ String[] attributes = new String[size];
+ for (int i = 0; i < size; i++) {
+ Node node = map.item(i);
+ attributes[i] = node.getNodeName();
+ }
+ return attributes;
+
+ }
+
+ @Override
+ public Boolean getBoolean(String key) {
+ String attr = getString(key);
+ if (attr == null) {
+ return null;
+ }
+ return Boolean.valueOf(attr);
+ }
+
+ @Override
+ public void putBoolean(String key, boolean value) {
+ putString(key, value ? "true" : "false"); //$NON-NLS-1$
//$NON-NLS-2$
+ }
+
+ @Override
+ public String getType() {
+ return getString(TYPE);
+ }
+
+
}
Show replies by date