1 11 package org.eclipse.pde.internal.core.text.plugin; 12 13 import org.eclipse.core.runtime.CoreException; 14 import org.eclipse.jface.text.IDocument; 15 import org.eclipse.pde.core.plugin.IPluginBase; 16 import org.eclipse.pde.internal.core.text.DocumentHandler; 17 import org.xml.sax.SAXException ; 18 19 public abstract class AbstractPluginDocumentHandler extends DocumentHandler { 20 21 private PluginModelBase fModel; 22 private String fSchemaVersion; 23 24 27 public AbstractPluginDocumentHandler(PluginModelBase model) { 28 fModel = model; 29 } 30 31 34 protected IDocument getDocument() { 35 return fModel.getDocument(); 36 } 37 38 41 public void endDocument() throws SAXException { 42 IPluginBase pluginBase = fModel.getPluginBase(); 43 try { 44 if (pluginBase != null) 45 pluginBase.setSchemaVersion(fSchemaVersion); 46 } catch (CoreException e) { 47 } 48 } 49 50 51 54 public void processingInstruction(String target, String data) throws SAXException { 55 if ("eclipse".equals(target)) { fSchemaVersion = "version=\"3.0\"".equals(data) ? "3.0" : "3.2"; } 58 } 59 60 63 public void startDocument() throws SAXException { 64 super.startDocument(); 65 fSchemaVersion = null; 66 } 67 protected PluginModelBase getModel() { 68 return fModel; 69 } 70 } 71 | Popular Tags |