001: /*******************************************************************************
002: * Copyright (c) 2000, 2007 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.pde.internal.core.text.plugin;
011:
012: import java.io.PrintWriter;
013:
014: import org.eclipse.core.runtime.CoreException;
015: import org.eclipse.pde.core.IModel;
016: import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
017: import org.eclipse.pde.internal.core.text.IDocumentElementNode;
018:
019: public class PluginExtensionPointNode extends PluginObjectNode
020: implements IPluginExtensionPoint {
021:
022: private static final long serialVersionUID = 1L;
023:
024: /*
025: * (non-Javadoc)
026: * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#getFullId()
027: */
028: public String getFullId() {
029: String id = getId();
030: String version = getPluginBase().getSchemaVersion();
031: if ("3.2".equals(version) && id != null && id.indexOf('.') != -1) //$NON-NLS-1$
032: return id;
033: String pluginID = getPluginBase().getId();
034: return (pluginID != null) ? pluginID + "." + id : id; //$NON-NLS-1$
035: }
036:
037: /* (non-Javadoc)
038: * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#getSchema()
039: */
040: public String getSchema() {
041: return getXMLAttributeValue("schema"); //$NON-NLS-1$
042: }
043:
044: /* (non-Javadoc)
045: * @see org.eclipse.pde.core.plugin.IPluginExtensionPoint#setSchema(java.lang.String)
046: */
047: public void setSchema(String schema) throws CoreException {
048: setXMLAttribute(P_SCHEMA, schema);
049: }
050:
051: /* (non-Javadoc)
052: * @see org.eclipse.pde.core.IIdentifiable#getId()
053: */
054: public String getId() {
055: return getXMLAttributeValue(P_ID);
056: }
057:
058: /* (non-Javadoc)
059: * @see org.eclipse.pde.core.IIdentifiable#setId(java.lang.String)
060: */
061: public void setId(String id) throws CoreException {
062: setXMLAttribute(P_ID, id);
063: }
064:
065: /* (non-Javadoc)
066: * @see org.eclipse.pde.core.plugin.IPluginObject#setName(java.lang.String)
067: */
068: public void setName(String name) throws CoreException {
069: setXMLAttribute(P_NAME, name);
070: }
071:
072: /* (non-Javadoc)
073: * @see org.eclipse.pde.core.plugin.IPluginObject#getName()
074: */
075: public String getName() {
076: return getXMLAttributeValue(P_NAME);
077: }
078:
079: /* (non-Javadoc)
080: * @see org.eclipse.pde.internal.ui.model.plugin.PluginObjectNode#write()
081: */
082: public String write(boolean indent) {
083: return indent ? getIndent() + writeShallow(true)
084: : writeShallow(true);
085: }
086:
087: /* (non-Javadoc)
088: * @see org.eclipse.pde.internal.ui.model.plugin.PluginObjectNode#writeShallow(boolean)
089: */
090: public String writeShallow(boolean terminate) {
091: StringBuffer buffer = new StringBuffer("<extension-point"); //$NON-NLS-1$
092: appendAttribute(buffer, P_ID);
093: appendAttribute(buffer, P_NAME);
094: appendAttribute(buffer, P_SCHEMA);
095:
096: if (terminate)
097: buffer.append("/"); //$NON-NLS-1$
098: buffer.append(">"); //$NON-NLS-1$
099: return buffer.toString();
100: }
101:
102: /* (non-Javadoc)
103: * @see org.eclipse.pde.internal.core.text.plugin.PluginObjectNode#reconnect(org.eclipse.pde.core.plugin.ISharedPluginModel, org.eclipse.pde.internal.core.ischema.ISchema, org.eclipse.pde.internal.core.text.IDocumentElementNode)
104: */
105: public void reconnect(IDocumentElementNode parent, IModel model) {
106: super .reconnect(parent, model);
107: }
108:
109: /* (non-Javadoc)
110: * @see org.eclipse.pde.internal.core.text.plugin.PluginObjectNode#write(java.lang.String, java.io.PrintWriter)
111: */
112: public void write(String indent, PrintWriter writer) {
113: // Used for text transfers for copy, cut, paste operations
114: writer.write(write(true));
115: }
116:
117: /* (non-Javadoc)
118: * @see org.eclipse.pde.internal.core.text.plugin.PluginObjectNode#writeDelimeter(java.io.PrintWriter)
119: */
120: public void writeDelimeter(PrintWriter writer) {
121: writer.println(getIndent());
122: }
123:
124: }
|