001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 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.core.plugin;
011:
012: import org.eclipse.core.runtime.CoreException;
013:
014: /**
015: * Classes that implement this interface model the
016: * XML elements found in the plug-in model.
017: */
018: public interface IPluginElement extends IPluginParent {
019: /**
020: * A property name that will be used to notify
021: * about element body text change.
022: */
023: String P_TEXT = "text"; //$NON-NLS-1$
024: /**
025: * A property name that will be used to notify
026: * about global replacement of the element's attributes.
027: */
028: String P_ATTRIBUTES = "attributes"; //$NON-NLS-1$
029:
030: /**
031: * A property name that will be used to notify individual
032: * change in an element's attribute.
033: */
034: String P_ATTRIBUTE = "attribute"; //$NON-NLS-1$
035:
036: /**
037: * Creates an identical copy of this XML element.
038: * The new element will share the same model and
039: * the parent.
040: *
041: * @return a copy of this element
042: */
043: IPluginElement createCopy();
044:
045: /**
046: * Returns an attribute object whose name
047: * matches the provided name.
048: * @param name the name of the attribute
049: * @return the attribute object, or <samp>null</samp> if not found
050: */
051: IPluginAttribute getAttribute(String name);
052:
053: /**
054: * Returns all attributes currently defined in this element
055: * @return an array of attribute objects that belong to this element
056: */
057: IPluginAttribute[] getAttributes();
058:
059: /**
060: * Returns the number of attributes in this element.
061: * @return number of attributes defined in this element
062: */
063: int getAttributeCount();
064:
065: /**
066: * Returns the body text of this element.
067: *
068: * @return body text of this element or <samp>null</samp> if not set.
069: */
070: String getText();
071:
072: /**
073: * Returns the schema for this element.
074: * <p>This information is exposed here as implementation side-effect
075: * and should not be used by clients.
076: *
077: * @return the schema for this element or <samp>null</samp> if not found.
078: */
079: Object getElementInfo();
080:
081: /**
082: * Sets the attribute with the provided name
083: * to the provided value. If attribute object
084: * is not found, a new one will be created and
085: * its value set to the provided value.
086: * This method will throw a CoreException if
087: * the model is not editable.
088: *
089: * @param name the name of the attribute
090: * @param value the value to be set
091: */
092: void setAttribute(String name, String value) throws CoreException;
093:
094: /**
095: * Sets the body text of this element
096: * to the provided value. This method
097: * will throw a CoreException if the
098: * model is not editable.
099: *
100: * @param text the new body text of this element
101: */
102: void setText(String text) throws CoreException;
103: }
|