Project: Eclipse_Platform_UI
Bug 365181 [Workbench] XMLMemento method to enumerate all child nodes
Reported: 2011-11-30 07:38:50 | Status: verified fixed

Build Identifier: It would be great to have a method getChildren() that enumerates all children of a node. Something like: public IMemento[] getChildren() { final List<IMemento> result = new LinkedList<IMemento>(); // Get the nodes. final NodeList nodes = element.getChildNodes(); final int size = nodes.getLength(); if (size == 0) { return new IMemento[0]; } // Extract each node with given type. for (int nX = 0; nX < size; nX++) { final Node node = nodes.item(nX); if (node instanceof Element) result.add(new EnhancedXMLMemento(factory, (Element) node)); } return result.toArray(new IMemento[result.size()]); } Reproducible: Always

Files changed in fix:
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/util/ConfigurationElementMemento.java tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TestMemento.java