1 11 package org.eclipse.pde.internal.ui.model.plugin; 12 13 import org.eclipse.pde.internal.ui.model.*; 14 import org.xml.sax.*; 15 16 public class NodeOffsetHandler extends AbstractPluginDocumentHandler { 17 18 21 public NodeOffsetHandler(PluginModelBase model) { 22 super(model); 23 } 24 25 28 public void startElement(String uri, String localName, String qName, 29 Attributes attributes) throws SAXException { 30 super.startElement(uri, localName, qName, attributes); 31 IDocumentNode node = (IDocumentNode)fDocumentNodeStack.peek(); 32 IDocumentAttribute[] attrs = node.getNodeAttributes(); 33 for (int i = 0; i < attrs.length; i++) { 34 } 37 } 38 41 protected IDocumentNode getDocumentNode(String name, IDocumentNode parent) { 42 IDocumentNode node = null; 43 if (parent == null) { 44 node = (IDocumentNode)getModel().getPluginBase(); 45 node.setOffset(-1); 46 node.setLength(-1); 47 } else { 48 IDocumentNode[] children = parent.getChildNodes(); 49 for (int i = 0; i < children.length; i++) { 50 if (children[i].getOffset() < 0) { 51 node = children[i]; 52 break; 53 } 54 } 55 } 56 57 IDocumentAttribute[] attrs = node.getNodeAttributes(); 58 for (int i = 0; i < attrs.length; i++) { 59 attrs[i].setNameOffset(-1); 60 attrs[i].setNameLength(-1); 61 attrs[i].setValueOffset(-1); 62 attrs[i].setValueLength(-1); 63 } 64 65 for (int i = 0; i < node.getChildNodes().length; i++) { 66 IDocumentNode child = node.getChildAt(i); 67 child.setOffset(-1); 68 child.setLength(-1); 69 } 70 71 return node; 72 } 73 74 77 protected void appendChildToParent(IDocumentNode parent, IDocumentNode child) { 78 } 79 80 83 protected IDocumentAttribute getDocumentAttribute(String name, 84 String value, IDocumentNode parent) { 85 return parent.getDocumentAttribute(name); 86 } 87 88 } 89 | Popular Tags |