KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > ui > model > plugin > AbstractPluginDocumentHandler


1 /*******************************************************************************
2  * Copyright (c) 2003, 2004 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.pde.internal.ui.model.plugin;
12
13 import org.eclipse.core.runtime.*;
14 import org.eclipse.jface.text.*;
15 import org.eclipse.pde.core.plugin.*;
16 import org.eclipse.pde.internal.ui.model.*;
17 import org.xml.sax.SAXException JavaDoc;
18
19 public abstract class AbstractPluginDocumentHandler extends DocumentHandler {
20     
21     private PluginModelBase fModel;
22     private String JavaDoc fSchemaVersion;
23
24     /**
25      * @param model
26      */

27     public AbstractPluginDocumentHandler(PluginModelBase model) {
28         fModel = model;
29     }
30     
31     /* (non-Javadoc)
32      * @see org.eclipse.pde.internal.ui.model.plugin.DocumentHandler#getDocument()
33      */

34     protected IDocument getDocument() {
35         return fModel.getDocument();
36     }
37     
38     /* (non-Javadoc)
39      * @see org.xml.sax.helpers.DefaultHandler#endDocument()
40      */

41     public void endDocument() throws SAXException JavaDoc {
42         IPluginBase pluginBase = fModel.getPluginBase();
43         try {
44             if (pluginBase != null)
45                 pluginBase.setSchemaVersion(fSchemaVersion);
46         } catch (CoreException e) {
47         }
48     }
49     
50
51     /* (non-Javadoc)
52      * @see org.xml.sax.helpers.DefaultHandler#processingInstruction(java.lang.String, java.lang.String)
53      */

54     public void processingInstruction(String JavaDoc target, String JavaDoc data)
55             throws SAXException JavaDoc {
56         if ("eclipse".equals(target)) { //$NON-NLS-1$
57
fSchemaVersion = "3.0"; //$NON-NLS-1$
58
}
59     }
60     
61     /* (non-Javadoc)
62      * @see org.eclipse.pde.internal.ui.model.DocumentHandler#startDocument()
63      */

64     public void startDocument() throws SAXException JavaDoc {
65         super.startDocument();
66         fSchemaVersion = null;
67     }
68     protected PluginModelBase getModel() {
69         return fModel;
70     }
71 }
72
Popular Tags