org.eclipse.pde.core_3.7.1.v20120103_r372

    if ((pluginVersion != null) && (pluginVersion.trim().length() > 0)) {
      result.add("   plugin-version=\"" + pluginVersion + "\"");
    }
    String match = getXMLAttributeValue("match");
    if ((match != null) && (match.trim().length() > 0)) {
      result.add("   match=\"" + match + "\"");
    }
    return (String[])result.toArray(new String[result.size()]);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.FragmentNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.io.PrintWriter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.IPluginAttribute;
import org.eclipse.pde.internal.core.text.DocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;

public class PluginAttribute
  extends PluginObjectNode
  implements IPluginAttribute, IDocumentAttributeNode
{
  private static final long serialVersionUID = 1L;
  private DocumentAttributeNode fAttribute;
  private String fValue;
  
  public PluginAttribute()
  {
    fAttribute = new DocumentAttributeNode();
    fValue = null;
  }
  
  public String getValue()
  {
    return fValue;
  }
  
  public void setValue(String value)
    throws CoreException
  {
    fValue = value;
  }
  
  public void setEnclosingElement(IDocumentElementNode node)
  {
    fAttribute.setEnclosingElement(node);
  }
  
  public IDocumentElementNode getEnclosingElement()
  {
    return fAttribute.getEnclosingElement();
  }
  
  public void setNameOffset(int offset)
  {
    fAttribute.setNameOffset(offset);
  }
  
  public int getNameOffset()
  {
    return fAttribute.getNameOffset();
  }
  
  public void setNameLength(int length)
  {
    fAttribute.setNameLength(length);
  }
  
  public int getNameLength()
  {
    return fAttribute.getNameLength();
  }
  
  public void setValueOffset(int offset)
  {
    fAttribute.setValueOffset(offset);
  }
  
  public int getValueOffset()
  {
    return fAttribute.getValueOffset();
  }
  
  public void setValueLength(int length)
  {
    fAttribute.setValueLength(length);
  }
  
  public int getValueLength()
  {
    return fAttribute.getValueLength();
  }
  
  public String getAttributeName()
  {
    return getName();
  }
  
  public String getAttributeValue()
  {
    return getValue();
  }
  
  public String write()
  {
    return getName() + "=\"" + getWritableString(getValue()) + "\"";
  }
  
  public String getWritableString(String source)
  {
    return 
      super.getWritableString(source).replaceAll("\\r", "
").replaceAll("\\n", "
");
  }
  
  public void setAttributeName(String name)
    throws CoreException
  {
    setName(name);
  }
  
  public void setAttributeValue(String value)
    throws CoreException
  {
    setValue(value);
  }
  
  public void reconnect(IDocumentElementNode parent)
  {
    super.reconnect(parent, getModel());
    fAttribute.reconnect(parent);
  }
  
  public void write(String indent, PrintWriter writer)
  {
    writer.write(write());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginAttribute
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
import org.eclipse.pde.core.plugin.IPluginImport;
import org.eclipse.pde.core.plugin.IPluginLibrary;
import org.eclipse.pde.core.plugin.IPluginObject;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;

public abstract class PluginBaseNode
  extends PluginObjectNode
  implements IPluginBase
{
  private static final long serialVersionUID = 1L;
  private String fSchemaVersion;
  
  public void add(IPluginLibrary library)
    throws CoreException
  {
    IDocumentElementNode parent = getEnclosingElement("runtime", true);
    if ((library instanceof PluginLibraryNode))
    {
      PluginLibraryNode node = (PluginLibraryNode)library;
      node.setModel(getModel());
      parent.addChildNode(node);
      fireStructureChanged(library, 1);
    }
  }
  
  public void add(IPluginImport pluginImport)
    throws CoreException
  {
    IDocumentElementNode parent = getEnclosingElement("requires", true);
    if ((pluginImport instanceof PluginImportNode))
    {
      PluginImportNode node = (PluginImportNode)pluginImport;
      parent.addChildNode(node);
      fireStructureChanged(pluginImport, 1);
    }
  }
  
  public void add(IPluginImport[] pluginImports)
  {
    IDocumentElementNode parent = getEnclosingElement("requires", true);
    for (int i = 0; i < pluginImports.length; i++) {
      if ((pluginImports[i] != null) && ((pluginImports[i] instanceof PluginImportNode)))
      {
        PluginImportNode node = (PluginImportNode)pluginImports[i];
        parent.addChildNode(node);
      }
    }
    fireStructureChanged(pluginImports, 1);
  }
  
  public void remove(IPluginImport pluginImport)
    throws CoreException
  {
    IDocumentElementNode parent = getEnclosingElement("requires", false);
    if (parent != null)
    {
      parent.removeChildNode((IDocumentElementNode)pluginImport);
      pluginImport.setInTheModel(false);
      fireStructureChanged(pluginImport, 2);
    }
  }
  
  public void remove(IPluginImport[] pluginImports)
  {
    IDocumentElementNode parent = getEnclosingElement("requires", false);
    if (parent != null)
    {
      for (int i = 0; i < pluginImports.length; i++)
      {
        parent.removeChildNode((IDocumentElementNode)pluginImports[i]);
        pluginImports[i].setInTheModel(false);
      }
      fireStructureChanged(pluginImports, 2);
    }
  }
  
  public IPluginLibrary[] getLibraries()
  {
    ArrayList result = new ArrayList();
    IDocumentElementNode requiresNode = getEnclosingElement("runtime", false);
    if (requiresNode != null)
    {
      IDocumentElementNode[] children = requiresNode.getChildNodes();
      for (int i = 0; i < children.length; i++) {
        if ((children[i] instanceof IPluginLibrary)) {
          result.add(children[i]);
        }
      }
    }
    return (IPluginLibrary[])result.toArray(new IPluginLibrary[result.size()]);
  }
  
  private IDocumentElementNode getEnclosingElement(String elementName, boolean create)
  {
    PluginElementNode element = null;
    IDocumentElementNode[] children = getChildNodes();
    for (int i = 0; i < children.length; i++) {
      if (((children[i] instanceof IPluginElement)) && 
        (((PluginElementNode)children[i]).getXMLTagName().equals(elementName)))
      {
        element = (PluginElementNode)children[i];
        break;
      }
    }
    if ((element == null) && (create))
    {
      element = new PluginElementNode();
      element.setXMLTagName(elementName);
      element.setParentNode(this);
      element.setModel(getModel());
      element.setInTheModel(true);
      if (elementName.equals("runtime")) {
        addChildNode(element, 0);
      } else if (elementName.equals("requires")) {
        if ((children.length > 0) && (children[0].getXMLTagName().equals("runtime"))) {
          addChildNode(element, 1);
        } else {
          addChildNode(element, 0);
        }
      }
    }
    return element;
  }
  
  public IPluginImport[] getImports()
  {
    ArrayList result = new ArrayList();
    IDocumentElementNode requiresNode = getEnclosingElement("requires", false);
    if (requiresNode != null)
    {
      IDocumentElementNode[] children = requiresNode.getChildNodes();
      for (int i = 0; i < children.length; i++) {
        if ((children[i] instanceof IPluginImport)) {
          result.add(children[i]);
        }
      }
    }
    return (IPluginImport[])result.toArray(new IPluginImport[result.size()]);
  }
  
  public String getProviderName()
  {
    return getXMLAttributeValue("provider-name");
  }
  
  public String getVersion()
  {
    return getXMLAttributeValue("version");
  }
  
  public void remove(IPluginLibrary library)
    throws CoreException
  {
    IDocumentElementNode parent = getEnclosingElement("runtime", false);
    if (parent != null)
    {
      parent.removeChildNode((IDocumentElementNode)library);
      library.setInTheModel(false);
      fireStructureChanged(library, 2);
    }
  }
  
  public void setProviderName(String providerName)
    throws CoreException
  {
    setXMLAttribute("provider-name", providerName);
  }
  
  public void setVersion(String version)
    throws CoreException
  {
    setXMLAttribute("version", version);
  }
  
  public void swap(IPluginLibrary l1, IPluginLibrary l2)
    throws CoreException
  {
    IDocumentElementNode node = getEnclosingElement("runtime", false);
    if (node != null)
    {
      node.swap((IDocumentElementNode)l1, (IDocumentElementNode)l2);
      firePropertyChanged(node, "library_order", l1, l2);
    }
  }
  
  public String getSchemaVersion()
  {
    return fSchemaVersion;
  }
  
  public void setSchemaVersion(String schemaVersion)
    throws CoreException
  {
    fSchemaVersion = schemaVersion;
  }
  
  public void add(IPluginExtension extension)
    throws CoreException
  {
    if ((extension instanceof PluginExtensionNode))
    {
      PluginExtensionNode node = (PluginExtensionNode)extension;
      node.setModel(getModel());
      addChildNode(node);
      fireStructureChanged(extension, 1);
    }
  }
  
  public void add(IPluginExtension extension, int position)
    throws CoreException
  {
    if (!(extension instanceof PluginExtensionNode)) {
      return;
    }
    if ((position < 0) || (position > getChildCount())) {
      return;
    }
    PluginExtensionNode node = (PluginExtensionNode)extension;
    node.setModel(getModel());
    addChildNode(node, position);
    fireStructureChanged(extension, 1);
  }
  
  public void add(IPluginExtensionPoint extensionPoint)
    throws CoreException
  {
    if ((extensionPoint instanceof PluginExtensionPointNode))
    {
      PluginExtensionPointNode node = (PluginExtensionPointNode)extensionPoint;
      node.setModel(getModel());
      extensionPoint.setInTheModel(true);
      node.setParentNode(this);
      IPluginExtensionPoint[] extPoints = getExtensionPoints();
      if (extPoints.length > 0)
      {
        addChildNode(node, indexOf((IDocumentElementNode)extPoints[(extPoints.length - 1)]) + 1);
      }
      else
      {
        IDocumentElementNode requires = getEnclosingElement("requires", false);
        if (requires != null)
        {
          addChildNode(node, indexOf(requires) + 1);
        }
        else
        {
          IDocumentElementNode runtime = getEnclosingElement("runtime", false);
          if (runtime != null) {
            addChildNode(node, indexOf(runtime) + 1);
          } else {
            addChildNode(node, 0);
          }
        }
      }
      fireStructureChanged(extensionPoint, 1);
    }
  }
  
  public IPluginExtensionPoint[] getExtensionPoints()
  {
    ArrayList result = new ArrayList();
    IDocumentElementNode[] children = getChildNodes();
    for (int i = 0; i < children.length; i++) {
      if ((children[i] instanceof IPluginExtensionPoint)) {
        result.add(children[i]);
      }
    }
    return (IPluginExtensionPoint[])result.toArray(new IPluginExtensionPoint[result.size()]);
  }
  
  public IPluginExtension[] getExtensions()
  {
    ArrayList result = new ArrayList();
    IDocumentElementNode[] children = getChildNodes();
    for (int i = 0; i < children.length; i++) {
      if ((children[i] instanceof IPluginExtension)) {
        result.add(children[i]);
      }
    }
    return (IPluginExtension[])result.toArray(new IPluginExtension[result.size()]);
  }
  
  public int getIndexOf(IPluginExtension e)
  {
    IPluginExtension[] children = getExtensions();
    for (int i = 0; i < children.length; i++) {
      if (children[i].equals(e)) {
        return i;
      }
    }
    return -1;
  }
  
  public void remove(IPluginExtension extension)
    throws CoreException
  {
    if ((extension instanceof IDocumentElementNode))
    {
      removeChildNode((IDocumentElementNode)extension);
      extension.setInTheModel(false);
      fireStructureChanged(extension, 2);
    }
  }
  
  public void remove(IPluginExtensionPoint extensionPoint)
    throws CoreException
  {
    if ((extensionPoint instanceof IDocumentElementNode))
    {
      removeChildNode((IDocumentElementNode)extensionPoint);
      extensionPoint.setInTheModel(false);
      fireStructureChanged(extensionPoint, 2);
    }
  }
  
  public void remove(IPluginObject node)
  {
    if ((node instanceof IDocumentElementNode))
    {
      removeChildNode((IDocumentElementNode)node);
      node.setInTheModel(false);
      fireStructureChanged(node, 2);
    }
  }
  
  public void swap(IPluginExtension e1, IPluginExtension e2)
    throws CoreException
  {
    swap((IDocumentElementNode)e1, (IDocumentElementNode)e2);
    firePropertyChanged(this, "extension_order", e1, e2);
  }
  
  public void swap(IPluginImport import1, IPluginImport import2)
    throws CoreException
  {
    IDocumentElementNode node = getEnclosingElement("requires", false);
    if (node != null)
    {
      node.swap((IDocumentElementNode)import1, (IDocumentElementNode)import2);
      firePropertyChanged(node, "import_order", import1, import2);
    }
  }
  
  public String getId()
  {
    return getXMLAttributeValue("id");
  }
  
  public void setId(String id)
    throws CoreException
  {
    setXMLAttribute("id", id);
  }
  
  public String getName()
  {
    return getXMLAttributeValue("name");
  }
  
  public void setName(String name)
    throws CoreException
  {
    setXMLAttribute("name", name);
  }
  
  public String write(boolean indent)
  {
    String newLine = getLineDelimiter();
    
    StringBuffer buffer = new StringBuffer();
    buffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + newLine);
    buffer.append("<?eclipse version=\"3.0\"?>" + newLine);
    
    buffer.append(writeShallow(false) + newLine);
    
    IDocumentElementNode runtime = getEnclosingElement("runtime", false);
    if (runtime != null)
    {
      runtime.setLineIndent(getLineIndent() + 3);
      buffer.append(runtime.write(true) + newLine);
    }
    IDocumentElementNode requires = getEnclosingElement("requires", false);
    if (requires != null)
    {
      requires.setLineIndent(getLineIndent() + 3);
      buffer.append(requires.write(true) + newLine);
    }
    IPluginExtensionPoint[] extPoints = getExtensionPoints();
    for (int i = 0; i < extPoints.length; i++)
    {
      IDocumentElementNode extPoint = (IDocumentElementNode)extPoints[i];
      extPoint.setLineIndent(getLineIndent() + 3);
      buffer.append(extPoint.write(true) + newLine);
    }
    IPluginExtension[] extensions = getExtensions();
    for (int i = 0; i < extensions.length; i++)
    {
      IDocumentElementNode extension = (IDocumentElementNode)extensions[i];
      extension.setLineIndent(getLineIndent() + 3);
      buffer.append(extension.write(true) + newLine);
    }
    buffer.append("</" + getXMLTagName() + ">");
    return buffer.toString();
  }
  
  public String writeShallow(boolean terminate)
  {
    String newLine = System.getProperty("line.separator");
    StringBuffer buffer = new StringBuffer();
    buffer.append("<" + getXMLTagName());
    buffer.append(newLine);
    
    String id = getId();
    if ((id != null) && (id.trim().length() > 0)) {
      buffer.append("   id=\"" + getWritableString(id) + "\"" + newLine);
    }
    String name = getName();
    if ((name != null) && (name.trim().length() > 0)) {
      buffer.append("   name=\"" + getWritableString(name) + "\"" + newLine);
    }
    String version = getVersion();
    if ((version != null) && (version.trim().length() > 0)) {
      buffer.append("   version=\"" + getWritableString(version) + "\"" + newLine);
    }
    String provider = getProviderName();
    if ((provider != null) && (provider.trim().length() > 0)) {
      buffer.append("   provider-name=\"" + getWritableString(provider) + "\"");
    }
    String[] specific = getSpecificAttributes();
    for (int i = 0; i < specific.length; i++) {
      buffer.append(newLine + specific[i]);
    }
    if (terminate) {
      buffer.append("/");
    }
    buffer.append(">");
    
    return buffer.toString();
  }
  
  protected abstract String[] getSpecificAttributes();
  
  public boolean isRoot()
  {
    return true;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginBaseNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.internal.core.TargetPlatformHelper;
import org.eclipse.pde.internal.core.text.DocumentHandler;
import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
import org.eclipse.pde.internal.core.text.IDocumentTextNode;
import org.xml.sax.SAXException;

public class PluginDocumentHandler
  extends DocumentHandler
{
  private PluginModelBase fModel;
  private String fSchemaVersion;
  protected PluginDocumentNodeFactory fFactory;
  
  public PluginDocumentHandler(PluginModelBase model, boolean reconciling)
  {
    super(reconciling);
    fModel = model;
    fFactory = ((PluginDocumentNodeFactory)getModel().getPluginFactory());
  }
  
  protected IDocument getDocument()
  {
    return fModel.getDocument();
  }
  
  public void endDocument()
    throws SAXException
  {
    IPluginBase pluginBase = fModel.getPluginBase(false);
    try
    {
      if (pluginBase != null) {
        pluginBase.setSchemaVersion(fSchemaVersion);
      }
    }
    catch (CoreException localCoreException) {}
  }
  
  public void processingInstruction(String target, String data)
    throws SAXException
  {
    if ("eclipse".equals(target)) {
      if ((data.length() > 10) && (data.substring(0, 9).equals("version=\"")) && (data.charAt(data.length() - 1) == '"')) {
        fSchemaVersion = TargetPlatformHelper.getSchemaVersionForTargetVersion(data.substring(9, data.length() - 1));
      } else {
        fSchemaVersion = TargetPlatformHelper.getSchemaVersion();
      }
    }
  }
  
  public void startDocument()
    throws SAXException
  {
    super.startDocument();
    fSchemaVersion = null;
  }
  
  protected PluginModelBase getModel()
  {
    return fModel;
  }
  
  protected IDocumentElementNode getDocumentNode(String name, IDocumentElementNode parent)
  {
    IDocumentElementNode node = null;
    if (parent == null)
    {
      node = (IDocumentElementNode)getModel().getPluginBase(false);
      if (node != null)
      {
        node.setOffset(-1);
        node.setLength(-1);
      }
    }
    else
    {
      IDocumentElementNode[] children = parent.getChildNodes();
      for (int i = 0; i < children.length; i++) {
        if (children[i].getOffset() < 0)
        {
          if (!name.equals(children[i].getXMLTagName())) {
            break;
          }
          node = children[i];
          
          break;
        }
      }
    }
    if (node == null) {
      return fFactory.createDocumentNode(name, parent);
    }
    IDocumentAttributeNode[] attrs = node.getNodeAttributes();
    for (int i = 0; i < attrs.length; i++)
    {
      attrs[i].setNameOffset(-1);
      attrs[i].setNameLength(-1);
      attrs[i].setValueOffset(-1);
      attrs[i].setValueLength(-1);
    }
    for (int i = 0; i < node.getChildNodes().length; i++)
    {
      IDocumentElementNode child = node.getChildAt(i);
      child.setOffset(-1);
      child.setLength(-1);
    }
    if (isReconciling())
    {
      node.removeTextNode();
      node.setIsErrorNode(false);
    }
    return node;
  }
  
  protected IDocumentAttributeNode getDocumentAttribute(String name, String value, IDocumentElementNode parent)
  {
    IDocumentAttributeNode attr = parent.getDocumentAttribute(name);
    try
    {
      if (attr == null)
      {
        attr = fFactory.createAttribute(name, value, parent);
      }
      else
      {
        if (!name.equals(attr.getAttributeName())) {
          attr.setAttributeName(name);
        }
        if (!value.equals(attr.getAttributeValue())) {
          attr.setAttributeValue(value);
        }
      }
    }
    catch (CoreException localCoreException) {}
    return attr;
  }
  
  protected IDocumentTextNode getDocumentTextNode(String content, IDocumentElementNode parent)
  {
    IDocumentTextNode textNode = parent.getTextNode();
    if (textNode == null)
    {
      if (content.trim().length() > 0) {
        textNode = fFactory.createDocumentTextNode(content, parent);
      }
    }
    else
    {
      String newContent = textNode.getText() + content;
      textNode.setText(newContent);
    }
    return textNode;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginDocumentHandler
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.IPluginAttribute;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
import org.eclipse.pde.core.plugin.IPluginImport;
import org.eclipse.pde.core.plugin.IPluginLibrary;
import org.eclipse.pde.core.plugin.IPluginModelFactory;
import org.eclipse.pde.core.plugin.IPluginObject;
import org.eclipse.pde.internal.core.text.DocumentTextNode;
import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
import org.eclipse.pde.internal.core.text.IDocumentNodeFactory;
import org.eclipse.pde.internal.core.text.IDocumentTextNode;

public class PluginDocumentNodeFactory
  implements IPluginModelFactory, IDocumentNodeFactory
{
  private PluginModelBase fModel;
  
  public PluginDocumentNodeFactory(PluginModelBase model)
  {
    fModel = model;
  }
  
  public IDocumentElementNode createDocumentNode(String name, IDocumentElementNode parent)
  {
    if (parent == null) {
      return createPluginBase(name);
    }
    if ((parent instanceof PluginBaseNode))
    {
      if ("extension".equals(name)) {
        return (IDocumentElementNode)createExtension();
      }
      if ("extension-point".equals(name)) {
        return (IDocumentElementNode)createExtensionPoint();
      }
    }
    else if ((name.equals("import")) && ((parent instanceof PluginElementNode)))
    {
      if (((PluginElementNode)parent).getName().equals("requires"))
      {
        IDocumentElementNode ancestor = parent.getParentNode();
        if ((ancestor != null) && ((ancestor instanceof PluginBaseNode))) {
          return (IDocumentElementNode)createImport();
        }
      }
    }
    else if ((name.equals("library")) && ((parent instanceof PluginElementNode)) && 
      (((PluginElementNode)parent).getName().equals("runtime")))
    {
      IDocumentElementNode ancestor = parent.getParentNode();
      if ((ancestor != null) && ((ancestor instanceof PluginBaseNode))) {
        return (IDocumentElementNode)createLibrary();
      }
    }
    IDocumentElementNode node = (IDocumentElementNode)createElement((IPluginObject)parent);
    node.setXMLTagName(name);
    return node;
  }
  
  public IDocumentAttributeNode createAttribute(String name, String value, IDocumentElementNode enclosingElement)
  {
    PluginAttribute attribute = new PluginAttribute();
    try
    {
      attribute.setName(name);
      attribute.setValue(value);
    }
    catch (CoreException localCoreException) {}
    attribute.setEnclosingElement(enclosingElement);
    attribute.setModel(fModel);
    attribute.setInTheModel(true);
    return attribute;
  }
  
  private PluginBaseNode createPluginBase(String name)
  {
    return (PluginBaseNode)fModel.createPluginBase(name.equals("fragment"));
  }
  
  public IPluginImport createImport()
  {
    PluginImportNode node = new PluginImportNode();
    node.setModel(fModel);
    node.setXMLTagName("import");
    return node;
  }
  
  public IPluginImport createImport(String pluginId)
  {
    PluginImportNode node = new PluginImportNode(pluginId);
    node.setModel(fModel);
    node.setXMLTagName("import");
    return node;
  }
  
  public IPluginLibrary createLibrary()
  {
    PluginLibraryNode node = new PluginLibraryNode();
    node.setModel(fModel);
    node.setXMLTagName("library");
    return node;
  }
  
  public IPluginAttribute createAttribute(IPluginElement element)
  {
    return null;
  }
  
  public IPluginElement createElement(IPluginObject parent)
  {
    PluginElementNode node = new PluginElementNode();
    node.setModel(fModel);
    return node;
  }
  
  public IPluginExtension createExtension()
  {
    PluginExtensionNode node = new PluginExtensionNode();
    node.setModel(fModel);
    node.setXMLTagName("extension");
    return node;
  }
  
  public IPluginExtensionPoint createExtensionPoint()
  {
    PluginExtensionPointNode node = new PluginExtensionPointNode();
    node.setModel(fModel);
    node.setXMLTagName("extension-point");
    return node;
  }
  
  public IDocumentTextNode createDocumentTextNode(String content, IDocumentElementNode parent)
  {
    DocumentTextNode textNode = new DocumentTextNode();
    textNode.setEnclosingElement(parent);
    parent.addTextNode(textNode);
    textNode.setText(content.trim());
    return textNode;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginDocumentNodeFactory
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.io.PrintWriter;
import java.util.Collection;
import java.util.TreeMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.core.plugin.IPluginAttribute;
import org.eclipse.pde.core.plugin.IPluginElement;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.internal.core.ischema.ISchema;
import org.eclipse.pde.internal.core.ischema.ISchemaElement;
import org.eclipse.pde.internal.core.text.DocumentTextNode;
import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;
import org.eclipse.pde.internal.core.text.IDocumentTextNode;

public class PluginElementNode
  extends PluginParentNode
  implements IPluginElement
{
  private static final long serialVersionUID = 1L;
  private transient ISchemaElement elementInfo;
  
  public IPluginElement createCopy()
  {
    return null;
  }
  
  public IPluginAttribute getAttribute(String name)
  {
    return (IPluginAttribute)getNodeAttributesMap().get(name);
  }
  
  public IPluginAttribute[] getAttributes()
  {
    return (IPluginAttribute[])getNodeAttributesMap().values().toArray(new IPluginAttribute[getNodeAttributesMap().size()]);
  }
  
  public int getAttributeCount()
  {
    return getNodeAttributesMap().size();
  }
  
  public String getText()
  {
    IDocumentTextNode node = getTextNode();
    return node == null ? "" : node.getText();
  }
  
  public void setAttribute(String name, String value)
    throws CoreException
  {
    setXMLAttribute(name, value);
  }
  
  public void setText(String text)
    throws CoreException
  {
    IDocumentTextNode node = getTextNode();
    String oldText = node == null ? null : node.getText();
    if (node == null)
    {
      node = new DocumentTextNode();
      node.setEnclosingElement(this);
      addTextNode(node);
    }
    node.setText(text.trim());
    firePropertyChanged(node, "text", oldText, text);
  }
  
  public String write(boolean indent)
  {
    String sep = getLineDelimiter();
    StringBuffer buffer = new StringBuffer();
    if (indent) {
      buffer.append(getIndent());
    }
    IDocumentElementNode[] children = getChildNodes();
    String text = getText();
    buffer.append(writeShallow(false));
    if ((getAttributeCount() > 0) || (children.length > 0) || (text.length() > 0)) {
      buffer.append(sep);
    }
    if ((children.length > 0) || (text.length() > 0))
    {
      if (text.length() > 0)
      {
        buffer.append(getIndent());
        buffer.append("   ");
        buffer.append(text);
        buffer.append(sep);
      }
      for (int i = 0; i < children.length; i++)
      {
        children[i].setLineIndent(getLineIndent() + 3);
        buffer.append(children[i].write(true));
        buffer.append(sep);
      }
    }
    if ((getAttributeCount() > 0) || (children.length > 0) || (text.length() > 0)) {
      buffer.append(getIndent());
    }
    buffer.append("</" + getXMLTagName() + ">");
    return buffer.toString();
  }
  
  public String writeShallow(boolean terminate)
  {
    String sep = getLineDelimiter();
    StringBuffer buffer = new StringBuffer("<" + getXMLTagName());
    
    IDocumentAttributeNode[] attrs = getNodeAttributes();
    for (int i = 0; i < attrs.length; i++) {
      if (attrs[i].getAttributeValue().length() > 0) {
        buffer.append(sep + getIndent() + "      " + attrs[i].write());
      }
    }
    if (terminate) {
      buffer.append("/");
    }
    buffer.append(">");
    return buffer.toString();
  }
  
  public String getName()
  {
    return getXMLTagName();
  }
  
  public void setName(String name)
    throws CoreException
  {
    setXMLTagName(name);
  }
  
  public Object getElementInfo()
  {
    if (elementInfo == null)
    {
      IDocumentElementNode node = getParentNode();
      while ((node != null) && (!(node instanceof IPluginExtension))) {
        node = node.getParentNode();
      }
      if (node != null)
      {
        IPluginExtension extension = (IPluginExtension)node;
        ISchema schema = (ISchema)extension.getSchema();
        if (schema != null) {
          elementInfo = schema.findElement(getName());
        }
      }
    }
    return elementInfo;
  }
  
  public void reconnect(IDocumentElementNode parent, IModel model)
  {
    super.reconnect(parent, model);
    
    elementInfo = null;
  }
  
  public void write(String indent, PrintWriter writer)
  {
    writer.write(write(true));
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginElementNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.io.PrintWriter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.core.plugin.IPluginExtension;
import org.eclipse.pde.internal.core.PDECore;
import org.eclipse.pde.internal.core.ischema.ISchema;
import org.eclipse.pde.internal.core.schema.SchemaRegistry;
import org.eclipse.pde.internal.core.text.IDocumentAttributeNode;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;

public class PluginExtensionNode
  extends PluginParentNode
  implements IPluginExtension
{
  private static final long serialVersionUID = 1L;
  private transient ISchema fSchema;
  
  public String getPoint()
  {
    return getXMLAttributeValue("point");
  }
  
  public void setPoint(String point)
    throws CoreException
  {
    setXMLAttribute("point", point);
  }
  
  public void setName(String name)
    throws CoreException
  {
    setXMLAttribute("name", name);
  }
  
  public String getName()
  {
    return getXMLAttributeValue("name");
  }
  
  public String getTranslatedName()
  {
    String name = getName();
    if ((name != null) && (name.trim().length() > 0)) {
      return getResourceString(name);
    }
    String point = getPoint();
    ISchema schema = PDECore.getDefault().getSchemaRegistry().getSchema(point);
    return schema == null ? "" : schema.getName();
  }
  
  public String getId()
  {
    return getXMLAttributeValue("id");
  }
  
  public void setId(String id)
    throws CoreException
  {
    setXMLAttribute("id", id);
  }
  
  public String write(boolean indent)
  {
    String sep = getLineDelimiter();
    StringBuffer buffer = new StringBuffer();
    if (indent) {
      buffer.append(getIndent());
    }
    buffer.append(writeShallow(false));
    IDocumentElementNode[] children = getChildNodes();
    for (int i = 0; i < children.length; i++)
    {
      children[i].setLineIndent(getLineIndent() + 3);
      buffer.append(sep + children[i].write(true));
    }
    buffer.append(sep + getIndent() + "</extension>");
    return buffer.toString();
  }
  
  public void write(String indent, PrintWriter writer)
  {
    writer.write(write(true));
  }
  
  public String writeShallow(boolean terminate)
  {
    String sep = getLineDelimiter();
    String attrIndent = "      ";
    StringBuffer buffer = new StringBuffer("<extension");
    IDocumentAttributeNode attr = getDocumentAttribute("id");
    if ((attr != null) && (attr.getAttributeValue().trim().length() > 0)) {
      buffer.append(sep + getIndent() + attrIndent + attr.write());
    }
    attr = getDocumentAttribute("name");
    if ((attr != null) && (attr.getAttributeValue().trim().length() > 0)) {
      buffer.append(sep + getIndent() + attrIndent + attr.write());
    }
    attr = getDocumentAttribute("point");
    if ((attr != null) && (attr.getAttributeValue().trim().length() > 0)) {
      buffer.append(sep + getIndent() + attrIndent + attr.write());
    }
    if (terminate) {
      buffer.append("/");
    }
    buffer.append(">");
    return buffer.toString();
  }
  
  public Object getSchema()
  {
    if (fSchema == null)
    {
      SchemaRegistry registry = PDECore.getDefault().getSchemaRegistry();
      fSchema = registry.getSchema(getPoint());
    }
    else if (fSchema.isDisposed())
    {
      fSchema = null;
    }
    return fSchema;
  }
  
  public void reconnect(IDocumentElementNode parent, IModel model)
  {
    super.reconnect(parent, model);
    
    fSchema = null;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginExtensionNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.io.PrintWriter;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.IModel;
import org.eclipse.pde.core.plugin.IPluginBase;
import org.eclipse.pde.core.plugin.IPluginExtensionPoint;
import org.eclipse.pde.internal.core.text.IDocumentElementNode;

public class PluginExtensionPointNode
  extends PluginObjectNode
  implements IPluginExtensionPoint
{
  private static final long serialVersionUID = 1L;
  
  public String getFullId()
  {
    String id = getId();
    String version = getPluginBase().getSchemaVersion();
    if ((version != null) && (Double.parseDouble(version) >= 3.2D) && (id != null) && (id.indexOf('.') != -1)) {
      return id;
    }
    String pluginID = getPluginBase().getId();
    return pluginID != null ? pluginID + "." + id : id;
  }
  
  public String getSchema()
  {
    return getXMLAttributeValue("schema");
  }
  
  public void setSchema(String schema)
    throws CoreException
  {
    setXMLAttribute("schema", schema);
  }
  
  public String getId()
  {
    return getXMLAttributeValue("id");
  }
  
  public void setId(String id)
    throws CoreException
  {
    setXMLAttribute("id", id);
  }
  
  public void setName(String name)
    throws CoreException
  {
    setXMLAttribute("name", name);
  }
  
  public String getName()
  {
    return getXMLAttributeValue("name");
  }
  
  public String write(boolean indent)
  {
    return indent ? getIndent() + writeShallow(true) : writeShallow(true);
  }
  
  public String writeShallow(boolean terminate)
  {
    StringBuffer buffer = new StringBuffer("<extension-point");
    appendAttribute(buffer, "id");
    appendAttribute(buffer, "name");
    appendAttribute(buffer, "schema");
    if (terminate) {
      buffer.append("/");
    }
    buffer.append(">");
    return buffer.toString();
  }
  
  public void reconnect(IDocumentElementNode parent, IModel model)
  {
    super.reconnect(parent, model);
  }
  
  public void write(String indent, PrintWriter writer)
  {
    writer.write(write(true));
  }
  
  public void writeDelimeter(PrintWriter writer)
  {
    writer.println(getIndent());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginExtensionPointNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.pde.internal.core.text.plugin;

import java.util.TreeMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.pde.core.plugin.IPluginImport;

public class PluginImportNode
  extends PluginObjectNode
  implements IPluginImport
{
  private static final long serialVersionUID = 1L;
  
  public PluginImportNode(String id)
  {
    String name = "plugin";
    try
    {
      if (id == null) {
        id = "";
      }
      PluginAttribute attr = new PluginAttribute();
      attr.setName(name);
      attr.setEnclosingElement(this);
      getNodeAttributesMap().put(name, attr);
      attr.setValue(id);
    }
    catch (CoreException localCoreException) {}
  }
  
  public PluginImportNode() {}
  
  public boolean isReexported()
  {
    String value = getXMLAttributeValue("export");
    return (value != null) && (value.equals("true"));
  }
  
  public boolean isOptional()
  {
    String value = getXMLAttributeValue("optional");
    return (value != null) && (value.equals("true"));
  }
  
  public void setReexported(boolean value)
    throws CoreException
  {
    setXMLAttribute("export", value ? "true" : "false");
  }
  
  public void setOptional(boolean value)
    throws CoreException
  {
    setXMLAttribute("optional", value ? "true" : "false");
  }
  
  public int getMatch()
  {
    String match = getXMLAttributeValue("match");
    if ((match == null) || (match.trim().length() == 0)) {
      return 0;
    }
    if (match.equals("compatible")) {
      return 2;
    }
    if (match.equals("perfect")) {
      return 3;
    }
    if (match.equals("equivalent")) {
      return 1;
    }
    return 4;
  }
  
  public String getVersion()
  {
    return getXMLAttributeValue("version");
  }
  
  public void setMatch(int match)
    throws CoreException
  {
    switch (match)
    {
    case 4: 
      setXMLAttribute("match", "greaterOrEqual");
      break;
    case 1: 
      setXMLAttribute("match", "equivalent");
      break;
    case 2: 
      setXMLAttribute("match", "compatible");
      break;
    case 3: 
      setXMLAttribute("match", "perfect");
      break;
    default: 
      setXMLAttribute("match", null);
    }
  }
  
  public void setVersion(String version)
    throws CoreException
  {
    setXMLAttribute("version", version);
  }
  
  public String getId()
  {
    return getXMLAttributeValue("plugin");
  }
  
  public void setId(String id)
    throws CoreException
  {
    setXMLAttribute("plugin", id);
  }
  
  public String write(boolean indent)
  {
    return indent ? getIndent() + writeShallow(true) : writeShallow(true);
  }
  
  public String writeShallow(boolean terminate)
  {
    StringBuffer buffer = new StringBuffer("<import");
    appendAttribute(buffer, "plugin");
    appendAttribute(buffer, "version");
    appendAttribute(buffer, "match");
    appendAttribute(buffer, "export", "false");
    appendAttribute(buffer, "optional", "false");
    if (terminate) {
      buffer.append("/");
    }
    buffer.append(">");
    return buffer.toString();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.pde.internal.core.text.plugin.PluginImportNode
 * Java Class Version: 1.2 (46.0)
 * JD-Core Version:    0.7.1
 */
pa
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd