| Summary: | [Workbench] XMLMemento method to enumerate all child nodes | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Christian Pontesegger <christian.pontesegger> | ||||||
| Component: | UI | Assignee: | Paul Webster <pwebster> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | enhancement | ||||||||
| Priority: | P3 | CC: | remy.suen | ||||||
| Version: | 4.1 | Keywords: | api | ||||||
| Target Milestone: | 4.2 M5 | ||||||||
| Hardware: | All | ||||||||
| OS: | All | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
If you'd like to add that method I'd consider a patch. You'd have to add the method in 3 places: org.eclipse.ui.IMemento org.eclipse.ui.XMLMemento org.eclipse.ui.internal.util.ConfigurationElementMemento They're all in org.eclipse.ui.workbench. See http://wiki.eclipse.org/Platform_UI/How_to_Contribute for how to contribute. PW org.eclipse.ui.tests.internal.TestMemento in the org.eclipse.ui.tests bundle will also have to be updated. Created attachment 209545 [details]
Patch containing getChildren() Method
So this is my first patch to eclipse. The file seems rather big. I hope I did this right.
(In reply to comment #3) > Created attachment 209545 [details] > Patch containing getChildren() Method > > So this is my first patch to eclipse. The file seems rather big. I hope I did > this right. Unfortunately, no. That looks like it contains a diff between 2 streams (hence the large file). Have a look at http://wiki.eclipse.org/Platform-releng/Git_Workflows#Create_a_patch You should be able to find the commit with only your changes in it in the History view. Then right-click on that commit and create a patch from that (just take the default, not a git format patch). It should only contain the changes from your one commit. Thank you, PW (In reply to comment #4) > You should be able to find the commit with only your changes in it in the > History view. Then right-click on that commit and create a patch from that > (just take the default, not a git format patch). It should only contain the > changes from your one commit. Did exactly that. I cloned the R3_development branch, added one method to 4 different files, opened history view, found my commit, right click -> create patch. Do I have to clone a different branch? (In reply to comment #5) > > Did exactly that. I cloned the R3_development branch, added one method to 4 > different files, opened history view, found my commit, right click -> create > patch. That's the right pattern (with a commit step between adding the methods and opening the history view). But the patch should be a small diff file, and yours has unrelated changes in it. After your commit, try going to the Git Repo Explorer, select your repo, and do Show In>History. If you create the patch from there, is it as big? You might have to reset your branch on origin/R3_development, pull, and add your changes back. > Do I have to clone a different branch? You're in the right branch. PW Created attachment 209893 [details] adding getChildren() for IMemento (In reply to comment #6) > After your commit, try going to the Git Repo Explorer, select your repo, and do > Show In>History. If you create the patch from there, is it as big? That did it, Thanks for providing a beginners git guide. Released to master PW In I20120123-2200 PW |
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