Package org.eclipse.wst.xml.core.internal.contentmodel

Examples of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap


        else if (contentType == CMElementDeclaration.ANY)
        {     
          CMDocument cmDocument =  (CMDocument)rootElementDeclaration.getProperty("CMDocument"); //$NON-NLS-1$
          if (cmDocument != null)
          {
            CMNamedNodeMap elements = cmDocument.getElements();           
            for (Iterator i = elements.iterator(); i.hasNext(); )
            {
              v.add(i.next());
            }
          }
        }
View Full Code Here


      for (Iterator iterator = list.iterator(); iterator.hasNext(); )
      {
        CMDocument cmdocument = (CMDocument)iterator.next();
        if (cmdocument != null)
        {                         
          CMNamedNodeMap map = cmdocument.getElements();
          int size = map.getLength();
          for (int i = 0; i < size; i++)
          {                      
            CMNode ed = map.item(i);                 
            addToTable(childNodeTable,ed);
          }       
        }               
      }
    }
View Full Code Here

    boolean result = true;   
    if (ed != null)
    {
      // first check to see if all the required attributes are present
      //                                                     
      CMNamedNodeMap map = ed.getAttributes();
      int mapLength = map.getLength();
      for (int i = 0; i < mapLength; i++)
      {                                                          
        CMAttributeDeclaration ad = (CMAttributeDeclaration)map.item(i);
        String attributeName = DOMNamespaceHelper.computeName(ad, element, null);
        if (ad.getUsage() == CMAttributeDeclaration.REQUIRED)
        {              
           Attr attr = element.getAttributeNode(attributeName);
           if (attr == null)
View Full Code Here

      {      
        createElementNodeStart(ed);      
       
        // instead of calling super.visitCMElementDeclaration()
        // we duplicate the code with some minor modifications
        CMNamedNodeMap nodeMap = ed.getAttributes();
        int size = nodeMap.getLength();
        for (int j = 0; j < size; j++)
        {
          visitCMNode(nodeMap.item(j));
        }

        CMContent content = ed.getContent();
        if (content != null)
        {
View Full Code Here

    sb.append("#PCDATA"); //$NON-NLS-1$
  }

  public void visitCMDocument(CMDocument document)
  {
    CMNamedNodeMap map = document.getElements();
    int size = map.getLength();
    for (int i = 0; i < size; i++)
    {
      visitCMNode(map.item(i));
    }
  }
View Full Code Here

        else if (contentType == CMElementDeclaration.ANY)
        {     
          CMDocument cmDocument =  (CMDocument)rootElementDeclaration.getProperty("CMDocument"); //$NON-NLS-1$
          if (cmDocument != null)
          {
            CMNamedNodeMap elements = cmDocument.getElements();           
            for (Iterator i = elements.iterator(); i.hasNext(); )
            {
              v.add(i.next());
            }
          }
        }
View Full Code Here

      for (Iterator iterator = list.iterator(); iterator.hasNext(); )
      {
        CMDocument cmdocument = (CMDocument)iterator.next();
        if (cmdocument != null)
        {                         
          CMNamedNodeMap map = cmdocument.getElements();
          int size = map.getLength();
          for (int i = 0; i < size; i++)
          {                      
            CMNode ed = map.item(i);                 
            addToTable(childNodeTable,ed);
          }       
        }               
      }
    }
View Full Code Here

            cmDocumentErrorMessage = errorInfo[1];
          }

          combo.removeAll();
          if ((generator.getCMDocument() != null) && (cmDocumentErrorMessage == null)) {
            CMNamedNodeMap nameNodeMap = generator.getCMDocument().getElements();
            Vector nameNodeVector = new Vector();

            for (int i = 0; i < nameNodeMap.getLength(); i++) {
              CMElementDeclaration cmElementDeclaration = (CMElementDeclaration) nameNodeMap.item(i);
              Object value = cmElementDeclaration.getProperty("Abstract"); //$NON-NLS-1$
              if (value != Boolean.TRUE) {
                nameNodeVector.add(cmElementDeclaration.getElementName());
              }
            }
View Full Code Here

   * Returns the current collection of property descriptors.
   *
   * @return all valid descriptors.
   */
  private IPropertyDescriptor[] createPropertyDescriptors() {
    CMNamedNodeMap attrMap = null;
    CMElementDeclaration ed = getDeclaration();
    if (ed != null) {
      attrMap = ed.getAttributes();
      CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attrMap);
      List nodes = ModelQueryUtil.getModelQuery(fNode.getOwnerDocument()).getAvailableContent((Element) fNode, ed, ModelQuery.INCLUDE_ATTRIBUTES);
      for (int k = 0; k < nodes.size(); k++) {
        CMNode cmnode = (CMNode) nodes.get(k);
        if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
          allAttributes.put(cmnode);
        }
      }
      attrMap = allAttributes;
    }

    List descriptorList = new ArrayList();
    List names = new ArrayList();
    IPropertyDescriptor descriptor;

    CMAttributeDeclaration attrDecl = null;

    // add descriptors for existing attributes
    NamedNodeMap attributes = fNode.getAttributes();
    if (attributes != null) {
      for (int i = 0; i < attributes.getLength(); i++) {
        Attr attr = (Attr) attributes.item(i);
        // if metainfo is present for this attribute, use the
        // CMAttributeDeclaration to derive a descriptor
        if (attrMap != null) {
          String attrName = attr.getName();
          if (fCaseSensitive) {
            attrDecl = (CMAttributeDeclaration) attrMap.getNamedItem(attrName);
          }
          else {
            attrDecl = null;
            for (int j = 0; j < attrMap.getLength(); j++) {
              if (!fCaseSensitive && attrMap.item(j).getNodeName().equalsIgnoreCase(attrName)) {
                attrDecl = (CMAttributeDeclaration) attrMap.item(j);
                break;
              }
            }
          }
        }
        // be consistent: if there's metainfo, use *that* as the
        // descriptor ID
        descriptor = null;
        if (attrDecl != null) {
          String attrName = DOMNamespaceHelper.computeName(attrDecl, fNode, null);
          if (!names.contains(attrName)) {
            descriptor = createPropertyDescriptor(attrDecl, attr);
            if (descriptor != null)
              names.add(attrName);
          }
        }
        else {
          if (!names.contains(attr.getName())) {
            descriptor = createDefaultPropertyDescriptor(attr.getName());
            if (descriptor != null)
              names.add(attr.getName());
          }
        }
        if (descriptor != null) {
          descriptorList.add(descriptor);
        }
      }
    }

    // add descriptors from the metainfo that are not yet listed
    if (attrMap != null) {
      for (int i = 0; i < attrMap.getLength(); i++) {
        attrDecl = (CMAttributeDeclaration) attrMap.item(i);
        String attrName = DOMNamespaceHelper.computeName(attrDecl, fNode, null);
        if (!names.contains(attrName)) {
          IPropertyDescriptor holdDescriptor = createPropertyDescriptor(attrDecl, null);
          if (holdDescriptor != null) {
            names.add(attrName);
View Full Code Here

  /**
   * Resets the specified property's value to its default value.
   */
  public void resetPropertyValue(Object propertyObject) {
    String property = propertyObject.toString();
    CMNamedNodeMap attrDecls = null;

    CMElementDeclaration ed = getDeclaration();
    if (ed != null) {
      attrDecls = ed.getAttributes();
      CMNamedNodeMapImpl allAttributes = new CMNamedNodeMapImpl(attrDecls);
      List nodes = ModelQueryUtil.getModelQuery(fNode.getOwnerDocument()).getAvailableContent((Element) fNode, ed, ModelQuery.INCLUDE_ATTRIBUTES);
      for (int k = 0; k < nodes.size(); k++) {
        CMNode cmnode = (CMNode) nodes.get(k);
        if (cmnode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION) {
          allAttributes.put(cmnode);
        }
      }
      attrDecls = allAttributes;
    }

    NamedNodeMap attrMap = fNode.getAttributes();
    if (attrDecls != null) {
      CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) attrDecls.getNamedItem(property);
      String defValue = null;
      if (attrDecl != null) {
        if (attrDecl.getAttrType() != null) {
          CMDataType helper = attrDecl.getAttrType();
          if ((helper.getImpliedValueKind() != CMDataType.IMPLIED_VALUE_NONE) && (helper.getImpliedValue() != null)) {
View Full Code Here

TOP

Related Classes of org.eclipse.wst.xml.core.internal.contentmodel.CMNamedNodeMap

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.