Examples of CMAttributeDeclaration


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

      int nodeType = node.getNodeType();
      switch (nodeType)
      {
        case Node.ATTRIBUTE_NODE:
        {
          CMAttributeDeclaration ad = getCMAttributeDeclaration((Attr)node);
          if (ad != null)
          {
            result = (ad.getUsage() == CMAttributeDeclaration.OPTIONAL);
          }
          break;
        }
        case Node.ELEMENT_NODE:
        {
View Full Code Here

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

          
  protected void addValuesForXSIType(Element element, CMNode cmNode, List list)
  {              
    if (cmNode != null && cmNode.getNodeType() == CMNode.ATTRIBUTE_DECLARATION)
    {                        
      CMAttributeDeclaration ad = (CMAttributeDeclaration)cmNode;                             
      if (valueHelper.isXSIType(ad))
      {            
        NamespaceTable table = new NamespaceTable(element.getOwnerDocument());
        table.addElementLineage(element);
        list.addAll(valueHelper.getQualifiedXSITypes(ad, table));    
View Full Code Here

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

  }


  public CMAttributeDeclaration getCMAttributeDeclaration(Attr attr)
  {
    CMAttributeDeclaration result = null;
    Element element = attr.getOwnerElement();
    if (element != null)
    {
      CMElementDeclaration ed = getCMElementDeclaration(element);
      if (ed != null)
View Full Code Here

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

      visitCMNode(rootElementDeclaration);
     
      if ((includeOptions & INCLUDE_ATTRIBUTES) != 0)
      {
        v.addAll(attributeTable.values());
        CMAttributeDeclaration nillableAttribute = (CMAttributeDeclaration)rootElementDeclaration.getProperty("http://org.eclipse.wst/cm/properties/nillable"); //$NON-NLS-1$
        if (nillableAttribute != null)
        {
          v.add(nillableAttribute);
        }
      } 
View Full Code Here

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

    IPropertyDescriptor result = null;

    String attributeName = attr.getName();
    ModelQuery mq = ModelQueryUtil.getModelQuery(attr.getOwnerDocument());

    CMAttributeDeclaration ad = null;
    if (mq != null) {
      ad = mq.getCMAttributeDeclaration(attr);
    }
    if (ad != null) {
      result = createPropertyDescriptorHelper(attributeName, attr.getOwnerElement(), ad);
View Full Code Here

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

    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++) {
View Full Code Here

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

      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)) {
            defValue = helper.getImpliedValue();
          }
        }
      }
View Full Code Here

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

      attrMap = allAttributes;
    }
    // Update exiting descriptors; not added to the final list here
    if (attrMap != null) {
      // Update existing descriptor types based on metainfo
      CMAttributeDeclaration attrDecl = null;
      for (int i = 0; i < attrMap.getLength(); i++) {
        attrDecl = (CMAttributeDeclaration) attrMap.item(i);
        String attrName = DOMNamespaceHelper.computeName(attrDecl, fNode, null);
        if (!declaredNames.contains(attrName)) {
          declaredNames.add(attrName);
        }
        for (int j = 0; j < fDescriptors.length; j++) {
          boolean sameName = (fCaseSensitive && fDescriptors[j].getId().equals(attrDecl.getNodeName())) || (!fCaseSensitive && attrDecl.getNodeName().equals(fDescriptors[j].getId().toString()));
          if (sameName) {
            String[] validValues = getValidValues(attrDecl);
            // Update the descriptor for this
            // CMAttributeDeclaration (only enumerated values get
            // updated for now)
            if (fDescriptors[j] instanceof EnumeratedStringPropertyDescriptor) {
              ((EnumeratedStringPropertyDescriptor) fDescriptors[j]).updateValues(validValues);
            }
            // Replace with better descriptor
            else if ((validValues != null) && (validValues.length > 0)) {
              fDescriptors[j] = createPropertyDescriptor(attrDecl, null);
            }
          }
        }
      }
    }
    else {
      // Update existing descriptors based on not having any metainfo
      for (int j = 0; j < fDescriptors.length; j++) {
        // Replace with basic descriptor
        if (!(fDescriptors[j] instanceof TextPropertyDescriptor)) {
          fDescriptors[j] = createDefaultPropertyDescriptor((String) fDescriptors[j].getId());
        }
      }
    }

    NamedNodeMap attributes = fNode.getAttributes();

    // Remove descriptors for attributes that aren't present AND aren't
    // known through metainfo,
    // do this by only reusing existing descriptors for attributes that
    // are present or declared
    for (int i = 0; i < fDescriptors.length; i++) {
      if (fDescriptors[i] != null) {
        String descriptorName = fDescriptors[i].getId().toString();
        if ((declaredNames.contains(descriptorName) || (attributes.getNamedItem(descriptorName) != null)) && !descriptorNames.contains(descriptorName)) {
          descriptorNames.add(descriptorName);
          descriptors.add(fDescriptors[i]);
        }
      }
    }

    // Add descriptors for declared attributes that don't already have one
    if (attrMap != null) {
      // Update existing descriptor types based on metainfo
      CMAttributeDeclaration attrDecl = null;
      for (int i = 0; i < attrMap.getLength(); i++) {
        attrDecl = (CMAttributeDeclaration) attrMap.item(i);
        String attrName = DOMNamespaceHelper.computeName(attrDecl, fNode, null);
        if (fCaseSensitive) {
          if (!descriptorNames.contains(attrName)) {
View Full Code Here

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

          allAttributes.put(cmnode);
        }
      }
      attrDecls = allAttributes;

      CMAttributeDeclaration attrDecl = (CMAttributeDeclaration) attrDecls.getNamedItem(attrName);
      if ((attrDecl != null) && (attrDecl.getAttrType() != null) && (CMDataType.URI.equals(attrDecl.getAttrType().getDataTypeName()))) {
        return true;
      }
    }
    return false;
  }
View Full Code Here

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

  }  


  public CMAttributeDeclaration getCMAttributeDeclaration(Attr attr)
  {
    CMAttributeDeclaration result = null;
    Element element = attr.getOwnerElement();
    if (element != null)
    {
      CMElementDeclaration ed = getCMElementDeclaration(element);
      if (ed != null)
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.