KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > pde > internal > core > text > plugin > PluginExtensionPointNode


1 /*******************************************************************************
2  * Copyright (c) 2000, 2007 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.core.text.plugin;
12
13 import java.io.PrintWriter JavaDoc;
14
15 import org.eclipse.core.runtime.CoreException;
16 import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
17 import org.eclipse.pde.core.plugin.ISharedPluginModel;
18 import org.eclipse.pde.internal.core.text.IDocumentNode;
19
20 public class PluginExtensionPointNode extends PluginObjectNode implements
21         IPluginExtensionPoint, IDocumentExtensionPoint {
22
23     private static final long serialVersionUID = 1L;
24
25     /*
26      * (non-Javadoc)
27      * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#getFullId()
28      */

29     public String JavaDoc getFullId() {
30         String JavaDoc id = getId();
31         String JavaDoc version = getPluginBase().getSchemaVersion();
32         if ("3.2".equals(version) && id != null && id.indexOf('.') != -1) //$NON-NLS-1$
33
return id;
34         String JavaDoc pluginID = getPluginBase().getId();
35         return (pluginID != null) ? pluginID + "." + id : id; //$NON-NLS-1$
36
}
37     /* (non-Javadoc)
38      * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#getSchema()
39      */

40     public String JavaDoc getSchema() {
41         return getXMLAttributeValue("schema"); //$NON-NLS-1$
42
}
43     /* (non-Javadoc)
44      * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#setSchema(java.lang.String)
45      */

46     public void setSchema(String JavaDoc schema) throws CoreException {
47         setXMLAttribute(P_SCHEMA, schema);
48     }
49     /* (non-Javadoc)
50      * @see org.eclipse.pde.core.IIdentifiable#getId()
51      */

52     public String JavaDoc getId() {
53         return getXMLAttributeValue(P_ID);
54     }
55     /* (non-Javadoc)
56      * @see org.eclipse.pde.core.IIdentifiable#setId(java.lang.String)
57      */

58     public void setId(String JavaDoc id) throws CoreException {
59         setXMLAttribute(P_ID, id);
60     }
61     
62     /* (non-Javadoc)
63      * @see org.eclipse.pde.core.plugin.IPluginObject#setName(java.lang.String)
64      */

65     public void setName(String JavaDoc name) throws CoreException {
66         setXMLAttribute(P_NAME, name);
67     }
68     
69     /* (non-Javadoc)
70      * @see org.eclipse.pde.core.plugin.IPluginObject#getName()
71      */

72     public String JavaDoc getName() {
73         return getXMLAttributeValue(P_NAME);
74     }
75     
76     /* (non-Javadoc)
77      * @see org.eclipse.pde.internal.ui.model.plugin.PluginObjectNode#write()
78      */

79     public String JavaDoc write(boolean indent) {
80         return indent ? getIndent() + writeShallow(true) : writeShallow(true);
81     }
82     
83     /* (non-Javadoc)
84      * @see org.eclipse.pde.internal.ui.model.plugin.PluginObjectNode#writeShallow(boolean)
85      */

86     public String JavaDoc writeShallow(boolean terminate) {
87         StringBuffer JavaDoc buffer = new StringBuffer JavaDoc("<extension-point"); //$NON-NLS-1$
88
appendAttribute(buffer, P_ID);
89         appendAttribute(buffer, P_NAME);
90         appendAttribute(buffer, P_SCHEMA);
91
92         if (terminate)
93             buffer.append("/"); //$NON-NLS-1$
94
buffer.append(">"); //$NON-NLS-1$
95
return buffer.toString();
96     }
97     
98     /* (non-Javadoc)
99      * @see org.eclipse.pde.internal.core.text.plugin.IDocumentExtensionPoint#reconnect(org.eclipse.pde.core.plugin.ISharedPluginModel, org.eclipse.pde.internal.core.text.IDocumentNode)
100      */

101     public void reconnect(ISharedPluginModel model, IDocumentNode parent) {
102         super.reconnect(model, null, parent);
103     }
104     
105     /* (non-Javadoc)
106      * @see org.eclipse.pde.internal.core.text.plugin.PluginObjectNode#write(java.lang.String, java.io.PrintWriter)
107      */

108     public void write(String JavaDoc indent, PrintWriter JavaDoc writer) {
109         // Used for text transfers for copy, cut, paste operations
110
writer.write(write(true));
111     }
112     
113     /* (non-Javadoc)
114      * @see org.eclipse.pde.internal.core.text.plugin.PluginObjectNode#writeDelimeter(java.io.PrintWriter)
115      */

116     public void writeDelimeter(PrintWriter JavaDoc writer) {
117         writer.println(getIndent());
118     }
119     
120 }
121
Popular Tags